docker-test #1
14 changed files with 199 additions and 1 deletions
12
.dockerignore
Normal file
12
.dockerignore
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
.git
|
||||||
|
assets
|
||||||
|
postgres
|
||||||
|
**/target
|
||||||
|
.gitignore
|
||||||
|
docker-compose.yml
|
||||||
|
Dockerfile-builder
|
||||||
|
Dockerfile-service
|
||||||
|
LICENSE
|
||||||
|
*.md
|
||||||
|
*.zip
|
||||||
|
*.png
|
6
Dockerfile-builder
Normal file
6
Dockerfile-builder
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FROM rust:1.81-alpine3.20
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
# No need to manually strip symbols(strip target/release/$MICROSERVICE) since workspace its already prepared for that
|
||||||
|
RUN apk add musl-dev protoc && cargo build --release
|
6
Dockerfile-service
Normal file
6
Dockerfile-service
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FROM alpine:3.20 as release
|
||||||
|
ARG MICROSERVICE
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=shorekeeper-builder:1.3.0-SNAPSHOT /app/target/release/$MICROSERVICE ./service
|
||||||
|
CMD ["./service"]
|
17
README.md
17
README.md
|
@ -24,7 +24,22 @@ cargo run --bin gateway-server
|
||||||
cargo run --bin game-server
|
cargo run --bin game-server
|
||||||
```
|
```
|
||||||
|
|
||||||
##### b) using pre-built binaries
|
##### b) building from sources(docker edition)
|
||||||
|
If you are to wheelchair'd for option A, you can fallback to option b.
|
||||||
|
In this case you will need [Docker Desktop](https://www.docker.com/products/docker-desktop/)
|
||||||
|
|
||||||
|
Once installed, to build the images, run:
|
||||||
|
```sh
|
||||||
|
# or builder.bat if you run it on windows
|
||||||
|
./builder.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
And to run the containers:
|
||||||
|
```sh
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
##### c) using pre-built binaries
|
||||||
Navigate to the [Releases](https://git.xeondev.com/Shorekeeper/Shorekeeper/releases)
|
Navigate to the [Releases](https://git.xeondev.com/Shorekeeper/Shorekeeper/releases)
|
||||||
page and download the latest release for your platform.<br>
|
page and download the latest release for your platform.<br>
|
||||||
Launch all servers: `config-server`, `hotpatch-server`, `login-server`, `gateway-server`, `game-server`
|
Launch all servers: `config-server`, `hotpatch-server`, `login-server`, `gateway-server`, `game-server`
|
||||||
|
|
12
builder.bat
Normal file
12
builder.bat
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
docker build -t shorekeeper-builder:1.3.0-SNAPSHOT -f Dockerfile-builder .
|
||||||
|
|
||||||
|
docker build -t shorekeeper-config-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=config-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-hotpatch-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=hotpatch-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-login-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=login-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-gateway-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=gateway-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-game-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=game-server -f Dockerfile-service .
|
||||||
|
|
||||||
|
docker rmi shorekeeper-builder:1.3.0-SNAPSHOT
|
||||||
|
|
||||||
|
: Persistence for the application
|
||||||
|
docker volume create shorekeeper-postgres-vol
|
12
builder.sh
Normal file
12
builder.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
docker build -t shorekeeper-builder:1.3.0-SNAPSHOT -f Dockerfile-builder .
|
||||||
|
|
||||||
|
docker build -t shorekeeper-config-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=config-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-hotpatch-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=hotpatch-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-login-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=login-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-gateway-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=gateway-server -f Dockerfile-service .
|
||||||
|
docker build -t shorekeeper-game-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=game-server -f Dockerfile-service .
|
||||||
|
|
||||||
|
docker rmi shorekeeper-builder:1.3.0-SNAPSHOT
|
||||||
|
|
||||||
|
# Persistence for the application
|
||||||
|
docker volume create shorekeeper-postgres-vol
|
73
docker-compose.yml
Normal file
73
docker-compose.yml
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
name: shorekeeper-ps
|
||||||
|
|
||||||
|
services:
|
||||||
|
shorekeeper-config-server:
|
||||||
|
image: shorekeeper-config-server:1.3.0-SNAPSHOT
|
||||||
|
depends_on:
|
||||||
|
shorekeeper-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- '10001:10001'
|
||||||
|
volumes:
|
||||||
|
- "./docker/configserver.toml:/app/configserver.toml"
|
||||||
|
- "./assets/config:/app/assets/config"
|
||||||
|
shorekeeper-hotpatch-server:
|
||||||
|
image: shorekeeper-hotpatch-server:1.3.0-SNAPSHOT
|
||||||
|
depends_on:
|
||||||
|
shorekeeper-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- '10002:10002'
|
||||||
|
volumes:
|
||||||
|
- "./docker/hotpatch.toml:/app/hotpatch.toml"
|
||||||
|
- "./assets/hotpatch:/app/assets/hotpatch"
|
||||||
|
shorekeeper-login-server:
|
||||||
|
image: shorekeeper-login-server:1.3.0-SNAPSHOT
|
||||||
|
depends_on:
|
||||||
|
shorekeeper-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- '5500:5500'
|
||||||
|
volumes:
|
||||||
|
- "./docker/loginserver.toml:/app/loginserver.toml"
|
||||||
|
shorekeeper-gateway-server:
|
||||||
|
image: shorekeeper-gateway-server:1.3.0-SNAPSHOT
|
||||||
|
depends_on:
|
||||||
|
shorekeeper-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
# Uncomment this if you want to have manual access
|
||||||
|
# - '10003:10003'
|
||||||
|
- '7777:7777/udp'
|
||||||
|
volumes:
|
||||||
|
- "./docker/gateway.toml:/app/gateway.toml"
|
||||||
|
shorekeeper-game-server:
|
||||||
|
image: shorekeeper-game-server:1.3.0-SNAPSHOT
|
||||||
|
depends_on:
|
||||||
|
shorekeeper-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
# Uncomment this if you want to have manual access
|
||||||
|
# ports:
|
||||||
|
# - '10004:10004'
|
||||||
|
volumes:
|
||||||
|
- "./docker/gameserver.toml:/app/gameserver.toml"
|
||||||
|
- "./assets/logic:/app/assets/logic"
|
||||||
|
shorekeeper-postgres:
|
||||||
|
image: postgres:16.4-alpine3.20
|
||||||
|
user: postgres
|
||||||
|
# Uncomment this if you want to have manual access
|
||||||
|
# ports:
|
||||||
|
# - '5432:5432'
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
environment:
|
||||||
|
- "POSTGRES_PASSWORD=toor"
|
||||||
|
volumes:
|
||||||
|
- "./docker/postgres/scripts:/docker-entrypoint-initdb.d"
|
||||||
|
- shorekeeper-postgres-vol:/var/lib/postgresql/data
|
||||||
|
volumes:
|
||||||
|
shorekeeper-postgres-vol:
|
||||||
|
external: true
|
6
docker/configserver.toml
Normal file
6
docker/configserver.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[network]
|
||||||
|
http_addr = "0.0.0.0:10001"
|
||||||
|
|
||||||
|
[encryption]
|
||||||
|
key = "t+AEu5SGdpz06tomonajLMau9AJgmyTvVhz9VtGf1+0="
|
||||||
|
iv = "fprc5lBWADQB7tim0R2JxQ=="
|
13
docker/gameserver.toml
Normal file
13
docker/gameserver.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
service_id = 2
|
||||||
|
|
||||||
|
[database]
|
||||||
|
host = "shorekeeper-postgres:5432"
|
||||||
|
user_name = "shorekeeper_user"
|
||||||
|
password = "shorekeeper_pass"
|
||||||
|
db_name = "shorekeeper_db"
|
||||||
|
|
||||||
|
[service_end_point]
|
||||||
|
addr = "tcp://0.0.0.0:10004"
|
||||||
|
|
||||||
|
[gateway_end_point]
|
||||||
|
addr = "tcp://shorekeeper-gateway-server:10003"
|
20
docker/gateway.toml
Normal file
20
docker/gateway.toml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
service_id = 1
|
||||||
|
|
||||||
|
[network]
|
||||||
|
kcp_port = 7777
|
||||||
|
|
||||||
|
[protokey]
|
||||||
|
builtin_encryption_msg_id = [111, 112]
|
||||||
|
use_client_key = true
|
||||||
|
|
||||||
|
[service_end_point]
|
||||||
|
addr = "tcp://0.0.0.0:10003"
|
||||||
|
|
||||||
|
[game_server_end_point]
|
||||||
|
addr = "tcp://shorekeeper-game-server:10004"
|
||||||
|
|
||||||
|
[database]
|
||||||
|
host = "shorekeeper-postgres:5432"
|
||||||
|
user_name = "shorekeeper_user"
|
||||||
|
password = "shorekeeper_pass"
|
||||||
|
db_name = "shorekeeper_db"
|
6
docker/hotpatch.toml
Normal file
6
docker/hotpatch.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[network]
|
||||||
|
http_addr = "0.0.0.0:10002"
|
||||||
|
|
||||||
|
[encryption]
|
||||||
|
key = "t+AEu5SGdpz06tomonajLMau9AJgmyTvVhz9VtGf1+0="
|
||||||
|
iv = "fprc5lBWADQB7tim0R2JxQ=="
|
12
docker/loginserver.toml
Normal file
12
docker/loginserver.toml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[network]
|
||||||
|
http_addr = "0.0.0.0:5500"
|
||||||
|
|
||||||
|
[gateway]
|
||||||
|
host = "host.docker.internal"
|
||||||
|
port = 7777
|
||||||
|
|
||||||
|
[database]
|
||||||
|
host = "shorekeeper-postgres:5432"
|
||||||
|
user_name = "shorekeeper_user"
|
||||||
|
password = "shorekeeper_pass"
|
||||||
|
db_name = "shorekeeper_db"
|
3
docker/postgres/scripts/0_INIT.sql
Normal file
3
docker/postgres/scripts/0_INIT.sql
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
CREATE DATABASE shorekeeper_db;
|
||||||
|
CREATE USER shorekeeper_user WITH encrypted password 'shorekeeper_pass';
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE shorekeeper_db to shorekeeper_user;
|
2
docker/postgres/scripts/1_PERMS.sql
Normal file
2
docker/postgres/scripts/1_PERMS.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
\c shorekeeper_db;
|
||||||
|
GRANT ALL ON SCHEMA public TO shorekeeper_user;
|
Loading…
Reference in a new issue