diff --git a/n8n/n8n-ollama-stack.yaml b/n8n/n8n-ollama-stack.yaml new file mode 100644 index 0000000..8b98747 --- /dev/null +++ b/n8n/n8n-ollama-stack.yaml @@ -0,0 +1,93 @@ +services: + n8n_app: + image: n8nio/n8n:nightly + environment: + DB_TYPE: postgresdb + DB_POSTGRESDB_PORT: 5432 + DB_POSTGRESDB_HOST: db + DB_POSTGRESDB_DATABASE: n8n + DB_POSTGRESDB_USER: "automacao" + DB_POSTGRESDB_PASSWORD_FILE: "/run/secrets/postgres16" + N8N_ENCRYPTION_KEY: "/run/secrets/n8n_encryption" + N8N_HOST: n8n.omegaflow.com.br + N8N_EDITOR_BASE_URL: https://n8n.omegaflow.com.br/ + N8N_PROTOCOL: https + N8N_RUNNERS_ENABLED: 'true' + N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: 'true' + NODE_ENV: production + WEBHOOK_URL: https://n8n.omegaflow.com.br + EXECUTION_MODE: default + GENERIC_TIMEZONE: America/Sao_Paulo + EXECUTIONS_DATA_PRUNE: 'true' + EXECUTIONS_DATA_MAX_AGE: 336 + # Adicionando variáveis para o Ollama + OLLAMA_HOST: "http://ollama:11434" + OLLAMA_MODEL: "qwen2.5:1.5b" + secrets: + - postgres16 + - n8n_encryption + ports: + - "5678:5678" + deploy: + mode: replicated + replicas: 1 + placement: + constraints: + - node.role == manager + resources: + limits: + memory: 2048M + volumes: + - n8n_data:/home/node/.n8n + - n8n_backup:/backup + - n8n_shared:/data/shared + networks: + - postgres_network + - n8n_network + + ollama: + image: ollama/ollama:latest + container_name: ollama + environment: + OLLAMA_HOST: "0.0.0.0:11434" + + ports: + - "11434:11434" + volumes: + - ollama_data:/root/.ollama + networks: + - n8n_network + deploy: + mode: replicated + replicas: 1 + placement: + constraints: + - node.role == manager + restart_policy: + condition: on-failure +networks: + postgres_network: + driver: overlay + attachable: true + external: true + n8n_network: + driver: overlay + attachable: true + external: true + +secrets: + postgres16: + external: true + n8n_encryption: + external: true + +volumes: + n8n_data: + external: true + n8n_backup: + external: true + n8n_shared: + external: true + ollama_data: + external: true +