|
1 | 1 | services: |
2 | | - # --- Aplicação Principal (Rails API) --- |
3 | | - api: |
4 | | - build: |
5 | | - context: . |
6 | | - dockerfile: Dockerfile.production |
7 | | - container_name: prostaff-api |
8 | | - restart: unless-stopped |
9 | | - environment: |
10 | | - RAILS_ENV: production |
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 |
16 | | - REDIS_URL: redis://redis:6379/1 |
17 | | - ELASTICSEARCH_URL: http://elasticsearch:9200 |
18 | | - RAILS_LOG_TO_STDOUT: "true" |
19 | | - 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} |
23 | | - ports: |
24 | | - - "3000" |
25 | | - depends_on: |
26 | | - redis: |
27 | | - condition: service_healthy |
28 | | - elasticsearch: |
29 | | - condition: service_healthy |
| 2 | +api: |
| 3 | +build: |
| 4 | +context: . |
| 5 | +dockerfile: Dockerfile.production |
| 6 | +container_name: prostaff-api |
| 7 | +restart: unless-stopped |
| 8 | +labels: |
| 9 | +- "traefik.enable=true" |
| 10 | +- "traefik.http.routers.prostaff-api.rule=Host(prostaff.gg)" |
| 11 | +- "traefik.http.routers.prostaff-api.entrypoints=https" |
| 12 | +- "traefik.http.routers.prostaff-api.tls=true" |
| 13 | +- "traefik.http.routers.prostaff-api.tls.certresolver=letsencrypt" |
| 14 | +- "traefik.http.services.prostaff-api.loadbalancer.server.port=3000" |
| 15 | +environment: |
| 16 | +RAILS_ENV: production |
| 17 | +DATABASE_URL: DATABASEURLREPLICADATABASEURL:postgres://{POSTGRES_USER}:POSTGRESPASSWORD@postgres:5432/{POSTGRES_DB} |
| 18 | +REDIS_URL: redis://redis:6379/1 |
| 19 | +ELASTICSEARCH_URL: http://elasticsearch:9200 |
| 20 | +RAILS_LOG_TO_STDOUT: "true" |
| 21 | +PORT: 3000 |
| 22 | +RAILS_MASTER_KEY: ${RAILS_MASTER_KEY} |
| 23 | +RIOT_API_KEY: ${RIOT_API_KEY} |
| 24 | +ports: |
| 25 | +- "3000:3000" |
| 26 | +depends_on: |
| 27 | +redis: |
| 28 | +condition: service_healthy |
| 29 | +elasticsearch: |
| 30 | +condition: service_healthy |
30 | 31 |
|
31 | | - # --- Worker (Sidekiq) --- |
32 | | - sidekiq: |
33 | | - build: |
34 | | - context: . |
35 | | - dockerfile: Dockerfile.production |
36 | | - container_name: prostaff-sidekiq |
37 | | - command: bundle exec sidekiq -C config/sidekiq.yml |
38 | | - environment: |
39 | | - RAILS_ENV: production |
40 | | - DATABASE_URL: ${DATABASE_URL} |
41 | | - REPLICA_DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB} |
42 | | - REDIS_URL: redis://redis:6379/1 |
43 | | - ELASTICSEARCH_URL: http://elasticsearch:9200 |
44 | | - RAILS_MASTER_KEY: ${RAILS_MASTER_KEY} |
45 | | - RIOT_API_KEY: ${RIOT_API_KEY} |
46 | | - depends_on: |
47 | | - - api |
48 | | - - redis |
| 32 | +sidekiq: |
| 33 | +build: |
| 34 | +context: . |
| 35 | +dockerfile: Dockerfile.production |
| 36 | +container_name: prostaff-sidekiq |
| 37 | +command: bundle exec sidekiq -C config/sidekiq.yml |
| 38 | +environment: |
| 39 | +RAILS_ENV: production |
| 40 | +DATABASE_URL: DATABASEURLREPLICADATABASEURL:postgres://{POSTGRES_USER}:POSTGRESPASSWORD@postgres:5432/{POSTGRES_DB} |
| 41 | +REDIS_URL: redis://redis:6379/1 |
| 42 | +ELASTICSEARCH_URL: http://elasticsearch:9200 |
| 43 | +RAILS_MASTER_KEY: ${RAILS_MASTER_KEY} |
| 44 | +RIOT_API_KEY: ${RIOT_API_KEY} |
| 45 | +depends_on: |
| 46 | +- api |
| 47 | +- redis |
49 | 48 |
|
50 | | - # --- Banco Local (Futura Read Replica) --- |
51 | | - postgres: |
52 | | - image: postgres:15-alpine |
53 | | - container_name: prostaff-postgres |
54 | | - restart: always |
55 | | - environment: |
56 | | - POSTGRES_DB: ${POSTGRES_DB:-prostaff_production} |
57 | | - POSTGRES_USER: ${POSTGRES_USER:-postgres} |
58 | | - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe123!} |
59 | | - volumes: |
60 | | - - prostaff_pg_data:/var/lib/postgresql/data |
61 | | - healthcheck: |
62 | | - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] |
63 | | - interval: 10s |
64 | | - timeout: 5s |
65 | | - retries: 5 |
| 49 | +postgres: |
| 50 | +image: postgres:15-alpine |
| 51 | +container_name: prostaff-postgres |
| 52 | +restart: always |
| 53 | +environment: |
| 54 | +POSTGRES_DB: ${POSTGRES_DB:-prostaff_production} |
| 55 | +POSTGRES_USER: ${POSTGRES_USER:-postgres} |
| 56 | +POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe123!} |
| 57 | +volumes: |
| 58 | +- prostaff_pg_data:/var/lib/postgresql/data |
| 59 | +healthcheck: |
| 60 | +test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] |
| 61 | +interval: 10s |
| 62 | +timeout: 5s |
| 63 | +retries: 5 |
66 | 64 |
|
67 | | - # --- Cache & Job Queue --- |
68 | | - redis: |
69 | | - image: redis:7-alpine |
70 | | - container_name: prostaff-redis |
71 | | - restart: always |
72 | | - volumes: |
73 | | - - prostaff_redis_data:/data |
74 | | - healthcheck: |
75 | | - test: ["CMD", "redis-cli", "ping"] |
76 | | - interval: 10s |
77 | | - timeout: 5s |
78 | | - retries: 5 |
| 65 | +redis: |
| 66 | +image: redis:7-alpine |
| 67 | +container_name: prostaff-redis |
| 68 | +restart: always |
| 69 | +volumes: |
| 70 | +- prostaff_redis_data:/data |
| 71 | +healthcheck: |
| 72 | +test: ["CMD", "redis-cli", "ping"] |
| 73 | +interval: 10s |
| 74 | +timeout: 5s |
| 75 | +retries: 5 |
79 | 76 |
|
80 | | - # --- Analytics (Elasticsearch) --- |
81 | | - elasticsearch: |
82 | | - image: docker.elastic.co/elasticsearch/elasticsearch:8.13.4 |
83 | | - container_name: prostaff-elasticsearch |
84 | | - restart: unless-stopped |
85 | | - environment: |
86 | | - - discovery.type=single-node |
87 | | - - xpack.security.enabled=false |
88 | | - # Ajustado para KVM 2 (1GB Heap é seguro) |
89 | | - - ES_JAVA_OPTS=-Xms1g -Xmx1g |
90 | | - volumes: |
91 | | - - prostaff_es_data:/usr/share/elasticsearch/data |
92 | | - healthcheck: |
93 | | - test: ["CMD-SHELL", "curl -s http://localhost:9200 >/dev/null || exit 1"] |
94 | | - interval: 30s |
95 | | - timeout: 10s |
96 | | - retries: 5 |
| 77 | +elasticsearch: |
| 78 | +image: docker.elastic.co/elasticsearch/elasticsearch:8.13.4 |
| 79 | +container_name: prostaff-elasticsearch |
| 80 | +restart: unless-stopped |
| 81 | +environment: |
| 82 | +- discovery.type=single-node |
| 83 | +- xpack.security.enabled=false |
| 84 | +- ES_JAVA_OPTS=-Xms512m -Xmx512m |
| 85 | +volumes: |
| 86 | +- prostaff_es_data:/usr/share/elasticsearch/data |
| 87 | +healthcheck: |
| 88 | +test: ["CMD-SHELL", "curl -s http://localhost:9200 >/dev/null || exit 1"] |
| 89 | +interval: 30s |
| 90 | +timeout: 10s |
| 91 | +retries: 5 |
97 | 92 |
|
98 | 93 | volumes: |
99 | | - prostaff_pg_data: |
100 | | - prostaff_redis_data: |
101 | | - prostaff_es_data: |
| 94 | +prostaff_pg_data: |
| 95 | +prostaff_redis_data: |
| 96 | +prostaff_es_data: |
0 commit comments