From dd7290b36cee7cace2c1f31b7494784e4411b264 Mon Sep 17 00:00:00 2001 From: Rodrigo Borba Date: Sat, 3 Jan 2026 14:05:58 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Implementa=20CI/CD=20para=20GHCR,=20def?= =?UTF-8?q?ine=20stack=20Docker=20de=20produ=C3=A7=C3=A3o=20e=20refatora?= =?UTF-8?q?=20a=20busca=20de=20vetores.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/jasmine/document_chunk.rb | 4 +- docker-stack.prod.yml | 70 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 docker-stack.prod.yml diff --git a/app/models/jasmine/document_chunk.rb b/app/models/jasmine/document_chunk.rb index cbe0972..b997409 100644 --- a/app/models/jasmine/document_chunk.rb +++ b/app/models/jasmine/document_chunk.rb @@ -10,7 +10,7 @@ module Jasmine belongs_to :document, class_name: 'Jasmine::Document' # Enable neighbor vector search - neighbor_vector :embedding + has_neighbors :embedding validates :content, presence: true validate :validate_consistency @@ -19,7 +19,7 @@ module Jasmine def validate_consistency return if document.nil? || collection.nil? - + errors.add(:base, 'Document mismatch') if document.collection_id != collection_id errors.add(:base, 'Collection account mismatch') if collection.account_id != account_id errors.add(:base, 'Document account mismatch') if document.account_id != account_id diff --git a/docker-stack.prod.yml b/docker-stack.prod.yml new file mode 100644 index 0000000..6f27501 --- /dev/null +++ b/docker-stack.prod.yml @@ -0,0 +1,70 @@ +version: '3.8' + +services: + rails: + image: ghcr.io/${GITHUB_REPOSITORY_OWNER:-your-username}/chatwoot-develop:latest + environment: + - RAILS_ENV=production + - NODE_ENV=production + - REDIS_URL=redis://redis:6379 + - POSTGRES_HOST=postgres + - POSTGRES_PORT=5432 + env_file: + - .env + ports: + - '3000:3000' + deploy: + replicas: 1 + restart_policy: + condition: on-failure + depends_on: + - postgres + - redis + + sidekiq: + image: ghcr.io/${GITHUB_REPOSITORY_OWNER:-your-username}/chatwoot-develop:latest + command: bundle exec sidekiq -C config/sidekiq.yml + environment: + - RAILS_ENV=production + - NODE_ENV=production + - REDIS_URL=redis://redis:6379 + - POSTGRES_HOST=postgres + - POSTGRES_PORT=5432 + env_file: + - .env + deploy: + replicas: 1 + restart_policy: + condition: on-failure + depends_on: + - postgres + - redis + + postgres: + image: postgres:12 + restart: always + environment: + - POSTGRES_DB=chatwoot_production + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + volumes: + - postgres_data:/var/lib/postgresql/data + deploy: + placement: + constraints: + - node.role == manager + + redis: + image: redis:6.2-alpine + restart: always + volumes: + - redis_data:/data + deploy: + placement: + constraints: + - node.role == manager + +volumes: + postgres_data: + redis_data: + storage: