Skip to content

Instantly share code, notes, and snippets.

@oswaldolinhares
Created June 25, 2025 01:47
Show Gist options
  • Save oswaldolinhares/bf6c70e1258b590ad52fc3ac665c0264 to your computer and use it in GitHub Desktop.
Save oswaldolinhares/bf6c70e1258b590ad52fc3ac665c0264 to your computer and use it in GitHub Desktop.
Configuração com o node
service: imaginalle_store
image: oswaldolinhares/imaginalle_store
servers:
web:
hosts:
- xxx.xxx.xxx ip
proxy:
ssl: true
hosts:
- imaginalle.com
- www.imaginalle.com
volumes:
- "/var/lib/kamal/proxy/acme:/var/lib/kamal/proxy/acme"
- "imaginalle_store_storage:/rails/storage"
registry:
username: oswaldolinhares
password:
- KAMAL_REGISTRY_PASSWORD
env:
secret:
- RAILS_MASTER_KEY
- SHRINE_STORAGE_S3_BUCKET
- SHRINE_STORAGE_S3_REGION
- SHRINE_STORAGE_S3_ACCESS_KEY_ID
- SHRINE_STORAGE_S3_SECRET_ACCESS_KEY
- SHRINE_STORAGE_S3_ENDPOINT
- SHRINE_STORAGE_S3_CDN_HOST
clear:
RAILS_ENV: production
RAILS_SERVE_STATIC_FILES: true
# Variáveis para o Rails se comunicar com o serviço Node
NODE_HOST: whatsapp_bot # O nome do serviço Node, conforme definido abaixo em `services:`
NODE_PORT: 3001 # A porta interna que o app Node escuta
asset_path: /rails/public/assets
builder:
arch: amd64
secrets:
- RAILS_MASTER_KEY
- SHRINE_STORAGE_S3_BUCKET
- SHRINE_STORAGE_S3_REGION
- SHRINE_STORAGE_S3_ACCESS_KEY_ID
- SHRINE_STORAGE_S3_SECRET_ACCESS_KEY
- SHRINE_STORAGE_S3_ENDPOINT
- SHRINE_STORAGE_S3_CDN_HOST
aliases:
console: app exec --interactive --reuse "bin/rails console"
shell: app exec --interactive --reuse "bash"
logs: app logs -f
dbc: app exec --interactive --reuse "bin/rails dbconsole"
migrate: app exec -- "bin/rails db:migrate"
seed: app exec -- "bin/rails db:seed"
precompile: app exec -- "bin/rails assets:precompile"
drop: app exec -- "bin/rails db:drop"
create: app exec -- "bin/rails db:create"
# Definição de Serviços Secundários
# A chave `services` (no plural) no mesmo nível da chave `service` principal é onde você lista os serviços adicionais.
services:
whatsapp_bot: # Nome do seu serviço Node
service: whatsapp_bot # Repete o nome do serviço aqui (isso é essencial para o Kamal)
image: oswaldolinhares/whatsapp_bot # Sua imagem Docker para o Node
servers:
web:
hosts:
- xxx.xxx.xxx ip do servidor
cmd: "node index.js" # O comando para iniciar seu app Node
builder:
arch: amd64
context: ./whatsapp-bot # Caminho para o diretório do seu Dockerfile e código Node
dockerfile: ./whatsapp-bot/Dockerfile # Caminho específico para o Dockerfile do Node
env:
secret:
# Estas variáveis devem estar aqui, pois são consumidas pelo container Node.
-
- VENOM_API_SECRET_TOKEN
clear:
NODE_ENV: production
labels:
traefik.enable: "true"
traefik.http.routers.whatsapp_bot.rule: "Host(`api.imaginalle.com`)"
traefik.http.routers.whatsapp_bot.entrypoints: "websecure"
traefik.http.routers.whatsapp_bot.tls: "true"
traefik.http.services.whatsapp_bot.loadbalancer.server.port: "3001"
traefik.http.routers.whatsapp_bot_redirect-http.rule: "Host(`api.imaginalle.com`)"
traefik.http.routers.whatsapp_bot_redirect-http.entrypoints: "web"
traefik.http.routers.whatsapp_bot_redirect-http.middlewares: "redirect-to-https"
traefik.http.routers.whatsapp_bot_redirect-http.service: "noop@internal"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment