fix: improve our docker config (#1373)
* greatly simplify docker * back to gcc since I can't the libs to load properly * fix typo add set -e to entrypoint better copy of entrypoint.sh and use proper entrypoint * use debian instead of gcc for runtime comment and organize it a bit drop gcc to 12 since we are using debian 12 as well * explicitly include mariadb libs * Make the server not crash in the case we are using only env-vars make the dockerfile have configs in the expected location incase of bypassing entrypoint.sh * remove unneede var from example, since it's in the container now * coments to dockerfile * Revert master server changes * Resolve conflicting port options between chat, master, and world move chat_server_port to shared since it's used by world and chat * Don't error if file does not exists when updating a config option move update before and use bin dir var
@ -3,8 +3,8 @@ Dockerfile
|
|||||||
*.md
|
*.md
|
||||||
logo.png
|
logo.png
|
||||||
versions.txt
|
versions.txt
|
||||||
build.sh
|
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
.env
|
.env
|
||||||
docker/__pycache__
|
docker/__pycache__
|
||||||
.env.example
|
.env.example
|
||||||
|
build
|
||||||
|
56
.github/workflows/build-and-push-docker.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=ref,event=pr
|
||||||
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
3
.gitmodules
vendored
@ -14,9 +14,6 @@
|
|||||||
path = thirdparty/mariadb-connector-cpp
|
path = thirdparty/mariadb-connector-cpp
|
||||||
url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git
|
url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
[submodule "thirdparty/AccountManager"]
|
|
||||||
path = thirdparty/AccountManager
|
|
||||||
url = https://github.com/DarkflameUniverse/AccountManager
|
|
||||||
[submodule "thirdparty/magic_enum"]
|
[submodule "thirdparty/magic_enum"]
|
||||||
path = thirdparty/magic_enum
|
path = thirdparty/magic_enum
|
||||||
url = https://github.com/Neargye/magic_enum.git
|
url = https://github.com/Neargye/magic_enum.git
|
||||||
|
@ -100,6 +100,9 @@ set(RESOURCE_FILES "sharedconfig.ini" "authconfig.ini" "chatconfig.ini" "worldco
|
|||||||
message(STATUS "Checking resource file integrity")
|
message(STATUS "Checking resource file integrity")
|
||||||
|
|
||||||
include(Utils)
|
include(Utils)
|
||||||
|
UpdateConfigOption(${PROJECT_BINARY_DIR}/authconfig.ini "port" "auth_server_port")
|
||||||
|
UpdateConfigOption(${PROJECT_BINARY_DIR}/chatconfig.ini "port" "chat_server_port")
|
||||||
|
UpdateConfigOption(${PROJECT_BINARY_DIR}/masterconfig.ini "port" "master_server_port")
|
||||||
|
|
||||||
foreach(resource_file ${RESOURCE_FILES})
|
foreach(resource_file ${RESOURCE_FILES})
|
||||||
set(file_size 0)
|
set(file_size 0)
|
||||||
|
46
Docker.md
@ -1,46 +0,0 @@
|
|||||||
# Run the Darkflame Server inside Docker
|
|
||||||
|
|
||||||
## What you need
|
|
||||||
|
|
||||||
- [Docker](https://docs.docker.com/get-docker/) (Docker Desktop or on Linux normal Docker)
|
|
||||||
- [Docker Compose](https://docs.docker.com/compose/install/) (Included in Docker Desktop)
|
|
||||||
- LEGO® Universe Client. Check the main [README](./README.md) for details on this.
|
|
||||||
|
|
||||||
## Run server inside Docker
|
|
||||||
|
|
||||||
1. Copy `.env.example` and save it as `.env` inside the root directory of this repository
|
|
||||||
2. Edit the `.env` file and add your path to the root directory of your LEGO® Universe Client after `CLIENT_PATH=`
|
|
||||||
3. Update other values in the `.env` file as needed (be sure to update passwords!)
|
|
||||||
4. Run `docker compose up -d --build`
|
|
||||||
5. Run `docker compose exec darkflame /app/MasterServer -a` and setup your admin account
|
|
||||||
6. Follow the directions [here](https://github.com/DarkflameUniverse/AccountManager) to setup regular user accounts. The server will be accessible at: `http://<EXTERNAL_IP>:5000`
|
|
||||||
7. Now you can see the output of the server with `docker compose logs -f --tail 100` or `docker compose logs -f --tail 100`. This can help you understand issues and there you can also see when the server finishes it's startup.
|
|
||||||
8. You're ready to connect your client!
|
|
||||||
|
|
||||||
**NOTE #1**: If you're running an older version of Docker, you may need to use the command `docker-compose` instead of `docker compose`.
|
|
||||||
|
|
||||||
**NOTE #2**: To stop the server simply run `docker compose down` and to restart it just run `docker compose up -d` again. No need to run all the steps above every time.
|
|
||||||
|
|
||||||
**NOTE #3**: Docker buildkit needs to be enabled. https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds
|
|
||||||
|
|
||||||
**NOTE #4**: Make sure to run the following in the repo root directory after cloning so submodules are also downloaded.
|
|
||||||
```
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
**NOTE #5**: If DarkflameSetup fails due to not having cdclient.fdb, rename CDClient.fdb (in the same folder) to cdclient.fdb
|
|
||||||
|
|
||||||
## Disable brickbuildfix
|
|
||||||
|
|
||||||
If you don't need the http server running on port 80 do this:
|
|
||||||
|
|
||||||
1. Create a file with the name `docker-compose.override.yml` in the root of the repository
|
|
||||||
2. Paste this content:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
services:
|
|
||||||
brickbuildfix:
|
|
||||||
profiles:
|
|
||||||
- donotstart
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Now run `docker compose up -d`
|
|
@ -1,58 +0,0 @@
|
|||||||
# Installation under Windows
|
|
||||||
## First Run
|
|
||||||
1. Navigate to the [Docker download page](https://www.docker.com/products/docker-desktop) and download docker.
|
|
||||||
|
|
||||||
![Docker Download Page](docker/images/Docker_Download_Page.png)
|
|
||||||
|
|
||||||
2. Once the file has finished downloading, run it and proceed through the installation. Make sure, "Install required Windows components for WSL 2" is checked.
|
|
||||||
|
|
||||||
![Docker Desktop Installer Configuration](docker/images/Docker_Desktop_Installer_Configuration.png)
|
|
||||||
|
|
||||||
3. If necessary, restart your computer.
|
|
||||||
4. After the restart, Docker Desktop will automatically open. If it does not, simply start it like any other program.
|
|
||||||
5. If a window "WSL 2 Installation is incomplete." pops up, follow the link and click "WSL2 Linux kernel update package for x64 machines". Run the downloaded file and once that finishes, click "Restart" in the Docker Desktop window.
|
|
||||||
|
|
||||||
![WSL 2 download](docker/images/WSL_2_download.png)
|
|
||||||
|
|
||||||
6. Wait until Docker Desktop has started. You may skip the tutorial.
|
|
||||||
7. You may want to disable "Open Docker Dashboard at startup" in _Settings_ -> _General_
|
|
||||||
|
|
||||||
![Disable Dashboard Autostart](docker/images/DD_General_Settings.png)
|
|
||||||
|
|
||||||
8. Install [Git for Windows](https://git-scm.com/download/win). During the installation, simply confirming the defaults is sufficient.
|
|
||||||
9. In the folder you wish to save the Server, right click and select "Git Bash Here".
|
|
||||||
10. Type `git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer`
|
|
||||||
11. Once the command has completed (you can see you path again and can enter commands), close the window.
|
|
||||||
12. Inside the downloaded folder, copy `.env.example` and name the copy `.env`
|
|
||||||
13. Open `.env` with Notepad by right-clicking it and selecting _Open With_ -> _More apps_ -> _Notepad_.
|
|
||||||
14. Change the text after `CLIENT_PATH=` to the location of your client. This folder must contain either a folder `client` or `legouniverse.exe`.
|
|
||||||
> If you need the extra performance, place the client files in `\\wsl$\<your linux OS>\...` to avoid working across file systems, see [Docker Best Practices](https://docs.docker.com/desktop/windows/wsl/#best-practices) and [WSL documentation](https://docs.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems).
|
|
||||||
|
|
||||||
15. Optionally, you can change the number after `BUILD_THREADS=` to the number of cores / threads your processor has. If your computer crashes while building, you can try to reduce this value.
|
|
||||||
16. After `ACCOUNT_MANAGER_SECRET=` paste a "SHA 256-bit Key" from https://keygen.io/
|
|
||||||
17. If you are not only hosting a local server, change the value after `EXTERNAL_IP=` to the external IP address of your computer.
|
|
||||||
18. Change the two values `SECRET_VALUE_CHANGE_ME` to passwords only you know. Save and close the file.
|
|
||||||
19. In the extracted folder hit Shift+Right Click and select "Open PowerShell window here".
|
|
||||||
|
|
||||||
![Open PowerShell](docker/images/Open_Powershell.png)
|
|
||||||
|
|
||||||
17. In the new window, paste (with right click) or type `docker compose up -d --build` and confirm with enter.
|
|
||||||
18. Once you see the blinking cursor and the path again, setup has finished and the server is already running.
|
|
||||||
|
|
||||||
![setup done](docker/images/setup_finished.png)
|
|
||||||
|
|
||||||
19. Create an admin account by pasting `docker compose exec darkflame /app/MasterServer -a` and following the prompts.
|
|
||||||
|
|
||||||
![admin account creation](docker/images/Account_Creation.png)
|
|
||||||
|
|
||||||
20. You can now login with these credentials at `http://your_ip:5000` (replace your_ip with your external IP). There you can create your account for playing as well as generate keys for other people to join; use these at `http://your_ip:5000/activate`
|
|
||||||
|
|
||||||
## Normal Use
|
|
||||||
1. In Docker Desktop you should now see an entry `darkflameserver-main` and when you click on it all containers but `DarkflameSetup` should eventually be green. That means the server is running.
|
|
||||||
|
|
||||||
![server running](docker/images/Docker_Compose_Finished.png)
|
|
||||||
|
|
||||||
2. For troubleshooting, you can check the logs of the various parts by clicking their entry.
|
|
||||||
3. You can start and stop the server with the corresponding buttons. Once all containers are grey, the server has shut down, and when all containers but `DarkflameSetup` are green, the server is running. Note that starting and stopping takes some time, please be patient.
|
|
||||||
|
|
||||||
![start stop buttons](docker/images/DD_Server_Startstop.png)
|
|
51
Dockerfile
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
FROM gcc:12 as build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get install -y cmake
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
COPY --chmod=0500 ./build.sh /app/
|
||||||
|
|
||||||
|
RUN sed -i 's/MARIADB_CONNECTOR_COMPILE_JOBS__=.*/MARIADB_CONNECTOR_COMPILE_JOBS__=2/' /app/CMakeVariables.txt
|
||||||
|
|
||||||
|
RUN ./build.sh
|
||||||
|
|
||||||
|
FROM debian:12 as runtime
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \
|
||||||
|
apt update && \
|
||||||
|
apt install -y libssl3 libcurl4 && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Grab libraries and load them
|
||||||
|
COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/libmariadbcpp.so /usr/local/lib/
|
||||||
|
COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/libmariadb/libmariadb/libmariadb.so.3 /usr/local/lib
|
||||||
|
RUN ldconfig
|
||||||
|
|
||||||
|
# Server bins
|
||||||
|
COPY --from=build /app/build/*Server /app/
|
||||||
|
|
||||||
|
# Necessary suplimentary files
|
||||||
|
COPY --from=build /app/build/*.ini /app/configs/
|
||||||
|
COPY --from=build /app/build/vanity/*.* /app/vanity/*
|
||||||
|
COPY --from=build /app/build/navmeshes /app/navmeshes
|
||||||
|
COPY --from=build /app/build/migrations /app/migrations
|
||||||
|
COPY --from=build /app/build/*.dcf /app/
|
||||||
|
|
||||||
|
# backup of config and vanity files to copy to the host incase
|
||||||
|
# of a mount clobbering the copy from above
|
||||||
|
COPY --from=build /app/build/*.ini /app/default-configs/
|
||||||
|
COPY --from=build /app/build/vanity/*.* /app/default-vanity/*
|
||||||
|
|
||||||
|
# needed as the container runs with the root user
|
||||||
|
# and therefore sudo doesn't exist
|
||||||
|
ENV USE_SUDO_AUTH=0
|
||||||
|
ENV DLU_CONFIG_DIR=/app/configs/
|
||||||
|
|
||||||
|
COPY --chmod=0500 ./entrypoint.sh /app/
|
||||||
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
37
README.md
@ -37,6 +37,7 @@ If you would like a setup for a single player server only on a Windows machine,
|
|||||||
* [Verify your setup](#verify-your-setup)
|
* [Verify your setup](#verify-your-setup)
|
||||||
* [Running the server](#running-the-server)
|
* [Running the server](#running-the-server)
|
||||||
* [User Guide](#user-guide)
|
* [User Guide](#user-guide)
|
||||||
|
* [Docker](#docker)
|
||||||
|
|
||||||
## Clone the repository
|
## Clone the repository
|
||||||
If you are on Windows, you will need to download and install git from [here](https://git-scm.com/download/win)
|
If you are on Windows, you will need to download and install git from [here](https://git-scm.com/download/win)
|
||||||
@ -347,6 +348,42 @@ certutil -hashfile <file> SHA1
|
|||||||
Known good *SHA1* checksum of the Darkflame Universe client:
|
Known good *SHA1* checksum of the Darkflame Universe client:
|
||||||
- `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed)
|
- `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed)
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
|
||||||
|
## Standalone
|
||||||
|
|
||||||
|
For standalone deployment, you can use the image provided via Github's Container Repository:
|
||||||
|
`ghcr.io/darkflameuniverse/darkflameserver`
|
||||||
|
|
||||||
|
This assumes that you have a database deployed to your host or in another docker container.
|
||||||
|
|
||||||
|
A basic deployment of this contianer would look like:
|
||||||
|
```sh
|
||||||
|
# example docker contianer deployment
|
||||||
|
docker run -it \
|
||||||
|
-v /path/to/configs/:/app/configs \
|
||||||
|
-v /path/to/logs/:/app/logs \
|
||||||
|
-v /path/to/dumps/:/app/dumps \
|
||||||
|
-v /path/to/res:/app/res:ro \
|
||||||
|
-v /path/to/resServer:/app/resServer \
|
||||||
|
-e DUMP_FOLDER=/app/dumps \
|
||||||
|
-p 1001:1001/udp \
|
||||||
|
-p 2005:2005/udp \
|
||||||
|
-p 3000-3300:3000-3300/udp \
|
||||||
|
ghcr.io/darkflameuniverse/darkflameserver:latest
|
||||||
|
```
|
||||||
|
You will need to replace the `/path/to/`'s to reflect the paths on your host.
|
||||||
|
|
||||||
|
Any config option in the `.ini`'s can be overridden with environmental variables: Ex: `log_to_console=1` from `shared_config.ini` would be overidden like `-e LOG_TO_CONSOLE=0`
|
||||||
|
|
||||||
|
## Compose
|
||||||
|
|
||||||
|
See the [compose](docker-compose.yml) file in the root of the repo.
|
||||||
|
|
||||||
|
This compose file is for a full deployment: MariaDB, DarkflameServer, and Nexus Dashboard.
|
||||||
|
|
||||||
|
All of the environmental options are listed in the compose file so the can be pass through, or you can edit the compose file to suit your specific needs
|
||||||
|
|
||||||
# Development Documentation
|
# Development Documentation
|
||||||
This is a Work in Progress, but below are some quick links to documentaion for systems and structs in the server
|
This is a Work in Progress, but below are some quick links to documentaion for systems and structs in the server
|
||||||
[Networked message structs](https://lcdruniverse.org/lu_packets/lu_packets/index.html)
|
[Networked message structs](https://lcdruniverse.org/lu_packets/lu_packets/index.html)
|
||||||
|
@ -7,6 +7,10 @@ function(UpdateConfigOption file_name old_option_name new_option_name)
|
|||||||
string(APPEND old_option_name "=")
|
string(APPEND old_option_name "=")
|
||||||
string(APPEND new_option_name "=")
|
string(APPEND new_option_name "=")
|
||||||
message(STATUS "Checking " ${file_name} " for " ${old_option_name} " and adding " ${new_option_name} " if it does not exist")
|
message(STATUS "Checking " ${file_name} " for " ${old_option_name} " and adding " ${new_option_name} " if it does not exist")
|
||||||
|
if(NOT EXISTS ${file_name})
|
||||||
|
message(STATUS ${file_name} " does not exist. Doing nothing")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
file(READ ${file_name} current_file_contents)
|
file(READ ${file_name} current_file_contents)
|
||||||
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
string(REPLACE "\\\n" "" current_file_contents ${current_file_contents})
|
||||||
string(REPLACE "\n" ";" current_file_contents ${current_file_contents})
|
string(REPLACE "\n" ";" current_file_contents ${current_file_contents})
|
||||||
|
@ -86,7 +86,7 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t maxClients = 50;
|
uint32_t maxClients = 50;
|
||||||
uint32_t ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
|
uint32_t ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
|
||||||
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
||||||
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
|
if (Game::config->GetValue("auth_server_port") != "") ourPort = std::atoi(Game::config->GetValue("auth_server_port").c_str());
|
||||||
|
|
||||||
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Auth, Game::config, &Game::lastSignal);
|
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Auth, Game::config, &Game::lastSignal);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t maxClients = 50;
|
uint32_t maxClients = 50;
|
||||||
uint32_t ourPort = 1501;
|
uint32_t ourPort = 1501;
|
||||||
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
||||||
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
|
if (Game::config->GetValue("chat_server_port") != "") ourPort = std::atoi(Game::config->GetValue("chat_server_port").c_str());
|
||||||
|
|
||||||
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Chat, Game::config, &Game::lastSignal);
|
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::Chat, Game::config, &Game::lastSignal);
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t maxClients = 999;
|
uint32_t maxClients = 999;
|
||||||
uint32_t ourPort = 1000;
|
uint32_t ourPort = 1000;
|
||||||
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
|
||||||
if (Game::config->GetValue("port") != "") ourPort = std::stoi(Game::config->GetValue("port"));
|
if (Game::config->GetValue("master_server_port") != "") ourPort = std::stoi(Game::config->GetValue("master_server_port"));
|
||||||
|
|
||||||
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, true, false, Game::logger, "", 0, ServerType::Master, Game::config, &Game::lastSignal);
|
Game::server = new dServer(Game::config->GetValue("external_ip"), ourPort, 0, maxClients, true, false, Game::logger, "", 0, ServerType::Master, Game::config, &Game::lastSignal);
|
||||||
|
|
||||||
|
@ -1,104 +1,66 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
setup:
|
darkflamedb:
|
||||||
container_name: DarkflameSetup
|
image: mariadb:latest
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./docker/setup.Dockerfile
|
|
||||||
environment:
|
|
||||||
- DATABASE=${MARIADB_DATABASE:-darkflame}
|
|
||||||
- DATABASE_HOST=database
|
|
||||||
- DATABASE_USER=${MARIADB_USER:-darkflame}
|
|
||||||
- DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame}
|
|
||||||
- EXTERNAL_IP=${EXTERNAL_IP:-darkflame}
|
|
||||||
- BUILD_VERSION=${BUILD_VERSION:?171022}
|
|
||||||
volumes:
|
|
||||||
- ${CLIENT_PATH:?missing_client_path}:/client
|
|
||||||
- shared_configs:/docker/
|
|
||||||
|
|
||||||
database:
|
|
||||||
container_name: DarkflameDatabase
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./docker/database.Dockerfile
|
|
||||||
environment:
|
environment:
|
||||||
- MARIADB_USER=${MARIADB_USER:-darkflame}
|
- MARIADB_USER=${MARIADB_USER:-darkflame}
|
||||||
- MARIADB_PASSWORD=${MARIADB_PASSWORD:-darkflame}
|
- MARIADB_PASSWORD=${MARIADB_PASSWORD:-darkflame}
|
||||||
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-darkflame}
|
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-darkflame}
|
||||||
- MARIADB_DATABASE=${MARIADB_DATABASE:-darkflame}
|
- MARIADB_DATABASE=${MARIADB_DATABASE:-darkflame}
|
||||||
volumes:
|
|
||||||
- database:/var/lib/mysql
|
|
||||||
networks:
|
networks:
|
||||||
- darkflame
|
- darkflame
|
||||||
# You can expose these so that DB management tools can connect (WARNING: INSECURE)
|
|
||||||
# ports:
|
|
||||||
# - 3306:3306
|
|
||||||
|
|
||||||
darkflame:
|
darkfameserver:
|
||||||
container_name: DarkflameServer
|
|
||||||
networks:
|
networks:
|
||||||
- darkflame
|
- darkflame
|
||||||
build:
|
image: ghcr.io/darkflameuniverse/darkflameserver:latest
|
||||||
context: .
|
|
||||||
dockerfile: ./docker/Dockerfile
|
|
||||||
args:
|
|
||||||
- BUILD_THREADS=${BUILD_THREADS:-1}
|
|
||||||
- BUILD_VERSION=${BUILD_VERSION:-171022}
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${CLIENT_PATH:?missing_client_path}:/client:ro
|
- $HOST_CONFIG_DIR:/app/configs/
|
||||||
- shared_configs:/shared_configs:ro
|
- $HOST_CLIENT_LOCATION:$CLIENT_LOCATION:ro
|
||||||
|
- $HOST_RESSERVER_LOCATION:/app/resServer/
|
||||||
|
- $HOST_DUMP_FOLDER:$DUMP_FOLDER
|
||||||
|
- $HOST_LOGS_DIR:/app/logs/
|
||||||
|
environment:
|
||||||
|
- DLU_CONFIG_DIR=/app/configs
|
||||||
|
- MYSQL_HOST=darkflamedb
|
||||||
|
- MYSQL_DATABASE=${MARIADB_DATABASE:-darkflame}
|
||||||
|
- MYSQL_USERNAME=${MARIADB_USER:-darkflame}
|
||||||
|
- MYSQL_PASSWORD=${MARIADB_PASSWORD:-darkflame}
|
||||||
|
- EXTERNAL_IP=${EXTERNAL_IP:-localhost}
|
||||||
|
- DUMP_FOLDER=$DUMP_FOLDER
|
||||||
|
- CLIENT_LOCATION=$CLIENT_LOCATION
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- darkflamedb
|
||||||
ports:
|
ports:
|
||||||
- "1001:1001/udp"
|
- "1001:1001/udp"
|
||||||
- "2000:2000/udp"
|
|
||||||
- "2005:2005/udp"
|
- "2005:2005/udp"
|
||||||
- "3000-3300:3000-3300/udp"
|
- "3000-3300:3000-3300/udp"
|
||||||
|
|
||||||
brickbuildfix:
|
darkflameweb:
|
||||||
container_name: DarkflameBrickBuildFix
|
|
||||||
networks:
|
networks:
|
||||||
- darkflame
|
- darkflame
|
||||||
build:
|
image: ghcr.io/darkflameuniverse/nexusdashboard:latest
|
||||||
context: .
|
volumes:
|
||||||
dockerfile: ./docker/brickfix.Dockerfile
|
- $HOST_CLIENT_LOCATION:/app/luclient:ro
|
||||||
ports:
|
- $HOST_CACHE_LOCATION:/app/cache
|
||||||
- 80:80
|
- $HOST_CD_SQLITE_LOCATION:/app/cdclient:ro
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:80"]
|
|
||||||
interval: 2m
|
|
||||||
timeout: 3s
|
|
||||||
retries: 3
|
|
||||||
start_period: 40s
|
|
||||||
|
|
||||||
account-manager:
|
|
||||||
container_name: DarkflameAccountManager
|
|
||||||
networks:
|
|
||||||
- darkflame
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./docker/AccountManager.Dockerfile
|
|
||||||
environment:
|
environment:
|
||||||
- DATABASE=${MARIADB_DATABASE:-darkflame}
|
- APP_SECRET_KEY=$APP_SECRET_KEY
|
||||||
- DATABASE_HOST=database
|
- APP_DATABASE_URI=mysql+pymysql://${MARIADB_USER:-darkflame}:${MARIADB_PASSWORD:-darkflame}@darkflamedb:3306/${MARIADB_DATABASE:-darkflame}
|
||||||
- DATABASE_USER=${MARIADB_USER:-darkflame}
|
- CLIENT_LOCATION=/app/luclient
|
||||||
- DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame}
|
- CACHE_LOCATION=/app/cache
|
||||||
- ACCOUNT_SECRET=${ACCOUNT_MANAGER_SECRET:?missing_account_secret}
|
- CD_SQLITE_LOCATION=/app/cdclient
|
||||||
|
depends_on:
|
||||||
|
- darkflamedb
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 8000:8000
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:5000"]
|
test: ["CMD", "curl", "-f", "http://localhost:8000"]
|
||||||
interval: 2m
|
interval: 2m
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 40s
|
start_period: 40s
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
darkflame:
|
darkflame:
|
||||||
|
|
||||||
volumes:
|
|
||||||
database:
|
|
||||||
shared_configs:
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
FROM python:3.10-alpine3.14
|
|
||||||
|
|
||||||
WORKDIR /usr/local/share/AccountManager
|
|
||||||
|
|
||||||
COPY ./thirdparty/AccountManager .
|
|
||||||
|
|
||||||
ADD docker/credentials_example.py credentials.py
|
|
||||||
ADD docker/resources_example.py resources.py
|
|
||||||
|
|
||||||
RUN apk add curl libffi-dev build-base --no-cache && pip3 install -r requirements.txt
|
|
||||||
|
|
||||||
EXPOSE 5000
|
|
||||||
CMD python3 app.py
|
|
@ -1,58 +0,0 @@
|
|||||||
FROM gcc:12 as build
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \
|
|
||||||
echo "Install build dependencies" && \
|
|
||||||
apt update && \
|
|
||||||
apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \
|
|
||||||
apt install cmake zlib1g zlib1g-dev -yqq --no-install-recommends && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY dAuthServer/ /build/dAuthServer
|
|
||||||
COPY dChatServer/ /build/dChatServer
|
|
||||||
COPY dCommon/ /build/dCommon
|
|
||||||
COPY dChatFilter/ /build/dChatFilter
|
|
||||||
COPY dDatabase/ /build/dDatabase
|
|
||||||
COPY dGame/ /build/dGame
|
|
||||||
COPY dMasterServer/ /build/dMasterServer
|
|
||||||
COPY dNet/ /build/dNet
|
|
||||||
COPY dPhysics/ /build/dPhysics
|
|
||||||
COPY dScripts/ /build/dScripts
|
|
||||||
COPY dWorldServer/ /build/dWorldServer
|
|
||||||
COPY dZoneManager/ /build/dZoneManager
|
|
||||||
COPY dNavigation/ /build/dNavigation
|
|
||||||
COPY migrations/ /build/migrations
|
|
||||||
COPY resources/ /build/resources
|
|
||||||
COPY thirdparty/ /build/thirdparty
|
|
||||||
COPY vanity /build/vanity
|
|
||||||
COPY tests/ /build/tests
|
|
||||||
COPY .clang-* CMake* LICENSE /build/
|
|
||||||
|
|
||||||
ARG BUILD_THREADS=1
|
|
||||||
ARG BUILD_VERSION=171022
|
|
||||||
|
|
||||||
RUN echo "Build server"
|
|
||||||
RUN sed -i -e "s/MARIADB_CONNECTOR_COMPILE_JOBS=.*/MARIADB_CONNECTOR_COMPILE_JOBS=${BUILD_THREADS}/g" CMakeVariables.txt
|
|
||||||
RUN mkdir -p cmake_build
|
|
||||||
RUN cd cmake_build && \
|
|
||||||
cmake .. -DCMAKE_BUILD_RPATH_USE_ORIGIN=TRUE && \
|
|
||||||
make -j$BUILD_THREADS
|
|
||||||
|
|
||||||
FROM gcc:12 as runtime
|
|
||||||
|
|
||||||
RUN --mount=type=cache,id=runtime-apt-cache,target=/var/cache/apt \
|
|
||||||
apt update && \
|
|
||||||
apt install sudo -yqq --no-install-recommends && \
|
|
||||||
apt remove -y libmysqlcppconn7v5 libmysqlcppconn-dev && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --from=build /build/cmake_build /app
|
|
||||||
|
|
||||||
RUN mkdir -p /build/cmake_build && ln -s /app/_deps /build/cmake_build/_deps
|
|
||||||
|
|
||||||
COPY docker/start_server.sh /start_server.sh
|
|
||||||
|
|
||||||
CMD [ "/start_server.sh" ]
|
|
@ -1,7 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
FROM python:3.9.9-slim
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install curl -y
|
|
||||||
WORKDIR /empty_dir
|
|
||||||
EXPOSE 80
|
|
||||||
CMD python -m http.server 80
|
|
@ -1,4 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
DB_URL = f'mysql+pymysql://{os.environ["DATABASE_USER"]}:{os.environ["DATABASE_PASSWORD"]}@{os.environ["DATABASE_HOST"]}/{os.environ["DATABASE"]}'
|
|
||||||
SECRET_KEY = os.environ["ACCOUNT_SECRET"]
|
|
@ -1,3 +0,0 @@
|
|||||||
FROM mariadb:10.6
|
|
||||||
|
|
||||||
COPY ./migrations/dlu /docker-entrypoint-initdb.d
|
|
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 236 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 35 KiB |
@ -1,3 +0,0 @@
|
|||||||
LOGO = 'logo/logo.png'
|
|
||||||
PRIVACY_POLICY = 'policy/Privacy Policy.pdf'
|
|
||||||
TERMS_OF_USE = 'policy/Terms of Use.pdf'
|
|
@ -1,12 +0,0 @@
|
|||||||
FROM python:3.10-alpine3.14 as prep
|
|
||||||
|
|
||||||
RUN apk add bash --no-cache
|
|
||||||
|
|
||||||
WORKDIR /setup
|
|
||||||
|
|
||||||
# copy needed files from repo
|
|
||||||
COPY resources/ resources/
|
|
||||||
|
|
||||||
COPY docker/setup.sh /setup.sh
|
|
||||||
|
|
||||||
CMD [ "/setup.sh" ]
|
|
@ -1,41 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# fail on first error
|
|
||||||
set -e
|
|
||||||
|
|
||||||
function update_ini() {
|
|
||||||
FILE="/docker/configs/$1"
|
|
||||||
KEY=$2
|
|
||||||
NEW_VALUE=$3
|
|
||||||
sed -i "s~$2=.*~$2=$3~" $FILE
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_database_ini_values_for() {
|
|
||||||
INI_FILE=$1
|
|
||||||
|
|
||||||
update_ini $INI_FILE mysql_host $DATABASE_HOST
|
|
||||||
update_ini $INI_FILE mysql_database $DATABASE
|
|
||||||
update_ini $INI_FILE mysql_username $DATABASE_USER
|
|
||||||
update_ini $INI_FILE mysql_password $DATABASE_PASSWORD
|
|
||||||
update_ini $INI_FILE client_net_version $BUILD_VERSION
|
|
||||||
update_ini $INI_FILE external_ip $EXTERNAL_IP
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_ini_values() {
|
|
||||||
echo "Copying and updating config files"
|
|
||||||
|
|
||||||
mkdir -p /docker/configs
|
|
||||||
cp resources/masterconfig.ini /docker/configs/
|
|
||||||
cp resources/authconfig.ini /docker/configs/
|
|
||||||
cp resources/chatconfig.ini /docker/configs/
|
|
||||||
cp resources/worldconfig.ini /docker/configs/
|
|
||||||
cp resources/sharedconfig.ini /docker/configs/
|
|
||||||
|
|
||||||
# always use the internal docker hostname
|
|
||||||
update_ini masterconfig.ini master_ip "darkflame"
|
|
||||||
update_ini sharedconfig.ini client_location "/client"
|
|
||||||
|
|
||||||
update_database_ini_values_for sharedconfig.ini
|
|
||||||
}
|
|
||||||
|
|
||||||
update_ini_values
|
|
@ -1,25 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
function symlink_config_files() {
|
|
||||||
echo "Creating symlinks for config files"
|
|
||||||
rm /app/*.ini
|
|
||||||
ln -s /shared_configs/configs/authconfig.ini /app/authconfig.ini
|
|
||||||
ln -s /shared_configs/configs/chatconfig.ini /app/chatconfig.ini
|
|
||||||
ln -s /shared_configs/configs/masterconfig.ini /app/masterconfig.ini
|
|
||||||
ln -s /shared_configs/configs/worldconfig.ini /app/worldconfig.ini
|
|
||||||
ln -s /shared_configs/configs/sharedconfig.ini /app/sharedconfig.ini
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ ! -f "/app/initialized" ]]; then
|
|
||||||
# setup symlinks for volume files
|
|
||||||
symlink_config_files
|
|
||||||
# do not run symlinks more than once
|
|
||||||
touch /app/initialized
|
|
||||||
else
|
|
||||||
echo "Server already initialized"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# start the server
|
|
||||||
echo "Starting MasterServer"
|
|
||||||
./MasterServer
|
|
||||||
tail -f /dev/null
|
|
8
entrypoint.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mkdir -p /app/configs/
|
||||||
|
cp -n /app/default-configs/* /app/configs/
|
||||||
|
mkdir -p /app/vanity/
|
||||||
|
cp -n /app/default-vanity/* /app/vanity/
|
||||||
|
cd /app/ && ./MasterServer
|
@ -1,5 +1,5 @@
|
|||||||
# Port number. The client has the authserver port hardcoded to 1001
|
# Port number. The client has the authserver port hardcoded to 1001
|
||||||
port=1001
|
auth_server_port=1001
|
||||||
|
|
||||||
# 0 or 1, should ignore playkeys
|
# 0 or 1, should ignore playkeys
|
||||||
# If 1 everyone with an account will be able to login, regardless of if they have a key or not
|
# If 1 everyone with an account will be able to login, regardless of if they have a key or not
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# Port number
|
|
||||||
port=2005
|
|
||||||
|
|
||||||
# If you would like to increase the maximum number of best friends a player can have on the server
|
# If you would like to increase the maximum number of best friends a player can have on the server
|
||||||
# Change the value below to what you would like this to be (5 is live accurate)
|
# Change the value below to what you would like this to be (5 is live accurate)
|
||||||
max_number_of_best_friends=5
|
max_number_of_best_friends=5
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
master_ip=localhost
|
master_ip=localhost
|
||||||
|
|
||||||
# Port number
|
# Port number
|
||||||
port=2000
|
master_server_port=2000
|
||||||
|
|
||||||
# The port number to start world servers on. Will be incremented for each world
|
# The port number to start world servers on. Will be incremented for each world
|
||||||
world_port_start=3000
|
world_port_start=3000
|
||||||
|
@ -62,3 +62,7 @@ event_8=
|
|||||||
version_major=1
|
version_major=1
|
||||||
version_current=10
|
version_current=10
|
||||||
version_minor=64
|
version_minor=64
|
||||||
|
|
||||||
|
# The port the chat server is started and listening on
|
||||||
|
# Used in chat and world servers
|
||||||
|
chat_server_port=2005
|
@ -2,9 +2,6 @@
|
|||||||
# If you fork this repository and/or make changes to the code, reflect that here to comply with AGPLv3
|
# If you fork this repository and/or make changes to the code, reflect that here to comply with AGPLv3
|
||||||
source=https://github.com/DarkflameUniverse/DarkflameServer
|
source=https://github.com/DarkflameUniverse/DarkflameServer
|
||||||
|
|
||||||
# Port to the chat server, same as in chatconfig.ini
|
|
||||||
chat_server_port=2005
|
|
||||||
|
|
||||||
# 0 or 1, should disable chat
|
# 0 or 1, should disable chat
|
||||||
disable_chat=0
|
disable_chat=0
|
||||||
|
|
||||||
|
1
thirdparty/AccountManager
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 19e2a4fe9faba8ec2e40162e0019acd711967744
|
|