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: