11services :
2- # --- Aplicação Principal ---
2+ # --- Aplicação Principal (Rails API) ---
33 api :
44 build :
55 context : .
@@ -8,18 +8,21 @@ services:
88 restart : unless-stopped
99 environment :
1010 RAILS_ENV : production
11- # O Coolify preenche as variáveis se você definir na UI,
12- # mas aqui garantimos a conexão interna:
13- DATABASE_URL : postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
11+ # O Coolify injeta a URL do Supabase aqui
12+ DATABASE_URL : ${DATABASE_URL}
13+ # URL para o banco local (futura réplica)
14+ REPLICA_DATABASE_URL : postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
15+ # Conexão interna com Redis e Elastic
1416 REDIS_URL : redis://redis:6379/1
1517 ELASTICSEARCH_URL : http://elasticsearch:9200
1618 RAILS_LOG_TO_STDOUT : " true"
1719 PORT : 3000
20+ # Chaves de API e Segurança (definidas no Coolify)
21+ RAILS_MASTER_KEY : ${RAILS_MASTER_KEY}
22+ RIOT_API_KEY : ${RIOT_API_KEY}
1823 ports :
19- - " 3000" # O Coolify vai detectar essa porta e criar o domínio automaticamente
24+ - " 3000"
2025 depends_on :
21- postgres :
22- condition : service_healthy
2326 redis :
2427 condition : service_healthy
2528 elasticsearch :
@@ -39,14 +42,17 @@ services:
3942 command : bundle exec sidekiq -C config/sidekiq.yml
4043 environment :
4144 RAILS_ENV : production
42- DATABASE_URL : postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
45+ DATABASE_URL : ${DATABASE_URL}
46+ REPLICA_DATABASE_URL : postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
4347 REDIS_URL : redis://redis:6379/1
4448 ELASTICSEARCH_URL : http://elasticsearch:9200
49+ RAILS_MASTER_KEY : ${RAILS_MASTER_KEY}
50+ RIOT_API_KEY : ${RIOT_API_KEY}
4551 depends_on :
4652 - api
4753 - redis
4854
49- # --- Banco de Dados (Local na VPS ) ---
55+ # --- Banco Local (Futura Read Replica ) ---
5056 postgres :
5157 image : postgres:15-alpine
5258 container_name : prostaff-postgres
@@ -76,25 +82,12 @@ services:
7682 timeout : 5s
7783 retries : 5
7884
79- # --- Analytics (Memória Reduzida ) ---
85+ # --- Analytics (Elasticsearch ) ---
8086 elasticsearch :
8187 image : docker.elastic.co/elasticsearch/elasticsearch:8.13.4
8288 container_name : prostaff-elasticsearch
8389 restart : unless-stopped
8490 environment :
8591 - discovery.type=single-node
8692 - xpack.security.enabled=false
87- # IMPORTANTE: Reduzido para caber na KVM 1 (4GB total)
88- - ES_JAVA_OPTS=-Xms512m -Xmx512m
89- volumes :
90- - prostaff_es_data:/usr/share/elasticsearch/data
91- healthcheck :
92- test : ["CMD-SHELL", "curl -s http://localhost:9200 >/dev/null || exit 1"]
93- interval : 30s
94- timeout : 10s
95- retries : 5
96-
97- volumes :
98- prostaff_pg_data :
99- prostaff_redis_data :
100- prostaff_es_data :
93+ # Ajustado para KVM
0 commit comments