Update docker

This commit is contained in:
xavo95 2024-11-03 00:21:51 +01:00
parent 44e7ec1527
commit be69d00e2c
Signed by: xavo95
GPG key ID: CBF8ADED6DEBB783
12 changed files with 62 additions and 59 deletions

View file

@ -1,4 +1,4 @@
FROM rust:1.81-alpine3.20
FROM rust:1.82-alpine3.20
WORKDIR /app
COPY . .

View file

@ -2,5 +2,5 @@ FROM alpine:3.20
ARG MICROSERVICE
WORKDIR /app
COPY --from=camellya-builder:1.3.0-SNAPSHOT /app/target/release/$MICROSERVICE ./service
COPY --from=wicked-waifus-builder:1.3.0-SNAPSHOT /app/target/release/$MICROSERVICE ./service
CMD ["./service"]

View file

@ -1,12 +1,12 @@
docker build -t camellya-builder:1.3.0-SNAPSHOT -f Dockerfile-builder .
docker build -t wicked-waifus-builder:1.3.0-SNAPSHOT -f Dockerfile-builder .
docker build -t camellya-config-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=config-server -f Dockerfile-service .
docker build -t camellya-hotpatch-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=hotpatch-server -f Dockerfile-service .
docker build -t camellya-login-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=login-server -f Dockerfile-service .
docker build -t camellya-gateway-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=gateway-server -f Dockerfile-service .
docker build -t camellya-game-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=game-server -f Dockerfile-service .
docker build -t wicked-waifus-config-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=config-server -f Dockerfile-service .
docker build -t wicked-waifus-hotpatch-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=hotpatch-server -f Dockerfile-service .
docker build -t wicked-waifus-login-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=login-server -f Dockerfile-service .
docker build -t wicked-waifus-gateway-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=gateway-server -f Dockerfile-service .
docker build -t wicked-waifus-game-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=game-server -f Dockerfile-service .
docker rmi camellya-builder:1.3.0-SNAPSHOT
docker rmi wicked-waifus-builder:1.3.0-SNAPSHOT
: Persistence for the application
docker volume create camellya-postgres-vol
: docker volume create wicked-waifus-postgres-vol

View file

@ -1,12 +1,12 @@
docker build -t camellya-builder:1.3.0-SNAPSHOT -f Dockerfile-builder .
docker build -t wicked-waifus-builder:1.3.0-SNAPSHOT -f Dockerfile-builder .
docker build -t camellya-config-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=config-server -f Dockerfile-service .
docker build -t camellya-hotpatch-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=hotpatch-server -f Dockerfile-service .
docker build -t camellya-login-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=login-server -f Dockerfile-service .
docker build -t camellya-gateway-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=gateway-server -f Dockerfile-service .
docker build -t camellya-game-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=game-server -f Dockerfile-service .
docker build -t wicked-waifus-config-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=config-server -f Dockerfile-service .
docker build -t wicked-waifus-hotpatch-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=hotpatch-server -f Dockerfile-service .
docker build -t wicked-waifus-login-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=login-server -f Dockerfile-service .
docker build -t wicked-waifus-gateway-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=gateway-server -f Dockerfile-service .
docker build -t wicked-waifus-game-server:1.3.0-SNAPSHOT --build-arg MICROSERVICE=game-server -f Dockerfile-service .
docker rmi camellya-builder:1.3.0-SNAPSHOT
docker rmi wicked-waifus-builder:1.3.0-SNAPSHOT
# Persistence for the application
docker volume create camellya-postgres-vol
# docker volume create wicked-waifus-postgres-vol

View file

@ -1,29 +1,29 @@
name: camellya-ps
name: wicked-waifus-ps
services:
camellya-config-server:
image: camellya-config-server:1.3.0-SNAPSHOT
wicked-waifus-config-server:
image: wicked-waifus-config-server:1.3.0-SNAPSHOT
depends_on:
camellya-postgres:
wicked-waifus-postgres:
condition: service_healthy
ports:
- '10001:10001'
volumes:
- "./docker/configserver.toml:/app/configserver.toml"
- "./assets/config:/app/assets/config"
camellya-login-server:
image: camellya-login-server:1.3.0-SNAPSHOT
wicked-waifus-login-server:
image: wicked-waifus-login-server:1.3.0-SNAPSHOT
depends_on:
camellya-postgres:
wicked-waifus-postgres:
condition: service_healthy
ports:
- '5500:5500'
volumes:
- "./docker/loginserver.toml:/app/loginserver.toml"
camellya-gateway-server:
image: camellya-gateway-server:1.3.0-SNAPSHOT
wicked-waifus-gateway-server:
image: wicked-waifus-gateway-server:1.3.0-SNAPSHOT
depends_on:
camellya-postgres:
wicked-waifus-postgres:
condition: service_healthy
ports:
# Uncomment this if you want to have manual access
@ -31,10 +31,10 @@ services:
- '7777:7777/udp'
volumes:
- "./docker/gateway.toml:/app/gateway.toml"
camellya-game-server:
image: camellya-game-server:1.3.0-SNAPSHOT
wicked-waifus-game-server:
image: wicked-waifus-game-server:1.3.0-SNAPSHOT
depends_on:
camellya-postgres:
wicked-waifus-postgres:
condition: service_healthy
# Uncomment this if you want to have manual access
# ports:
@ -42,7 +42,7 @@ services:
volumes:
- "./docker/gameserver.toml:/app/gameserver.toml"
- "./assets/logic:/app/assets/logic"
camellya-postgres:
wicked-waifus-postgres:
image: postgres:16.4-alpine3.20
user: postgres
# Uncomment this if you want to have manual access
@ -57,7 +57,7 @@ services:
- "POSTGRES_PASSWORD=toor"
volumes:
- "./docker/postgres/scripts:/docker-entrypoint-initdb.d"
- camellya-postgres-vol:/var/lib/postgresql/data
- wicked-waifus-postgres-vol:/var/lib/postgresql/data
volumes:
camellya-postgres-vol:
wicked-waifus-postgres-vol:
external: true

View file

@ -1,13 +1,13 @@
service_id = 2
[database]
host = "shorekeeper-postgres:5432"
user_name = "shorekeeper_user"
password = "shorekeeper_pass"
db_name = "shorekeeper_db"
host = "wicked-waifus-postgres:5432"
user_name = "wicked_waifus_user"
password = "wicked_waifus_pass"
db_name = "wicked_waifus_db"
[service_end_point]
addr = "tcp://0.0.0.0:10004"
[gateway_end_point]
addr = "tcp://shorekeeper-gateway-server:10003"
addr = "tcp://wicked-waifus-gateway-server:10003"

View file

@ -11,10 +11,10 @@ use_client_key = true
addr = "tcp://0.0.0.0:10003"
[game_server_end_point]
addr = "tcp://shorekeeper-game-server:10004"
addr = "tcp://wicked-waifus-game-server:10004"
[database]
host = "shorekeeper-postgres:5432"
user_name = "shorekeeper_user"
password = "shorekeeper_pass"
db_name = "shorekeeper_db"
host = "wicked-waifus-postgres:5432"
user_name = "wicked_waifus_user"
password = "wicked_waifus_pass"
db_name = "wicked_waifus_db"

View file

@ -6,7 +6,7 @@ host = "host.docker.internal"
port = 7777
[database]
host = "shorekeeper-postgres:5432"
user_name = "shorekeeper_user"
password = "shorekeeper_pass"
db_name = "shorekeeper_db"
host = "wicked-waifus-postgres:5432"
user_name = "wicked_waifus_user"
password = "wicked_waifus_pass"
db_name = "wicked_waifus_db"

View file

@ -1,3 +1,3 @@
CREATE DATABASE camellya_db;
CREATE USER camellya_user WITH encrypted password 'camellya_pass';
GRANT ALL PRIVILEGES ON DATABASE camellya_db to camellya_user;
CREATE DATABASE wicked_waifus_db;
CREATE USER wicked_waifus_user WITH encrypted password 'wicked_waifus_pass';
GRANT ALL PRIVILEGES ON DATABASE wicked_waifus_db to wicked_waifus_user;

View file

@ -1,2 +1,2 @@
\c camellya_db;
GRANT ALL ON SCHEMA public TO camellya_user;
\c wicked_waifus_db;
GRANT ALL ON SCHEMA public TO wicked_waifus_user;

View file

@ -26,11 +26,12 @@ async fn main() -> Result<()> {
LazyLock::new(|| config_util::load_or_create("hotpatch.toml"));
::common::splash::print_splash();
::common::logging::init(::tracing::Level::DEBUG);
::common::logging::init_axum(::tracing::Level::DEBUG);
Application::new()
.get("/:env/client/:hash/:platform/config.json", get_config)
.with_encryption(&CONFIG.encryption)
.with_logger()
.serve(&CONFIG.network)
.await?;

View file

@ -1,6 +1,7 @@
use std::{process, sync::LazyLock};
use anyhow::Result;
use config::{GatewayConfig, ServerConfig};
use shorekeeper_database::PgPool;
use shorekeeper_http::{Application, StatusCode};
@ -21,7 +22,7 @@ async fn main() -> Result<()> {
LazyLock::new(|| ::common::config_util::load_or_create("loginserver.toml"));
::common::splash::print_splash();
::common::logging::init(::tracing::Level::DEBUG);
::common::logging::init_axum(::tracing::Level::DEBUG);
let Ok(pool) = shorekeeper_database::connect_to(&CONFIG.database).await else {
tracing::error!(
@ -37,10 +38,11 @@ async fn main() -> Result<()> {
pool,
gateway: &CONFIG.gateway,
})
.get("/health", || async { StatusCode::OK })
.get("/api/login", handler::handle_login_api_call)
.serve(&CONFIG.network)
.await?;
.get("/health", || async { StatusCode::OK })
.get("/api/login", handler::handle_login_api_call)
.with_logger()
.serve(&CONFIG.network)
.await?;
Ok(())
}