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 WORKDIR /app
COPY . . COPY . .

View file

@ -2,5 +2,5 @@ FROM alpine:3.20
ARG MICROSERVICE ARG MICROSERVICE
WORKDIR /app 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"] 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 wicked-waifus-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 wicked-waifus-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 wicked-waifus-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 wicked-waifus-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-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 : 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 wicked-waifus-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 wicked-waifus-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 wicked-waifus-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 wicked-waifus-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-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 # 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: services:
camellya-config-server: wicked-waifus-config-server:
image: camellya-config-server:1.3.0-SNAPSHOT image: wicked-waifus-config-server:1.3.0-SNAPSHOT
depends_on: depends_on:
camellya-postgres: wicked-waifus-postgres:
condition: service_healthy condition: service_healthy
ports: ports:
- '10001:10001' - '10001:10001'
volumes: volumes:
- "./docker/configserver.toml:/app/configserver.toml" - "./docker/configserver.toml:/app/configserver.toml"
- "./assets/config:/app/assets/config" - "./assets/config:/app/assets/config"
camellya-login-server: wicked-waifus-login-server:
image: camellya-login-server:1.3.0-SNAPSHOT image: wicked-waifus-login-server:1.3.0-SNAPSHOT
depends_on: depends_on:
camellya-postgres: wicked-waifus-postgres:
condition: service_healthy condition: service_healthy
ports: ports:
- '5500:5500' - '5500:5500'
volumes: volumes:
- "./docker/loginserver.toml:/app/loginserver.toml" - "./docker/loginserver.toml:/app/loginserver.toml"
camellya-gateway-server: wicked-waifus-gateway-server:
image: camellya-gateway-server:1.3.0-SNAPSHOT image: wicked-waifus-gateway-server:1.3.0-SNAPSHOT
depends_on: depends_on:
camellya-postgres: wicked-waifus-postgres:
condition: service_healthy condition: service_healthy
ports: ports:
# Uncomment this if you want to have manual access # Uncomment this if you want to have manual access
@ -31,10 +31,10 @@ services:
- '7777:7777/udp' - '7777:7777/udp'
volumes: volumes:
- "./docker/gateway.toml:/app/gateway.toml" - "./docker/gateway.toml:/app/gateway.toml"
camellya-game-server: wicked-waifus-game-server:
image: camellya-game-server:1.3.0-SNAPSHOT image: wicked-waifus-game-server:1.3.0-SNAPSHOT
depends_on: depends_on:
camellya-postgres: wicked-waifus-postgres:
condition: service_healthy condition: service_healthy
# Uncomment this if you want to have manual access # Uncomment this if you want to have manual access
# ports: # ports:
@ -42,7 +42,7 @@ services:
volumes: volumes:
- "./docker/gameserver.toml:/app/gameserver.toml" - "./docker/gameserver.toml:/app/gameserver.toml"
- "./assets/logic:/app/assets/logic" - "./assets/logic:/app/assets/logic"
camellya-postgres: wicked-waifus-postgres:
image: postgres:16.4-alpine3.20 image: postgres:16.4-alpine3.20
user: postgres user: postgres
# Uncomment this if you want to have manual access # Uncomment this if you want to have manual access
@ -57,7 +57,7 @@ services:
- "POSTGRES_PASSWORD=toor" - "POSTGRES_PASSWORD=toor"
volumes: volumes:
- "./docker/postgres/scripts:/docker-entrypoint-initdb.d" - "./docker/postgres/scripts:/docker-entrypoint-initdb.d"
- camellya-postgres-vol:/var/lib/postgresql/data - wicked-waifus-postgres-vol:/var/lib/postgresql/data
volumes: volumes:
camellya-postgres-vol: wicked-waifus-postgres-vol:
external: true external: true

View file

@ -1,13 +1,13 @@
service_id = 2 service_id = 2
[database] [database]
host = "shorekeeper-postgres:5432" host = "wicked-waifus-postgres:5432"
user_name = "shorekeeper_user" user_name = "wicked_waifus_user"
password = "shorekeeper_pass" password = "wicked_waifus_pass"
db_name = "shorekeeper_db" db_name = "wicked_waifus_db"
[service_end_point] [service_end_point]
addr = "tcp://0.0.0.0:10004" addr = "tcp://0.0.0.0:10004"
[gateway_end_point] [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" addr = "tcp://0.0.0.0:10003"
[game_server_end_point] [game_server_end_point]
addr = "tcp://shorekeeper-game-server:10004" addr = "tcp://wicked-waifus-game-server:10004"
[database] [database]
host = "shorekeeper-postgres:5432" host = "wicked-waifus-postgres:5432"
user_name = "shorekeeper_user" user_name = "wicked_waifus_user"
password = "shorekeeper_pass" password = "wicked_waifus_pass"
db_name = "shorekeeper_db" db_name = "wicked_waifus_db"

View file

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

View file

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

View file

@ -1,2 +1,2 @@
\c camellya_db; \c wicked_waifus_db;
GRANT ALL ON SCHEMA public TO camellya_user; 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")); LazyLock::new(|| config_util::load_or_create("hotpatch.toml"));
::common::splash::print_splash(); ::common::splash::print_splash();
::common::logging::init(::tracing::Level::DEBUG); ::common::logging::init_axum(::tracing::Level::DEBUG);
Application::new() Application::new()
.get("/:env/client/:hash/:platform/config.json", get_config) .get("/:env/client/:hash/:platform/config.json", get_config)
.with_encryption(&CONFIG.encryption) .with_encryption(&CONFIG.encryption)
.with_logger()
.serve(&CONFIG.network) .serve(&CONFIG.network)
.await?; .await?;

View file

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