From 8637ca26980ee80bac4d4f7207311dfea813589b Mon Sep 17 00:00:00 2001 From: Mick Vermeulen Date: Sat, 12 Sep 2020 13:16:40 +0200 Subject: [PATCH] Initial setup --- .env.sample | 11 ++++++++ .gitignore | 3 +++ .gitmodules | 3 +++ README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++ Uchu | 1 + Uchu.Dockerfile | 8 ++++++ config.xml | 48 +++++++++++++++++++++++++++++++++++ docker-compose.yaml | 37 +++++++++++++++++++++++++++ 8 files changed, 172 insertions(+) create mode 100644 .env.sample create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 README.md create mode 160000 Uchu create mode 100644 Uchu.Dockerfile create mode 100644 config.xml create mode 100644 docker-compose.yaml diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..d266fd4 --- /dev/null +++ b/.env.sample @@ -0,0 +1,11 @@ +# Configuration file for Uchu Docker +DATABASE_PORT=5432 +REDIS_PORT=6379 +ADMINER_PORT=8080 +DATA_FOLDER=./data +GAME_FOLDER=/res + +# Postgres specific setup +POSTGRES_USER=uchu +POSTGRES_PASSWORD=uchu +POSTGRES_DB=uchu \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd02649 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +data +.env +.DS_Store \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..62eceb2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Uchu"] + path = Uchu + url = git@github.com:yuwui/Uchu.git diff --git a/README.md b/README.md new file mode 100644 index 0000000..9827c55 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# Uchu Docker + +Docker setup for running the Uchu Lego Universe server + +## Requirements + +- Docker +- Docker Compose +- [LU unpacked client](https://docs.google.com/document/d/1XmHXWuUQqzUIOcv6SVVjaNBm4bFg9lnW4Pk1pllimEg/edit) with [LCDRs TcpUdp mod](https://github.com/lcdr/raknet_shim_dll/releases/tag/2020-09-03) + +## Setup + +Clone the repository recursively, so that the Uchu source is also pulled: + +```bash +# If you prefer to use HTTPS (default) +git clone https://github.com/yuwui/Uchu --recursive -b master + +# If you prefer to use SSH +git clone git@github.com:yuwui/Uchu.git --recursive -b master +``` + +Copy the `.env.sample` file to `.env`: + +```bash +cp .env.sample .env +``` + +Set the `GAME_FOLDER` variable in the `.env` file to path to the `/res` folder in your unpacked `LU` game folder. + +Next, create the `data` folder that's used to store the Postgres and Redis database files to ensure no loss of data: + +```bash +mkdir data +``` + +Deleting this folder will result in your Postgres database being wiped, including all the progress you've made in-game, be cautious when handling this folder! + +## Running + +```bash +docker-compose up -d +``` + +This runs Uchu in the background along with Postgres, Redis and Adminer. You can attach to the `Uchu.Master` shell using: + +```bash +docker attach uchudocker_uchu_1 +``` + +This allows you to input shell commands like `/adduser `. You can exit the shell using `Ctrl+C`. + +## Closing + +```bash +docker-compose down +``` + +## Adminer + +Uchu Docker also automatically runs [Adminer](https://www.adminer.org), which allows you to easily modify the Uchu database in a user friendly way. After running Uchu Docker you can access Adminer through your browser at [this link](0.0.0.0:8080). Select the `PostgreSQL` database type, set the server to `db` and enter the credentials found in the `.env` file to login. More info on how to use Adminer can be found on their website. \ No newline at end of file diff --git a/Uchu b/Uchu new file mode 160000 index 0000000..837e20b --- /dev/null +++ b/Uchu @@ -0,0 +1 @@ +Subproject commit 837e20b6562ef79b18aabab376e77c23d22b9dbc diff --git a/Uchu.Dockerfile b/Uchu.Dockerfile new file mode 100644 index 0000000..0c4033a --- /dev/null +++ b/Uchu.Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine +ENV PATH $PATH:/root/.dotnet/tools + +COPY Uchu . +COPY config.xml . + +RUN dotnet build +ENTRYPOINT ["dotnet", "Uchu.Master/bin/Debug/netcoreapp3.1/Uchu.Master.dll"] \ No newline at end of file diff --git a/config.xml b/config.xml new file mode 100644 index 0000000..601206e --- /dev/null +++ b/config.xml @@ -0,0 +1,48 @@ + + + + postgres + uchu + db + uchu + uchu + + + Debug + false + + + None + uchu.log + false + + + dotnet + ./Uchu.Instance/bin/Debug/netcoreapp3.1/Uchu.Instance.dll + ./Uchu.StandardScripts/bin/Debug/netcoreapp3.1/Uchu.StandardScripts.dll + + + + /res + + + + + 2002 + true + true + 100 + + + false + false + + + http + localhost + 10000 + + + + + \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..bc4c292 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,37 @@ +version: "3.8" +services: + db: + image: postgres:12.2-alpine + env_file: + - .env + restart: always + ports: ["${DATABASE_PORT}:5432"] + volumes: + - ${DATA_FOLDER}:/var/lib/postgresql/data + adminer: + image: adminer + restart: always + depends_on: + - db + ports: ["${ADMINER_PORT}:8080"] + redis: + image: redis:6.0.8-alpine + env_file: + - .env + restart: always + ports: ["${REDIS_PORT}:6379"] + volumes: + - ${DATA_FOLDER}:/data + uchu: + build: + context: . + dockerfile: Uchu.Dockerfile + depends_on: + - db + - redis + env_file: + - .env + volumes: + - ${GAME_FOLDER}:/res + tty: true + stdin_open: true