From 6bb494fa613dee8a6751aff6c9277ec8e1fc1f3f Mon Sep 17 00:00:00 2001 From: Raiffy_Sampaio Date: Wed, 26 Mar 2025 17:40:14 +0000 Subject: [PATCH] chatwoot.yaml Stack do chatwoot para docker swarm. --- chatwoot/chatwoot.yaml | 162 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 chatwoot/chatwoot.yaml diff --git a/chatwoot/chatwoot.yaml b/chatwoot/chatwoot.yaml new file mode 100644 index 0000000..1000cc5 --- /dev/null +++ b/chatwoot/chatwoot.yaml @@ -0,0 +1,162 @@ +services: + ################################################################################# + # Execute o comando abaixo para configurar o banco do chatwoot # + # bundle exec rails db:chatwoot_prepare # + # OBS: Use o terminal ash # + ################################################################################# + # Para mais variáveis de ambiente # + # https://www.chatwoot.com/docs/self-hosted/configuration/environment-variables # + ################################################################################# + chatwoot_app: + ############################################################# + # A imagem do sendingtk possui todos os plugins liberados, # + # porém não consegui fazer funcionar. Tentar em outra stack # + ############################################################# + #image: sendingtk/chatwoot:3.15.6 + image: chatwoot/chatwoot:latest + entrypoint: docker/entrypoints/rails.sh + command: bundle exec rails s -p 3000 -b 0.0.0.0 + networks: + - traefik_network + - postgres_network + volumes: + - chatwoot_data:/app/storage + - chatwoot_public:/app + secrets: + - db_user_automacao + - postgres16 + environment: + RAILS_ENV: production + SECRET_KEY_BASE: M2dmVyQqXLzZbKCZ2XlcGdaUFLT0Iu8r + FRONTEND_URL: https://chat.omegaflow.com.br + DEFAULT_LOCALE: pt_BR + FORCE_SSL: "true" + ENABLE_ACCOUNT_SIGNUP: "false" + REDIS_URL: redis://redis:6379 + ################## + # Banco de dados # + ################## + #DATABASE_URL: "postgresql://chatwoot:${DB_PASSWORD}@automacao/chatwoot" + DB_PASSWORD_FILE: /run/secrets/db_user_automacao + POSTGRES_HOST: postgres + POSTGRES_DATABASE: chatwoot + POSTGRES_USERNAME: automacao + POSTGRES_PASSWORD: Qgs#j7Cwugag0dt*7pnD7heonoVDg4KpBBEgvLD2 + ########################################################### + # O Chatwoot não está conseguindo ler a senha nos secrets # + ########################################################### + #POSTGRES_PASSWORD_FILE: /run/secrets/postgres16 + #POSTGRES_PASSWORD_FILE: /run/secrets/db_user_automacao + ################# + # Armazenamento # + ################# + ACTIVE_STORAGE_SERVICE: local + ######## + # Logs # + ######## + RAILS_LOG_TO_STDOUT: "true" + ############## + # Avatar Bot # + ############## + USE_INBOX_AVATAR_FOR_BOT: "true" + deploy: + mode: replicated + replicas: 1 + placement: + constraints: [] + resources: + limits: + cpus: '1' + memory: 1024M + labels: + - traefik.enable=true + - traefik.http.routers.chatwoot_app.rule=Host('chat.omegaflow.com.br') && PathPrefix(`/super_admin`) + - traefik.http.routers.chatwoot_app.entrypoint=websecure + - traefik.http.routers.chatwoot_app.service=chatwoot_app + - traefik.http.routers.chatwoot_app.tls.certresolver=lets-encrypt + - traefik.http.services.chatwoot_app.loadbalancer.server.port=3000 + # Corrigir problemas de websocket + - traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https + - traefik.http.routers.chatwoot_app.middlewares=sslheader + + chatwoot_worker: + ############################################################# + # A imagem do sendingtk possui todos os plugins liberados, # + # porém não consegui fazer funcionar. Tentar em outra stack # + ############################################################# + #image: sendingtk/chatwoot:3.15.6 + image: chatwoot/chatwoot:latest + command: bundle exec sidekiq -C config/sidekiq.yml + networks: + - postgres_network + volumes: + - chatwoot_data:/app/storage + - chatwoot_public:/app + secrets: + - db_user_automacao + - postgres16 + environment: + RAILS_ENV: production + SECRET_KEY_BASE: M2dmVyQqXLzZbKCZ2XlcGdaUFLT0Iu8r + FRONTEND_URL: https://chat.omegaflow.com.br + DEFAULT_LOCALE: pt_BR + FORCE_SSL: "true" + ENABLE_ACCOUNT_SIGNUP: "false" + REDIS_URL: redis://redis:6379 + ################## + # Banco de dados # + ################## + #DATABASE_URL: "postgresql://chatwoot:${DB_PASSWORD}@automacao/chatwoot" + DB_PASSWORD_FILE: /run/secrets/db_user_automacao + POSTGRES_HOST: postgres + POSTGRES_DATABASE: chatwoot + POSTGRES_USERNAME: automacao + POSTGRES_PASSWORD: Qgs#j7Cwugag0dt*7pnD7heonoVDg4KpBBEgvLD2 + ########################################################### + # O Chatwoot não está conseguindo ler a senha nos secrets # + ########################################################### + #POSTGRES_PASSWORD_FILE: /run/secrets/postgres16 + #POSTGRES_PASSWORD_FILE: /run/secrets/db_user_automacao + ################# + # Armazenamento # + ################# + ACTIVE_STORAGE_SERVICE: local + ######## + # Logs # + ######## + RAILS_LOG_TO_STDOUT: "true" + ############## + # Avatar Bot # + ############## + USE_INBOX_AVATAR_FOR_BOT: "true" + deploy: + mode: replicated + replicas: 1 + placement: + constraints: [] + resources: + limits: + cpus: '1' + memory: 1024M + +volumes: + chatwoot_data: + external: true + chatwoot_public: + external: true + +secrets: + db_user_automacao: + external: true + postgres16: + external: true + +networks: + postgres_network: + driver: overlay + attachable: true + external: true + traefik_network: + driver: overlay + attachable: true + external: true \ No newline at end of file