feat: implement x-common-env for shared environment variables

This commit is contained in:
2026-04-03 16:03:24 -05:00
parent 94811398fe
commit ca2156f5a7

View File

@@ -1,31 +1,46 @@
x-common-env: &common-env
NALIIA: ${NALIIA:-gitea.onecluster.org/oneteam/naliia:1.0.0_pro}
EMAIL: ${EMAIL:-admin@admin.org}
POSTGRES_HOST: ${POSTGRES_HOST:-db}
POSTGRES_DB: ${POSTGRES_DB:-naliia}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-SUp3r-pass*DB}
TRYTOND_DATABASE_URI: ${TRYTOND_DATABASE_URI:-postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-SUp3r-pass*DB}@${POSTGRES_HOST:-db}:5432/}
SMTP: ${SMTP:-"True"}
SMTP_TYPE: ${SMTP_TYPE:-"smtps+ssl"}
SMTP_USER: ${SMTP_USER:-"user"}
SMTP_PASSWORD: ${SMTP_PASSWORD:-"passsword"}
SMTP_DOMAIN: ${SMTP_DOMAIN:-"domain.com"}
SMTP_PORT: ${SMTP_PORT:-465}
SMTP_FROM: ${SMTP_FROM:-"Company CO"}
SMTP_EMAIL: ${SMTP_EMAIL:-"domain@domain.com"}
services: services:
db: db:
image: postgres image: postgres
hostname: ${DB_HOSTNAME} hostname: ${POSTGRES_HOST:-db}
volumes: volumes:
- postgres:/var/lib/postgresql - postgres:/var/lib/postgresql
environment: environment:
POSTGRES_HOST: ${POSTGRES_HOST:-db}
POSTGRES_DB: ${POSTGRES_DB:-naliia} POSTGRES_DB: ${POSTGRES_DB:-naliia}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-SUp3r-pass*DB} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-SUp3r-pass*DB}
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-naliia}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-naliia}"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
env_file:
- .env
tryton: tryton:
image: ${NALIIA:-gitea.onecluster.org/oneteam/naliia:1.0.0_pro} image: ${NALIIA}
working_dir: /app working_dir: /app
command: /bin/bash /opt/start.sh command: /bin/bash /opt/start.sh
volumes: volumes:
- var:/var - var:/var
- attachment:/mnt/attachment - attachment:/mnt/attachment
environment: environment:
TRYTOND_DATABASE_URI: ${TRYTOND_DATABASE_URI:-postgresql://${POSTGRES_USER:-naliia}:${POSTGRES_PASSWORD:-SUp3r-pass*DB}@${DB_HOSTNAME:-db}:5432/} <<: *common-env
NALIIA_IMAGE: ${NALIIA:-gitea.onecluster.org/aserrador/naliia:latest}
EMAIL: ${EMAIL:-admin@admin.org}
depends_on: depends_on:
db: db:
condition: service_healthy condition: service_healthy
@@ -35,101 +50,74 @@ services:
retries: 5 retries: 5
start_period: 30s start_period: 30s
timeout: 20s timeout: 20s
env_file:
- .env
worker: worker:
image: ${NALIIA:-gitea.onecluster.org/oneteam/naliia:1.0.0_pro} image: ${NALIIA}
working_dir: /app working_dir: /app
environment:
<<: *common-env
entrypoint: ["bash", "-c", "/entrypoint.sh trytond-worker -c /etc/trytond_worker.conf -d ${POSTGRES_DB} --logconf /etc/trytond_worker_logging.conf"]
volumes:
- .:/app
depends_on: depends_on:
tryton: tryton:
condition: service_healthy condition: service_healthy
db: db:
condition: service_healthy condition: service_healthy
entrypoint:
[
"bash",
"-c",
"/entrypoint.sh trytond-worker -c /etc/trytond_worker.conf -d ${POSTGRES_DB} --logconf /etc/trytond_worker_logging.conf",
]
volumes:
- .:/app
environment:
TRYTOND_DATABASE_URI: ${TRYTOND_DATABASE_URI:-postgresql://${POSTGRES_USER:-naliia}:${POSTGRES_PASSWORD:-SUp3r-pass*DB}@${DB_HOSTNAME:-db}:5432/}
env_file:
- .env
cron: cron:
image: ${NALIIA:-gitea.onecluster.org/oneteam/naliia:1.0.0_pro} image: ${NALIIA}
working_dir: /app working_dir: /app
environment:
<<: *common-env
entrypoint: ["bash", "-c", "/entrypoint.sh trytond-cron -c /etc/trytond.conf -d ${POSTGRES_DB} --logconf /etc/trytond_cron_logging.conf"]
volumes:
- .:/app
depends_on: depends_on:
tryton: tryton:
condition: service_healthy condition: service_healthy
db: db:
condition: service_healthy condition: service_healthy
entrypoint:
[
"bash",
"-c",
"/entrypoint.sh trytond-cron -c /etc/trytond.conf -d ${POSTGRES_DB} --logconf /etc/trytond_cron_logging.conf",
]
volumes:
- .:/app
environment:
TRYTOND_DATABASE_URI: ${TRYTOND_DATABASE_URI:-postgresql://${POSTGRES_USER:-naliia}:${POSTGRES_PASSWORD:-SUp3r-pass*DB}@${DB_HOSTNAME:-db}:5432/}
env_file:
- .env
nginx: nginx:
image: nginx:1.23.3 image: nginx:1.23.3
volumes: volumes:
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf.template - ./nginx.conf:/etc/nginx/conf.d/nginx.conf.template
ports: ports:
- "${NGINX_PORT:-10000}:${NGINX_PORT:-10000}" - "${NGINX_PORT:-10000}:${NGINX_PORT:-10000}"
env_file: environment:
- .env SERVER_NAME: ${SERVER_NAME:-tryton.domain.com}
depends_on: NGINX_PORT: ${NGINX_PORT:-10000}
- tryton VARIABLE: ${VARIABLE:-'$'}
- db
command: /bin/bash -c "envsubst < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" command: /bin/bash -c "envsubst < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
bot: bot:
image: ${NALIIA_BOT:-gitea.onecluster.org/oneteam/naliia_bot:v1.0.0_pro} image: ${NALIIA_BOT:-gitea.onecluster.org/oneteam/naliia_bot:v1.0.0_pro}
ports: ports:
- "8010:8010" - "8010:8010"
depends_on:
db:
condition: service_healthy
volumes:
- bot:/app/src
env_file:
- .env
environment: environment:
- LLM_MODEL=${LLM_MODEL:-deepseek} <<: *common-env
- POSTGRES_HOST=${POSTGRES_HOST:-db} LLM_MODEL: ${LLM_MODEL:-deepseek}
- POSTGRES_USER=${POSTGRES_USER:-postgres} POSTGRES_DB: ${POSTGRES_DB:-messages}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-messages}
healthcheck: healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8010/health || exit 1"] test: ["CMD-SHELL", "curl -f http://localhost:8010/health || exit 1"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
start_period: 40s start_period: 40s
tryton_mcp: tryton_mcp:
image: ${NALIIA_TRYTON_MCP:-gitea.onecluster.org/oneteam/naliia_tryton_mcp:v1.0.0_pro} image: ${NALIIA_TRYTON_MCP:-gitea.onecluster.org/oneteam/naliia_tryton_mcp:v1.0.0_pro}
volumes:
- mcp:/app/src
environment: environment:
- TRYTON_HOSTNAME=${TRYTON_HOSTNAME:-tryton} <<: *common-env
- TRYTON_DATABASE=${TRYTON_DATABASE:-naliia} TRYTON_HOSTNAME: ${TRYTON_HOSTNAME:-tryton}
- TRYTON_USERNAME=${TRYTON_USERNAME:-admin} TRYTON_DATABASE: ${TRYTON_DATABASE:-naliia}
- TRYTON_PASSWORD=${TRYTON_PASSWORD:-S0p0rt3f1n4l*} TRYTON_USERNAME: ${TRYTON_USERNAME:-admin}
- TRYTON_PORT=${TRYTON_PORT:-8000} TRYTON_PASSWORD: ${TRYTON_PASSWORD:-S0p0rt3f1n4l*}
- FASTMCP_HOST=0.0.0.0 TRYTON_PORT: ${TRYTON_PORT:-8000}
- FASTMCP_TRANSPORT=http FASTMCP_HOST: 0.0.0.0
- FASTMCP_PORT=3001 FASTMCP_TRANSPORT: http
env_file: FASTMCP_PORT: 3001
- .env
volumes: volumes:
postgres: postgres: