
✅ Script para instalar pgvector
no PostgreSQL 16.4 (Debian-based)
Stack pgvector:
version: "3.8"
services:
postgres:
image: pgvector/pgvector:pg16
command: [postgres, --max_connections=500]
environment:
- POSTGRES_PASSWORD=SenhaPostgres
networks:
- digital_network
volumes:
- postgres_data:/var/lib/postgresql/data
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
#- node.role == worker
#- node.hostname == database
resources:
limits:
cpus: "4"
memory: 8000M
volumes:
postgres_data:
external: true
networks:
digital_network:
external: true
Instale e compile o pgvector

apt-get update \
&& apt-get install -y build-essential git postgresql-server-dev-16 \
&& cd /tmp \
&& git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git \
&& cd pgvector \
&& make && make install \
&& apt-get purge -y build-essential git postgresql-server-dev-16 \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
psql -U postgres
CREATE EXTENSION IF NOT EXISTS vector;
\dx
Próximo passos:
- Remover o Chatwoot V3
- Deletar todos os volumes
- Excluir a tabela do Chatwoot V3 no postgres
drop database chatwoot;
- Criar uma nova tabela
create database chatwoot;
Stack Chatwoot Versão 4:
version: "3.8"
# bundle exec rails db:chatwoot_prepare
services:
chatwoot_app:
image: chatwoot/chatwoot:v4.1.0
command: bundle exec rails s -p 3000 -b 0.0.0.0
entrypoint: docker/entrypoints/rails.sh
volumes:
- chatwoot_data:/app/storage
- chatwoot_public:/app
networks:
- traefik_public
- digital_network
environment:
- CHATWOOT_HUB_URL=https://chatwoot.digitalinterativo.com.br #
- INSTALLATION_NAME=Chatwoot #
- NODE_ENV=production
- RAILS_ENV=production
- INSTALLATION_ENV=docker
- SECRET_KEY_BASE=123458bb7ef6402f6a8bmf5d3bx54321 #
- FRONTEND_URL=https://chatwoot.digitalinterativo.com.br #
- DEFAULT_LOCALE=pt_BR
- FORCE_SSL=true
- ENABLE_ACCOUNT_SIGNUP=false #
- REDIS_URL=redis://redis:6379
- POSTGRES_HOST=postgres
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=Suasenha #
- POSTGRES_DATABASE=chatwoot
- ACTIVE_STORAGE_SERVICE=local
- RAILS_LOG_TO_STDOUT=true
- USE_INBOX_AVATAR_FOR_BOT=true
# Performance
- SIDEKIQ_CONCURRENCY=10
- RACK_TIMEOUT_SERVICE_TIMEOUT=0
- RAILS_MAX_THREADS=5
- WEB_CONCURRENCY=2
- ENABLE_RACK_ATTACK=false
- WEBHOOKS_TRIGGER_TIMEOUT=40
# Servidor de Email Gmail
- MAILER_SENDER_EMAIL=Chatwoot
- SMTP_DOMAIN=gmail.com
- SMTP_ADDRESS=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USERNAME=seuemail@gmail.com
- SMTP_PASSWORD=dqrcrihcxsdsfqra
- SMTP_AUTHENTICATION=login
- SMTP_ENABLE_STARTTLS_AUTO=true
- SMTP_OPENSSL_VERIFY_MODE=peer
- MAILER_INBOUND_EMAIL_DOMAIN=seuemail@gmail.com
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
resources:
limits:
cpus: "1"
memory: 2048M
labels:
- traefik.enable=true
- traefik.http.routers.chatwoot_app.rule=Host(`chatwoot.digitalinterativo.com.br`)
- traefik.http.routers.chatwoot_app.entrypoints=websecure
- traefik.http.routers.chatwoot_app.tls.certresolver=le
- traefik.http.routers.chatwoot_app.priority=1
- traefik.http.routers.chatwoot_app.service=chatwoot_app
- traefik.http.services.chatwoot_app.loadbalancer.server.port=3000
- traefik.http.services.chatwoot_app.loadbalancer.passhostheader=true
- traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https
- traefik.http.routers.chatwoot_app.middlewares=sslheader@docker
chatwoot_sidekiq:
image: chatwoot/chatwoot:v4.1.0
command: bundle exec sidekiq -C config/sidekiq.yml
volumes:
- chatwoot_data:/app/storage
- chatwoot_public:/app
networks:
- traefik_public
- digital_network
environment:
- CHATWOOT_HUB_URL=https://chatwoot.digitalinterativo.com.br #
- INSTALLATION_NAME=Chatwoot #
- NODE_ENV=production
- RAILS_ENV=production
- INSTALLATION_ENV=docker
- SECRET_KEY_BASE=123458bb7ef6402f6a8bmf5d3bx54321 #
- FRONTEND_URL=https://chatwoot.digitalinterativo.com.br #
- DEFAULT_LOCALE=pt_BR
- FORCE_SSL=true
- ENABLE_ACCOUNT_SIGNUP=false #
- REDIS_URL=redis://redis:6379
- POSTGRES_HOST=postgres
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=Suasenha #
- POSTGRES_DATABASE=chatwoot
- ACTIVE_STORAGE_SERVICE=local
- RAILS_LOG_TO_STDOUT=true
- USE_INBOX_AVATAR_FOR_BOT=true
# Performance
- SIDEKIQ_CONCURRENCY=10
- RACK_TIMEOUT_SERVICE_TIMEOUT=0
- RAILS_MAX_THREADS=5
- WEB_CONCURRENCY=2
- ENABLE_RACK_ATTACK=false
- WEBHOOKS_TRIGGER_TIMEOUT=40
# Servidor de Email Gmail
- MAILER_SENDER_EMAIL=Chatwoot
- SMTP_DOMAIN=gmail.com
- SMTP_ADDRESS=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USERNAME=seuemail@gmail.com
- SMTP_PASSWORD=dqrcrihcxsdsfqra
- SMTP_AUTHENTICATION=login
- SMTP_ENABLE_STARTTLS_AUTO=true
- SMTP_OPENSSL_VERIFY_MODE=peer
- MAILER_INBOUND_EMAIL_DOMAIN=seuemail@gmail.com
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
resources:
limits:
cpus: "1"
memory: 2048M
volumes:
chatwoot_data:
external: true
name: chatwoot_data
chatwoot_public:
external: true
name: chatwoot_public
networks:
traefik_public:
external: true
digital_network:
external: true