125 lines
2.9 KiB
YAML
125 lines
2.9 KiB
YAML
services:
|
|
|
|
nginx:
|
|
image: nginx:latest
|
|
container_name: wkvs-nginx
|
|
ports:
|
|
- "127.0.0.1:8080:80"
|
|
- "127.0.0.1:8082:8082"
|
|
volumes:
|
|
- .:/var/wkvs
|
|
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
depends_on:
|
|
- apache
|
|
- node
|
|
networks:
|
|
- wkvs
|
|
|
|
env-init:
|
|
build: ./config/apache
|
|
container_name: wkvs-env-init
|
|
volumes:
|
|
- .:/var/wkvs
|
|
working_dir: /var/wkvs
|
|
command: php setup/init-env.php
|
|
|
|
composer-init:
|
|
image: composer:latest
|
|
container_name: wkvs-composer-init
|
|
volumes:
|
|
- .:/app
|
|
working_dir: /app/composer
|
|
command: composer install --no-interaction --prefer-dist
|
|
depends_on:
|
|
env-init:
|
|
condition: service_completed_successfully
|
|
|
|
apache:
|
|
build: ./config/apache
|
|
container_name: wkvs-apache
|
|
volumes:
|
|
- .:/var/wkvs
|
|
- ./config/apache/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
|
|
depends_on:
|
|
db-init:
|
|
condition: service_completed_successfully
|
|
composer-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- wkvs
|
|
|
|
mariadb:
|
|
image: mariadb:latest
|
|
container_name: wkvs-mariadb
|
|
restart: unless-stopped
|
|
env_file:
|
|
- path: ./config/.env.db
|
|
required: false
|
|
volumes:
|
|
- db_data:/var/lib/mysql
|
|
healthcheck:
|
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
depends_on:
|
|
env-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- wkvs
|
|
|
|
db-init:
|
|
build: ./config/apache
|
|
container_name: wkvs-db-init
|
|
volumes:
|
|
- .:/var/wkvs
|
|
working_dir: /var/wkvs
|
|
depends_on:
|
|
mariadb:
|
|
condition: service_healthy
|
|
env-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- wkvs
|
|
command: php setup/database/init-db.php
|
|
|
|
redis:
|
|
image: redis:7
|
|
container_name: wkvs-redis
|
|
restart: unless-stopped
|
|
env_file:
|
|
- path: ./config/.env.redis
|
|
required: false
|
|
command: ["sh", "-c", "exec redis-server --requirepass \"$REDDIS_PASSWORD\""]
|
|
depends_on:
|
|
env-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- wkvs
|
|
|
|
node:
|
|
image: node:latest
|
|
container_name: wkvs-node
|
|
restart: unless-stopped
|
|
volumes:
|
|
- .:/var/wkvs
|
|
working_dir: /var/wkvs/websocket
|
|
env_file:
|
|
- path: ./config/.env.redis
|
|
required: false
|
|
environment:
|
|
- REDDIS_HOST=redis
|
|
command: sh -c "npm install && npm install -g pm2 && pm2-runtime start index.js --max-memory-restart 1G --node-args=\"--max-old-space-size=1024\" --name=\"WebSocket WKVS\""
|
|
depends_on:
|
|
redis:
|
|
condition: service_started
|
|
env-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- wkvs
|
|
|
|
volumes:
|
|
db_data:
|
|
|
|
networks:
|
|
wkvs: |