Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,11 @@ src/AdminPanel/wwwroot/content/js/app.js.map
# Keys which are generated when the server runs locally.
data-protection-keys/

# Local environment files with secrets (see deploy/*/.env.example).
# Templates (*.env.example) stay committable, real values never are.
.env
.env.*
!.env.example

# The archive of the network observation, when the server is started from the repository.
captures/
25 changes: 25 additions & 0 deletions deploy/all-in-one-traefik/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
DOMAIN=domain.com

# Copy to .env and adjust. Defaults preserve the previous behavior (postgres / admin).
# Host name of the postgres database as seen by the app containers.
DB_HOST=database

# User name of the postgres admin account.
# Must match the user of an already-initialized database volume.
DB_ADMIN_USER=postgres

# Password of the postgres admin account. Also used as POSTGRES_PASSWORD
# for the database container on first initialization.
# IMPORTANT: POSTGRES_PASSWORD is only applied when the dbdata volume is
# created. Changing it later does NOT change an existing database.
# Change the password inside postgres first (ALTER ROLE ...),
# then restart with the new value here.
# Must match the password of an already-initialized database volume.
DB_ADMIN_PW=admin

# Name of the postgres database (default openmu).
DB_NAME=openmu

# Optional bootstrap admin panel user (see docker docs).
OPENMU_ADMIN_USER=
OPENMU_ADMIN_PASSWORD=
OPENMU_ADMIN_TOTP_SECRET=
10 changes: 6 additions & 4 deletions deploy/all-in-one-traefik/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ services:
- "44405:44405"
- "55980:55980"
environment:
DB_HOST: database
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
working_dir: /app/
depends_on:
- database
Expand All @@ -28,9 +30,9 @@ services:
image: postgres
container_name: database
environment:
POSTGRES_PASSWORD: admin
POSTGRES_DB: openmu
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_ADMIN_PW:-admin}
POSTGRES_DB: ${DB_NAME:-openmu}
POSTGRES_USER: ${DB_ADMIN_USER:-postgres}
networks:
- proxy
ports:
Expand Down
10 changes: 6 additions & 4 deletions deploy/all-in-one-traefik/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ services:
- "44405:44405"
- "55980:55980"
environment:
DB_HOST: database
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
# Optional bootstrap admin panel user. Without it, the admin panel is reachable
# without a login until the first user has been created within the panel itself.
OPENMU_ADMIN_USER: ${OPENMU_ADMIN_USER:-}
Expand All @@ -37,9 +39,9 @@ services:
image: postgres
container_name: database
environment:
POSTGRES_PASSWORD: admin
POSTGRES_DB: openmu
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_ADMIN_PW:-admin}
POSTGRES_DB: ${DB_NAME:-openmu}
POSTGRES_USER: ${DB_ADMIN_USER:-postgres}
networks:
- proxy
ports:
Expand Down
28 changes: 28 additions & 0 deletions deploy/all-in-one/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copy this file to .env and adjust the values.
# If .env is absent, the defaults below (after ':-') apply and
# the setup behaves exactly as before (postgres / admin).

# Host name of the postgres database as seen by the app containers.
DB_HOST=database

# User name of the postgres admin account.
# Must match the user of an already-initialized database volume.
DB_ADMIN_USER=postgres

# Password of the postgres admin account. Also used as POSTGRES_PASSWORD
# for the database container on first initialization.
# IMPORTANT: POSTGRES_PASSWORD is only applied when the dbdata volume is
# created. Changing it later does NOT change an existing database.
# Change the password inside postgres first (ALTER ROLE ...),
# then restart with the new value here.
# Must match the password of an already-initialized database volume.
DB_ADMIN_PW=admin

# Name of the postgres database. Must match Database= in
# src/Persistence/EntityFramework/ConnectionSettings.xml (openmu).
DB_NAME=openmu

# Optional bootstrap admin panel user (see docker docs).
OPENMU_ADMIN_USER=
OPENMU_ADMIN_PASSWORD=
OPENMU_ADMIN_TOTP_SECRET=
10 changes: 6 additions & 4 deletions deploy/all-in-one/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ services:
- "44406:44406"
- "55980:55980"
environment:
DB_HOST: database
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
ASPNETCORE_URLS: http://+:8080
# Optional bootstrap admin panel user. Without it, the admin panel is reachable
# without a login until the first user has been created within the panel itself.
Expand All @@ -43,9 +45,9 @@ services:
image: postgres
container_name: database
environment:
POSTGRES_PASSWORD: admin
POSTGRES_DB: openmu
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_ADMIN_PW:-admin}
POSTGRES_DB: ${DB_NAME:-openmu}
POSTGRES_USER: ${DB_ADMIN_USER:-postgres}
ports:
- "5432"
volumes:
Expand Down
28 changes: 28 additions & 0 deletions deploy/distributed/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copy this file to .env and adjust the values.
# If .env is absent, the defaults below (after ':-') apply and
# the setup behaves exactly as before (postgres / admin).

# Host name of the postgres database as seen by the app containers.
DB_HOST=database

# User name of the postgres admin account.
# Must match the user of an already-initialized database volume.
DB_ADMIN_USER=postgres

# Password of the postgres admin account. Also used as POSTGRES_PASSWORD
# for the database container on first initialization, and applied to the
# Dapr secret store connection strings at runtime.
# IMPORTANT: POSTGRES_PASSWORD is only applied when the dbdata volume is
# created. Changing it later does NOT change an existing database.
# Change the password inside postgres first (ALTER ROLE ...),
# then restart with the new value here.
# Must match the password of an already-initialized database volume.
DB_ADMIN_PW=admin

# Name of the postgres database (default openmu).
DB_NAME=openmu

# Optional bootstrap admin panel user (see docker docs).
OPENMU_ADMIN_USER=
OPENMU_ADMIN_PASSWORD=
OPENMU_ADMIN_TOTP_SECRET=
1 change: 1 addition & 0 deletions deploy/distributed/dapr-components/secrets.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"_comment": "Defaults; DB_HOST/DB_ADMIN_USER/DB_ADMIN_PW env vars of the app containers override Server/User Id/Password at runtime. Default password 'admin' keeps working when unset.",
"connectionStrings": {
"MUnique.OpenMU.Persistence.EntityFramework.EntityDataContext": "Server=database;Port=5432;User Id=postgres;Password=admin;Database=openmu;Command Timeout=120;",
"MUnique.OpenMU.Persistence.EntityFramework.TypedContext": "Server=database;Port=5432;User Id=postgres;Password=admin;Database=openmu;Command Timeout=120;",
Expand Down
30 changes: 27 additions & 3 deletions deploy/distributed/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ services:
container_name: postgres
restart: always
environment:
POSTGRES_PASSWORD: admin
POSTGRES_DB: openmu
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_ADMIN_PW:-admin}
POSTGRES_DB: ${DB_NAME:-openmu}
POSTGRES_USER: ${DB_ADMIN_USER:-postgres}
ports:
- "5432"
volumes:
Expand All @@ -123,6 +123,9 @@ services:
environment:
APPID: connectServer
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
depends_on:
- rabbit
- zipkin
Expand All @@ -149,6 +152,9 @@ services:
- "9464" # Prometheus
environment:
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
depends_on:
- zipkin
- database
Expand All @@ -174,6 +180,9 @@ services:
- "9464" # Prometheus
environment:
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
depends_on:
- chatServer-dapr
- database
Expand All @@ -200,6 +209,9 @@ services:
- "9464" # Prometheus
environment:
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
depends_on:
- database
- zipkin
Expand All @@ -223,6 +235,9 @@ services:
environment:
APPID: chatServer
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
ports:
- "55980:55980"
- "50001"
Expand Down Expand Up @@ -256,6 +271,9 @@ services:
environment:
ASPNETCORE_URLS: http://+:8080
PATH_BASE: /admin/
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
# Optional bootstrap admin panel user. Without it, the admin panel is reachable
# without a login until the first user has been created within the panel itself.
OPENMU_ADMIN_USER: ${OPENMU_ADMIN_USER:-}
Expand Down Expand Up @@ -297,6 +315,9 @@ services:
APPID: gameServer0
PATH_BASE: /gameServer/0/
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
depends_on:
- connectServer-dapr
- loginServer-dapr
Expand Down Expand Up @@ -336,6 +357,9 @@ services:
APPID: gameServer1
PATH_BASE: /gameServer/1/
ASPNETCORE_URLS: http://+:8080
DB_HOST: ${DB_HOST:-database}
DB_ADMIN_USER: ${DB_ADMIN_USER:-}
DB_ADMIN_PW: ${DB_ADMIN_PW:-}
depends_on:
- connectServer-dapr
- loginServer-dapr
Expand Down
4 changes: 2 additions & 2 deletions docs-website/docs/deployment/startup-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ These may be helpful when running the server in a container or under Linux.
| `ASPNETCORE_ENVIRONMENT` | If neither a `-resolveIP` parameter nor a `RESOLVE_IP` variable is defined, this variable is considered to find the optimal IP resolver. If the value is `Development`, `loopback` is used, otherwise `public`. |
| `ASPNETCORE_URLS` | Defines the address of the admin panel, e.g. `http://+:80` |
| `DB_HOST` | Host name/address of the postgres database |
| `DB_ADMIN_USER` | User name of the admin user of the postgres database |
| `DB_ADMIN_PW` | Password of the admin user of the postgres database |
| `DB_ADMIN_USER` | User name of the admin user of the postgres database. In docker compose this is also used as `POSTGRES_USER` for the database container (`${DB_ADMIN_USER:-postgres}`). |
| `DB_ADMIN_PW` | Password of the admin user of the postgres database. In docker compose this is also used as `POSTGRES_PASSWORD` for the database container (`${DB_ADMIN_PW:-admin}`). When unset, the default `admin` keeps working. |
| `Database__AssumeExternallyProvisioned` | When `true`, an already-provisioned (empty) database is kept and only its schema is built via migrations, instead of dropping and recreating it. Default: `false`. See below. |

## Externally provisioned database
Expand Down
19 changes: 19 additions & 0 deletions docs-website/docs/getting-started/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,24 @@ environment variables:
| `DB_ADMIN_USER` | The user name of the postgres admin account. If the local configuration file is still configured to use `postgres` for the user name of the admin (first entry in the `ConnectionSettings.xml`), the value of this variable replaces it. |
| `DB_ADMIN_PW` | The password of the postgres admin account. If the local configuration file is still configured to use `admin` for the password of the admin (first entry in the `ConnectionSettings.xml`), the value of this variable replaces it. |

The `docker-compose.yml` files take these variables (e.g. from a local `.env`
file, see `deploy/*/.env.example`) and wire them to both sides:

* the `database` service as `POSTGRES_PASSWORD: ${DB_ADMIN_PW:-admin}` and
`POSTGRES_USER: ${DB_ADMIN_USER:-postgres}`,
* the app container(s) as `DB_ADMIN_USER` / `DB_ADMIN_PW` (and
`DB_HOST: ${DB_HOST:-database}`).

When the variables are not set, the defaults (`postgres` / `admin`) apply, so
existing installations keep working without any change. The same override
applies to the distributed deployment, where the Dapr secret store connection
strings are adjusted at runtime with the same variables.

Note: `POSTGRES_PASSWORD` is only honored by the official postgres image when
the `dbdata` volume is created for the first time. Changing `DB_ADMIN_PW`
later does not change an existing database. Change the password inside
postgres first (e.g. `ALTER ROLE postgres PASSWORD 'new'`), then restart the
containers with the new value.

More variables and the start parameters are listed under
[Startup parameters and environment variables](../deployment/startup-parameters.md).
Loading
Loading