playbooks/roles/docker/XControl/templates/docker-compose.yaml

162 lines
4.0 KiB
YAML

services:
db:
image: "{{ xcontrol_db_image }}"
container_name: xcontrol-db
restart: unless-stopped
environment:
POSTGRES_DB: "{{ xcontrol_db_name }}"
POSTGRES_USER: "{{ xcontrol_db_user }}"
POSTGRES_PASSWORD: "{{ xcontrol_db_password }}"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U {{ xcontrol_db_user }}"]
interval: 5s
timeout: 60s
retries: 10
start_period: 5s
volumes:
- "data:/var/lib/postgresql/data:rw"
networks:
- db
account:
image: "{{ xcontrol_account_image }}"
container_name: account
restart: unless-stopped
environment:
PORT: 8080
CONFIG_PATH: /etc/xcontrol/account-compose.yaml
volumes:
- "{{ xcontrol_workspace }}/config/account.yaml:/etc/xcontrol/account-compose.yaml:ro"
depends_on:
db:
condition: service_healthy
ports:
- "8080:8080"
networks:
- app
- db
rag-server:
image: "{{ xcontrol_rag_image }}"
container_name: rag-server
restart: unless-stopped
environment:
PORT: 8090
CONFIG_PATH: /etc/rag-server/server-compose.yaml
volumes:
- "{{ xcontrol_workspace }}/config/server.yaml:/etc/rag-server/server-compose.yaml:ro"
depends_on:
db:
condition: service_healthy
ports:
- "8090:8090"
networks:
- app
- db
dashboard-blue:
image: "{{ xcontrol_dashboard_blue_image }}"
container_name: dashboard-blue
restart: unless-stopped
environment:
PORT: 3000
depends_on:
account:
condition: service_started
rag-server:
condition: service_started
networks:
- app
dashboard-green:
image: "{{ xcontrol_dashboard_green_image }}"
container_name: dashboard-green
restart: unless-stopped
environment:
PORT: 3000
depends_on:
account:
condition: service_started
rag-server:
condition: service_started
networks:
- app
proxy-external-tls:
image: openresty/openresty:alpine
container_name: proxy-external-tls
restart: unless-stopped
volumes:
- "{{ xcontrol_workspace }}/nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
- "{{ xcontrol_workspace }}/nginx/conf.d:/usr/local/openresty/nginx/conf/conf.d:ro"
- "{{ xcontrol_workspace }}/certbot/conf:/etc/letsencrypt"
- "{{ xcontrol_workspace }}/certbot/www:/var/www/certbot"
ports:
- "80:80"
- "443:443"
networks:
- app
depends_on:
account:
condition: service_started
rag-server:
condition: service_started
dashboard-blue:
condition: service_started
dashboard-green:
condition: service_started
redis:
image: redis:7-alpine
container_name: redis
restart: unless-stopped
command: ["redis-server", "--save", "", "--appendonly", "no"]
networks:
- app
bootstrap-nginx:
profiles: ["bootstrap"]
image: nginx:mainline-alpine
container_name: bootstrap-nginx
volumes:
- "{{ xcontrol_workspace }}/certbot/www:/var/www/certbot"
- "{{ xcontrol_workspace }}/certbot/conf:/etc/letsencrypt"
- "{{ xcontrol_workspace }}/nginx/nginx.conf:/etc/nginx/nginx.conf"
- "{{ xcontrol_workspace }}/nginx/conf.d/bootstrap-nginx.conf:/etc/nginx/conf.d/default.conf"
ports:
- "80:80"
networks:
- app
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost"]
interval: 3s
timeout: 2s
retries: 10
start_period: 3s
certbot:
profiles: ["bootstrap"]
image: certbot/certbot
container_name: certbot
command: >
certonly --webroot
--webroot-path=/var/www/certbot
--email {{ xcontrol_certbot_email }}
--agree-tos
--no-eff-email
--keep-until-expiring
--non-interactive
-d {{ xcontrol_certbot_domains }}
volumes:
- "{{ xcontrol_workspace }}/certbot/conf:/etc/letsencrypt"
- "{{ xcontrol_workspace }}/certbot/www:/var/www/certbot"
networks:
- app
networks:
app:
db:
volumes:
data: