fix(cors,n8n): fix CORS for production, add unattended n8n init with seed
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Detect Changes (push) Successful in 11s
Run Tests on Branches / Backend Tests (push) Has been skipped
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped

- Change CORS_ORIGIN from localhost:4000 to farmacias.hacecalor.net in docker-compose.yml
- Add postgres and parapharmacy-api healthchecks
- Add n8n-init service that runs BEFORE n8n starts:
  - Imports workflows via n8n CLI
  - Activates all workflows via publish:workflow
  - Seeds parapharmacy DB with 20 test products
- Fix parapharmacy-api healthcheck to use node instead of wget (not available in image)
- Fix seed.json to use {products: [...]} format with required source_url field
- Remove activate-workflows.js (replaced by CLI approach)
This commit is contained in:
Antoni Nuñez Romeu
2026-07-17 12:54:34 +02:00
parent 8a7ef81964
commit f6fc356c76
4 changed files with 54 additions and 128 deletions
+11 -4
View File
@@ -10,6 +10,11 @@ services:
POSTGRES_DB: farmafinder
POSTGRES_USER: farmafinder
POSTGRES_PASSWORD: ${PG_PASSWORD:-change-me-in-production}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U farmafinder"]
interval: 5s
timeout: 3s
retries: 5
volumes:
- postgres_data:/var/lib/postgresql/data
@@ -156,9 +161,12 @@ services:
- n8n_data:/home/node/.n8n
- ./n8n/workflows:/home/node/workflows
depends_on:
- postgres
postgres:
condition: service_healthy
n8n-init:
condition: service_completed_successfully
# --- N8N Init: import workflows, activate, and seed DB ---
# --- N8N Init: import + activate workflows BEFORE n8n starts, then seed DB ---
n8n-init:
image: n8nio/n8n:latest
entrypoint: ["/bin/sh", "/home/node/init-import.sh"]
@@ -174,10 +182,9 @@ services:
- n8n_data:/home/node/.n8n
- ./n8n/workflows:/home/node/workflows
- ./n8n/init-import.sh:/home/node/init-import.sh:ro
- ./n8n/activate-workflows.js:/home/node/activate-workflows.js:ro
- ./n8n/seed.json:/home/node/seed.json:ro
depends_on:
n8n:
postgres:
condition: service_healthy
parapharmacy-api:
condition: service_healthy