lsd/docker-compose.yml

107 lines
3.0 KiB
YAML

x-common: &common # Configs used by more than one service.
image: lsd_service
pull_policy: never
env_file: .env # Automatically generated by MariaDB service entrypoint.
entrypoint: ["/entrypoint.sh"] # Copies the MariaDB env vars into corresponding LSB settings.
environment:
XI_NETWORK_HTTP_HOST: 0.0.0.0
XI_NETWORK_ZMQ_IP: world
XI_NETWORK_SQL_HOST: database
volumes: # YAML merge can't be used with sequences, so bind everything here. (SEE NOTE ABOUT WSL IN README!)
- ./.git:/.git # Since LSB is a submodule, we want to preserve
- ./server/.git:/server/.git # the directory structure inside the container.
- ./server/log:/server/log
- ./server/losmeshes:/server/losmeshes
- ./server/modules:/server/modules
- ./server/navmeshes:/server/navmeshes
- ./server/res:/server/res
- ./server/scripts:/server/scripts
- ./server/settings:/server/settings
- ./server/sql:/server/sql
- ./server/tools:/server/tools
services:
database:
image: mariadb
entrypoint: ["/mariadb-entrypoint.sh"]
restart: always
volumes:
- ./.env:/env/.env
- ./mariadb-entrypoint.sh:/mariadb-entrypoint.sh # Custom entrypoint to generate .env.
- ./server/sql:/docker-entrypoint-initdb.d # Initializes the database.
- database:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 3m # First time initialization takes a while, so give it extra time.
interval: 15s # TODO: use dbtool setup, set lower healthcheck.
timeout: 5s
retries: 4
dbtool:
<<: *common # Import common configs.
build: . # This service builds the image shared by all LSB services.
command: ["python3", "/server/tools/dbtool.py", "update"]
restart: no
depends_on:
database:
condition: service_healthy
connect:
<<: *common
command: ["/server/xi_connect"]
restart: unless-stopped
ports:
- "54001:54001"
- "54230:54230"
- "54231:54231"
depends_on:
database:
condition: service_healthy
restart: true
dbtool:
condition: service_completed_successfully
search:
<<: *common
command: ["/server/xi_search"]
restart: unless-stopped
ports:
- "54002:54002"
depends_on:
database:
condition: service_healthy
restart: true
dbtool:
condition: service_completed_successfully
world:
<<: *common
command: ["/server/xi_world"]
restart: unless-stopped
ports:
- "8088:8088"
depends_on:
database:
condition: service_healthy
restart: true
dbtool:
condition: service_completed_successfully
map:
<<: *common
command: ["/server/xi_map"]
restart: unless-stopped
ports:
- "54230:54230/udp"
depends_on:
database:
condition: service_healthy
restart: true
dbtool:
condition: service_completed_successfully
world:
condition: service_started
volumes:
database: