azerothcore-wotlk2/docker-compose.yml
Yehonal 380f406248
Feat(Docker/bash): docker-compose system rework (#4488)
## ⚠️ATTENTION! ⚠️ Upgrading procedure:

**Database:** After this PR will be merged you need to backup your DB first (you can use the db-assembler or any mysql client to generate the dump) and restore it after.  The reason is that we use now docker named volumes instead of binded ones to improve performance.

**Conf & client data**: if you use the default configuration, both the etc and the data folder are now available inside the **/env/docker**. 

Finally, you can cleanup the /docker folder previously used by our system.

## Changes Proposed:

This PR will implement the [devcontainer ](https://code.visualstudio.com/docs/remote/containers) feature for VSCode. Allowing us to develop and debug directly within the container in the same way on all OSes.

* Implemented support for vscode dev-container feature by remote-extension suite
* Docker performance optimizations for MacOS and non-linux hosts
* Bash system improvements
* Implemented first command using Deno runtime environment (typescript) and [commander.js]
* Implemented wait mechanism for db_assembler
* Implemented db migration command
* possibility to run the authserver and worldserver with GDB using the integrated simple-restarter
* Implemented docker multi-stage mechanism to use one single Dockerfile for all the services
* client-data downloader now creates a placeholder to avoid downloading the same version of data files multiple times
* deployment of pre-compiled docker images on [docker hub](https://hub.docker.com/u/acore), you can test them [here](https://github.com/azerothcore/acore-docker)
2021-04-22 09:57:05 +02:00

148 lines
3.9 KiB
YAML

version: '3.9'
# extension field: https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields
x-networks: &networks
networks:
- ac-network
x-ac-shared-conf: &ac-shared-conf
<<: *networks
working_dir: /azerothcore
depends_on:
ac-database:
condition: service_healthy
services:
#============================
#
# Abstract services to extend
#
#============================
abstract-bind:
image: local/azerothcore/abstract-bind
volumes:
- .:/azerothcore/
# env dir shared between services
# we cannot use /env/dist to avoid permission issues
- ac-env:/azerothcore/env
# expose some dist folder outside allowing the host to use them
- ${DOCKER_CONF:-./conf}:/azerothcore/conf
- ${DOCKER_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- ${DOCKER_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated
- ${DOCKER_DATA:-./env/docker/data}:/azerothcore/env/dist/data:delegated
profiles: [abstract-service] # do not run this
abstract-no-bind:
image: local/azerothcore/abstract-no-bind
volumes:
- ac-proj:/azerothcore/
profiles: [abstract-service] # do not run this
#=======================
#
# Applications
#
#=======================
ac-database:
<<: *networks
image: mysql:8.0
restart: unless-stopped
cap_add:
- SYS_NICE # CAP_SYS_NICE
ports:
- ${DOCKER_DB_EXTERNAL_PORT:-3306}:3306
environment:
- MYSQL_ROOT_PASSWORD=${DOCKER_DB_ROOT_PASSWORD:-password}
volumes:
- type: volume
source: ac-database
target: /var/lib/mysql
healthcheck:
test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\""
interval: 2s
timeout: 20s
retries: 10
ac-worldserver:
<<: *ac-shared-conf
extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
stdin_open: true
tty: true
command: ./acore.sh run-worldserver
image: acore/worldserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
privileged: true
build:
context: .
target: ${DOCKER_BUILD_WORLD_TARGET:-dev}
dockerfile: ./apps/docker/Dockerfile
ports:
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
profiles: [all, app, worldserver]
ac-authserver:
<<: *ac-shared-conf
extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
tty: true
command: ./acore.sh run-authserver
image: acore/authserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
build:
context: .
target: ${DOCKER_BUILD_AUTH_TARGET:-dev}
dockerfile: ./apps/docker/Dockerfile
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
profiles: [all, app, authserver]
#======================
#
# Dev services
#
#======================
ac-dev-server:
<<: *ac-shared-conf
tty: true
image: acore/dev-server:${DOCKER_IMAGE_TAG:-master}
security_opt:
- seccomp:unconfined
build:
context: .
target: dev
dockerfile: ./apps/docker/Dockerfile
args:
USER_ID: ${DOCKER_USER_ID:-1000}
GROUP_ID: ${DOCKER_GROUP_ID:-1000}
extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
environment:
DBLIST: AUTH,CHARACTERS,WORLD
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
volumes:
- ac-build:/azerothcore/var/build
profiles: [all, dev]
volumes:
ac-database:
ac-env:
ac-build:
ac-proj:
networks:
ac-network: