Skip to content

Commit

Permalink
Initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mick Vermeulen authored and Mick Vermeulen committed Sep 12, 2020
0 parents commit 8637ca2
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data
.env
.DS_Store
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Uchu"]
path = Uchu
url = [email protected]:yuwui/Uchu.git
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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 <username>`. 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.
1 change: 1 addition & 0 deletions Uchu
Submodule Uchu added at 837e20
8 changes: 8 additions & 0 deletions Uchu.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
48 changes: 48 additions & 0 deletions config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Uchu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Database>
<Provider>postgres</Provider>
<Database>uchu</Database>
<Host>db</Host>
<Username>uchu</Username>
<Password>uchu</Password>
</Database>
<ConsoleLogging>
<Level>Debug</Level>
<Timestamp>false</Timestamp>
</ConsoleLogging>
<FileLogging>
<Level>None</Level>
<File>uchu.log</File>
<Timestamp>false</Timestamp>
</FileLogging>
<DllSource>
<DotNetPath>dotnet</DotNetPath>
<Instance>./Uchu.Instance/bin/Debug/netcoreapp3.1/Uchu.Instance.dll</Instance>
<ScriptDllSource>./Uchu.StandardScripts/bin/Debug/netcoreapp3.1/Uchu.StandardScripts.dll</ScriptDllSource>
</DllSource>
<ManagedScriptSources />
<ResourcesConfiguration>
<GameResourceFolder>/res</GameResourceFolder>
</ResourcesConfiguration>
<Networking>
<Certificate />
<Hostname />
<CharacterPort>2002</CharacterPort>
<HostAuthentication>true</HostAuthentication>
<HostCharacter>true</HostCharacter>
<MaxWorldServers>100</MaxWorldServers>
</Networking>
<GamePlay>
<PathFinding>false</PathFinding>
<AiWander>false</AiWander>
</GamePlay>
<Api>
<Protocol>http</Protocol>
<Domain>localhost</Domain>
<Port>10000</Port>
</Api>
<Sso>
<Domain />
</Sso>
</Uchu>
37 changes: 37 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8637ca2

Please sign in to comment.