From 1018891f22b2a59305e656f983f407f9e3a6cb0f Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 4 May 2025 02:54:13 -0400 Subject: Initial commit --- .gitignore | 4 ++ compose.yml | 42 ++++++++++++++++++ config.sample.json | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++ server/Dockerfile | 8 ++++ server/start.sh | 15 +++++++ 5 files changed, 197 insertions(+) create mode 100644 .gitignore create mode 100644 compose.yml create mode 100644 config.sample.json create mode 100644 server/Dockerfile create mode 100755 server/start.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a565fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +config.json +server/FreeSOServer +game +nfs diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..e650915 --- /dev/null +++ b/compose.yml @@ -0,0 +1,42 @@ +services: + db: + image: mariadb:10.5 + volumes: + - db:/var/lib/mysql + restart: unless-stopped + environment: + MARIADB_USER: fsoserver + MARIADB_PASSWORD: password + MARIADB_DATABASE: fso + MARIADB_ROOT_PASSWORD: wordpass + ports: + - 3306:3306 + networks: + - freeso + + server: + image: freeso + volumes: + - ./config.json:/app/config.json + - ./game:/app/game + - ./nfs:/app/nfs + restart: unless-stopped + depends_on: + - db + ports: + - 35:35 + - 34:34 + - 9000:9000 + networks: + - freeso + + #bnbso-auth: + # image: bnbso-auth + # ports: + # - "127.0.0.1:3060:3000" + +volumes: + db: +networks: + freeso: + driver: bridge diff --git a/config.sample.json b/config.sample.json new file mode 100644 index 0000000..88d62d0 --- /dev/null +++ b/config.sample.json @@ -0,0 +1,128 @@ +{ + "gameLocation": "./game/", + "secret": "38F7E3B816EF9F31BFAB8F4C9716C90D106BD85E9D6913FBB4D833C866F837B0", + "simNFS": "./nfs", + + "database": { + "connectionString": "server=127.0.0.1;uid=fsoserver;pwd=password;database=fso;" + }, + + "services": { + "tasks": { + "enabled": true, + "call_sign": "callisto", + "binding": "0.0.0.0:35100", + "internal_host": "127.0.0.1:35", + "public_host": "127.0.0.1:35", + // "certificate": "auth.east.ea.com.pfx", + "schedule": [ + { + "cron": "0 3 * * *", + "task": "prune_database", + "timeout": 3600, + "parameter": {} + }, + { + "cron": "0 4 * * *", + "task": "bonus", + "timeout": 3600, + "shard_id": 1, + "parameter": {} + }, + { + "cron": "0 4 * * *", + "task": "job_balance", + "timeout": 3600, + "parameter": {} + }, + { + "cron": "0 9 * * *", + "task": "shutdown", + "timeout": 3600, + "parameter": {} + }, + { + "cron": "0 0 * * *", + "task": "neighborhood_tick", + "timeout": 3600, + "run_if_missed": true, + "parameter": {} + }, + { + "cron": "0 0 * * *", + "task": "birthday_gift", + "timeout": 3600, + "run_if_missed": true, + "parameter": {} + } + ], + "tuning": { + "bonus": { + "property_bonus": { + "per_unit": 10, + "overrides": { + "1": 1500, + "2": 1250, + "3": 1000 + } + }, + "visitor_bonus": { + "per_unit": 8 + } + }, + "birthdayGift": { + "items": [ + { + "age": 1000, + "guid": 1303919565, + "mail_subject": "1000 Days!", + "mail_message": "This is an example gift that shows how birthday gifts can be awarded by the server at different milestones - this one is for 1000 days. Please change this message. Or leave it the same, I don't mind.\n - Rhys", + "mail_sender_name": "FreeSO Developers" + } + ] + } + } + }, + "userApi": { + "enabled": true, + "bindings": [ + "http://+:9000/" + ], + // "cdnUrl": "http://0.0.0.0:9000", + "maintenance": false + }, + "cities": [ + { + "call_sign": "ganymede", + "id": 1, + "binding": "0.0.0.0:33100", + "internal_host": "127.0.0.1:33", + "public_host": "0.0.0.0:33", + // "certificate": "auth.east.ea.com.pfx", + "neighborhoods": { + "mayor_elegibility_limit": 4, + "mayor_elegibility_falloff": 4, + "min_nominations": 2, + "election_week_align": true, + "election_move_penalty": 14 + } + } + ], + "lots": [ + { + "call_sign": "europa", + "binding": "0.0.0.0:34100", + "internal_host": "127.0.0.1:34", + "public_host": "0.0.0.0:34", + // "certificate": "auth.east.ea.com.pfx", + "max_lots": 25, + "cities": [ + { + "id": 1, + "host": "127.0.0.1:33100" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..60eeb3a --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/dotnet/core/runtime:2.2 + +WORKDIR /app + +COPY ./start.sh . +COPY ./FreeSOServer/. . + +ENTRYPOINT ["/app/start.sh"] diff --git a/server/start.sh b/server/start.sh new file mode 100755 index 0000000..7748b11 --- /dev/null +++ b/server/start.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ ! -e "./db-initiated" ]; then + sleep 10 + echo "y" | dotnet exec FSO.Server.Core.dll db-init + touch db-initiated +else +#while [ $? -ne 2 ]; do + #mono watchdog.exe run --core + #dotnet exec FSO.Server.Core.dll run +#done +# dotnet exec watchdog.exe run --core + dotnet exec FSO.Server.Core.dll run + sleep 5 +fi -- cgit v1.2.3