diff --git a/.dockerignore b/.dockerignore index 7da6456c..37ff8f51 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,8 +3,8 @@ Dockerfile *.md logo.png versions.txt -build.sh docker-compose.yml .env docker/__pycache__ -.env.example \ No newline at end of file +.env.example +build diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml new file mode 100644 index 00000000..8f9b3720 --- /dev/null +++ b/.github/workflows/build-and-push-docker.yml @@ -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 }} diff --git a/.gitmodules b/.gitmodules index 700e7536..4ba6a43b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,9 +14,6 @@ path = thirdparty/mariadb-connector-cpp url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git ignore = dirty -[submodule "thirdparty/AccountManager"] - path = thirdparty/AccountManager - url = https://github.com/DarkflameUniverse/AccountManager [submodule "thirdparty/magic_enum"] path = thirdparty/magic_enum url = https://github.com/Neargye/magic_enum.git diff --git a/Docker.md b/Docker.md deleted file mode 100644 index b06bd0fe..00000000 --- a/Docker.md +++ /dev/null @@ -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://: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` diff --git a/Docker_Windows.md b/Docker_Windows.md deleted file mode 100644 index 984bbe57..00000000 --- a/Docker_Windows.md +++ /dev/null @@ -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$\\...` 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) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d58a68c6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM gcc:13 as build + +WORKDIR /app + +RUN set -ex; \ + apt-get update; \ + apt-get install -y cmake + +COPY . /app/ + +RUN sed -i 's/MARIADB_CONNECTOR_COMPILE_JOBS__=.*/MARIADB_CONNECTOR_COMPILE_JOBS__=2/' /app/CMakeVariables.txt + +RUN chmod +x build.sh +RUN ./build.sh + +FROM debian:12 as runtime + +WORKDIR /app + +COPY --from=build /app/build/*Server /app/ +COPY --from=build /app/build/*.ini /app/default-configs/ +COPY --from=build /app/build/*.so /usr/lib/ +COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/*.so /usr/lib/ +COPY --from=build /app/build/mariadbcpp/src/mariadb_connector_cpp-build/mariadbcpp/plugin/*.so /usr/lib/ +COPY --from=build /app/build/vanity /app/default-vanity +COPY --from=build /app/build/navmeshes /app/navmeshes +COPY --from=build /app/build/migrations /app/migrations +COPY --from=build /app/build/*.dcf /app/ +COPY ./entrypoint.sh /app/ +RUN ldconfig +# needed as the container runs with the root user +# and therefore sudo doesn't exist +ENV USE_SUDO_AUTH=0 +RUN chmod +x entrypoint.sh +CMD [ "/app/entrypoint.sh" ] diff --git a/README.md b/README.md index f647aaa5..0ce27fa9 100644 --- a/README.md +++ b/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) * [Running the server](#running-the-server) * [User Guide](#user-guide) +* [Docker](#docker) ## Clone the repository If you are on Windows, you will need to download and install git from [here](https://git-scm.com/download/win) @@ -347,6 +348,43 @@ certutil -hashfile SHA1 Known good *SHA1* checksum of the Darkflame Universe client: - `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed) +# Docker + +## Standalone + +For standalone deployment, you can use the image provided via Github's Container Repository: +`ghcr.io/darkflameuniverse/darkfameserver` + +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 DLU_CONFIG_DIR=/app/configs \ + -e DUMP_FOLDER=/app/dumps \ + -p 1001:1001/udp \ + -p 2005:2005/udp \ + -p 3000-3300:3000-3300/udp \ +ghcr.io/darkflameuniverse/darkfameserver: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 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) diff --git a/docker-compose.yml b/docker-compose.yml index d8c3c40a..fe8b3923 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,104 +1,66 @@ version: "3" services: - setup: - container_name: DarkflameSetup - 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 + darkflamedb: + image: mariadb:latest environment: - MARIADB_USER=${MARIADB_USER:-darkflame} - MARIADB_PASSWORD=${MARIADB_PASSWORD:-darkflame} - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-darkflame} - MARIADB_DATABASE=${MARIADB_DATABASE:-darkflame} - volumes: - - database:/var/lib/mysql networks: - darkflame - # You can expose these so that DB management tools can connect (WARNING: INSECURE) - # ports: - # - 3306:3306 - darkflame: - container_name: DarkflameServer + darkfameserver: networks: - darkflame - build: - context: . - dockerfile: ./docker/Dockerfile - args: - - BUILD_THREADS=${BUILD_THREADS:-1} - - BUILD_VERSION=${BUILD_VERSION:-171022} + image: ghcr.io/darkflameuniverse/darkfameserver:latest volumes: - - ${CLIENT_PATH:?missing_client_path}:/client:ro - - shared_configs:/shared_configs:ro + - $HOST_CONFIG_DIR:/app/configs/ + - $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: - - database + - darkflamedb ports: - "1001:1001/udp" - - "2000:2000/udp" - "2005:2005/udp" - "3000-3300:3000-3300/udp" - brickbuildfix: - container_name: DarkflameBrickBuildFix + darkflameweb: networks: - darkflame - build: - context: . - dockerfile: ./docker/brickfix.Dockerfile - ports: - - 80:80 - 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 + image: ghcr.io/darkflameuniverse/nexusdashboard:latest + volumes: + - $HOST_CLIENT_LOCATION:/app/luclient:ro + - $HOST_CACHE_LOCATION:/app/cache + - $HOST_CD_SQLITE_LOCATION:/app/cdclient:ro environment: - - DATABASE=${MARIADB_DATABASE:-darkflame} - - DATABASE_HOST=database - - DATABASE_USER=${MARIADB_USER:-darkflame} - - DATABASE_PASSWORD=${MARIADB_PASSWORD:-darkflame} - - ACCOUNT_SECRET=${ACCOUNT_MANAGER_SECRET:?missing_account_secret} + - APP_SECRET_KEY=$APP_SECRET_KEY + - APP_DATABASE_URI=mysql+pymysql://${MARIADB_USER:-darkflame}:${MARIADB_PASSWORD:-darkflame}@darkflamedb:3306/${MARIADB_DATABASE:-darkflame} + - CLIENT_LOCATION=/app/luclient + - CACHE_LOCATION=/app/cache + - CD_SQLITE_LOCATION=/app/cdclient + depends_on: + - darkflamedb ports: - - 5000:5000 + - 8000:8000 healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:5000"] + test: ["CMD", "curl", "-f", "http://localhost:8000"] interval: 2m timeout: 3s retries: 3 start_period: 40s - depends_on: - - database networks: darkflame: - -volumes: - database: - shared_configs: diff --git a/docker/AccountManager.Dockerfile b/docker/AccountManager.Dockerfile deleted file mode 100644 index 60226339..00000000 --- a/docker/AccountManager.Dockerfile +++ /dev/null @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index fd211291..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -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" ] diff --git a/docker/brickfix.Dockerfile b/docker/brickfix.Dockerfile deleted file mode 100644 index 3323cd65..00000000 --- a/docker/brickfix.Dockerfile +++ /dev/null @@ -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 diff --git a/docker/credentials_example.py b/docker/credentials_example.py deleted file mode 100644 index 2112fbed..00000000 --- a/docker/credentials_example.py +++ /dev/null @@ -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"] diff --git a/docker/database.Dockerfile b/docker/database.Dockerfile deleted file mode 100644 index 68261e44..00000000 --- a/docker/database.Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM mariadb:10.6 - -COPY ./migrations/dlu /docker-entrypoint-initdb.d \ No newline at end of file diff --git a/docker/images/Account_Creation.png b/docker/images/Account_Creation.png deleted file mode 100755 index 1b8135dd..00000000 Binary files a/docker/images/Account_Creation.png and /dev/null differ diff --git a/docker/images/DD_General_Settings.png b/docker/images/DD_General_Settings.png deleted file mode 100755 index d0e694aa..00000000 Binary files a/docker/images/DD_General_Settings.png and /dev/null differ diff --git a/docker/images/DD_Server_Startstop.png b/docker/images/DD_Server_Startstop.png deleted file mode 100755 index 8f482bb7..00000000 Binary files a/docker/images/DD_Server_Startstop.png and /dev/null differ diff --git a/docker/images/Docker_Compose_Finished.png b/docker/images/Docker_Compose_Finished.png deleted file mode 100755 index 549915ee..00000000 Binary files a/docker/images/Docker_Compose_Finished.png and /dev/null differ diff --git a/docker/images/Docker_Desktop_Installer_Configuration.png b/docker/images/Docker_Desktop_Installer_Configuration.png deleted file mode 100755 index d8c07eaa..00000000 Binary files a/docker/images/Docker_Desktop_Installer_Configuration.png and /dev/null differ diff --git a/docker/images/Docker_Download_Page.png b/docker/images/Docker_Download_Page.png deleted file mode 100755 index 4c478a66..00000000 Binary files a/docker/images/Docker_Download_Page.png and /dev/null differ diff --git a/docker/images/Open_Powershell.png b/docker/images/Open_Powershell.png deleted file mode 100755 index 861e609d..00000000 Binary files a/docker/images/Open_Powershell.png and /dev/null differ diff --git a/docker/images/WSL_2_download.png b/docker/images/WSL_2_download.png deleted file mode 100755 index e9be9a31..00000000 Binary files a/docker/images/WSL_2_download.png and /dev/null differ diff --git a/docker/images/setup_finished.png b/docker/images/setup_finished.png deleted file mode 100755 index 6278ac6b..00000000 Binary files a/docker/images/setup_finished.png and /dev/null differ diff --git a/docker/resources_example.py b/docker/resources_example.py deleted file mode 100644 index 652281f5..00000000 --- a/docker/resources_example.py +++ /dev/null @@ -1,3 +0,0 @@ -LOGO = 'logo/logo.png' -PRIVACY_POLICY = 'policy/Privacy Policy.pdf' -TERMS_OF_USE = 'policy/Terms of Use.pdf' diff --git a/docker/setup.Dockerfile b/docker/setup.Dockerfile deleted file mode 100644 index 18bb2d06..00000000 --- a/docker/setup.Dockerfile +++ /dev/null @@ -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" ] diff --git a/docker/setup.sh b/docker/setup.sh deleted file mode 100755 index 1944bbba..00000000 --- a/docker/setup.sh +++ /dev/null @@ -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 diff --git a/docker/start_server.sh b/docker/start_server.sh deleted file mode 100755 index 2e2e8c28..00000000 --- a/docker/start_server.sh +++ /dev/null @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..fab0d786 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +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 diff --git a/thirdparty/AccountManager b/thirdparty/AccountManager deleted file mode 160000 index 19e2a4fe..00000000 --- a/thirdparty/AccountManager +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 19e2a4fe9faba8ec2e40162e0019acd711967744