From be69d00e2c7a533ccb8e651dd3ecef62f2bb5c04 Mon Sep 17 00:00:00 2001 From: xavo95 Date: Sun, 3 Nov 2024 00:21:51 +0100 Subject: [PATCH] Update docker --- Dockerfile-builder | 2 +- Dockerfile-service | 2 +- builder.bat | 16 +++++++-------- builder.sh | 16 +++++++-------- docker-compose.yml | 32 ++++++++++++++--------------- docker/gameserver.toml | 10 ++++----- docker/gateway.toml | 10 ++++----- docker/loginserver.toml | 8 ++++---- docker/postgres/scripts/0_INIT.sql | 6 +++--- docker/postgres/scripts/1_PERMS.sql | 4 ++-- hotpatch-server/src/main.rs | 3 ++- login-server/src/main.rs | 12 ++++++----- 12 files changed, 62 insertions(+), 59 deletions(-) diff --git a/Dockerfile-builder b/Dockerfile-builder index 485dff5..2e5b4bd 100644 --- a/Dockerfile-builder +++ b/Dockerfile-builder @@ -1,4 +1,4 @@ -FROM rust:1.81-alpine3.20 +FROM rust:1.82-alpine3.20 WORKDIR /app COPY . . diff --git a/Dockerfile-service b/Dockerfile-service index 54f3cef..794f7b7 100644 --- a/Dockerfile-service +++ b/Dockerfile-service @@ -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"] \ No newline at end of file diff --git a/builder.bat b/builder.bat index 89cb292..3c29524 100644 --- a/builder.bat +++ b/builder.bat @@ -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 \ No newline at end of file +: docker volume create wicked-waifus-postgres-vol \ No newline at end of file diff --git a/builder.sh b/builder.sh index 34acc84..b667dfa 100644 --- a/builder.sh +++ b/builder.sh @@ -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 \ No newline at end of file +# docker volume create wicked-waifus-postgres-vol \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c3f4d42..7f4842b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 \ No newline at end of file diff --git a/docker/gameserver.toml b/docker/gameserver.toml index 1e8300d..e1cd045 100644 --- a/docker/gameserver.toml +++ b/docker/gameserver.toml @@ -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" diff --git a/docker/gateway.toml b/docker/gateway.toml index 83c75e3..ca2af53 100644 --- a/docker/gateway.toml +++ b/docker/gateway.toml @@ -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" diff --git a/docker/loginserver.toml b/docker/loginserver.toml index d07c8c5..0687cf3 100644 --- a/docker/loginserver.toml +++ b/docker/loginserver.toml @@ -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" \ No newline at end of file diff --git a/docker/postgres/scripts/0_INIT.sql b/docker/postgres/scripts/0_INIT.sql index c463001..43abb31 100644 --- a/docker/postgres/scripts/0_INIT.sql +++ b/docker/postgres/scripts/0_INIT.sql @@ -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; \ No newline at end of file +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; \ No newline at end of file diff --git a/docker/postgres/scripts/1_PERMS.sql b/docker/postgres/scripts/1_PERMS.sql index a403ee5..f0906af 100644 --- a/docker/postgres/scripts/1_PERMS.sql +++ b/docker/postgres/scripts/1_PERMS.sql @@ -1,2 +1,2 @@ -\c camellya_db; -GRANT ALL ON SCHEMA public TO camellya_user; \ No newline at end of file +\c wicked_waifus_db; +GRANT ALL ON SCHEMA public TO wicked_waifus_user; \ No newline at end of file diff --git a/hotpatch-server/src/main.rs b/hotpatch-server/src/main.rs index 5a08a21..9fb94a5 100644 --- a/hotpatch-server/src/main.rs +++ b/hotpatch-server/src/main.rs @@ -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?; diff --git a/login-server/src/main.rs b/login-server/src/main.rs index 51576f1..ec2de8b 100644 --- a/login-server/src/main.rs +++ b/login-server/src/main.rs @@ -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(()) }