n8n 설정 부분 수정

This commit is contained in:
mcchae committed 2026-10-13 20:26:54 +09:00
1 parent 1b712e25fd
commit e0987c02ce
3 files changed
+72 -32

No files matched your search

+13 -22
View File
@@ -1,35 +1,26 @@
# n8n (LLM: OpenAI API, key from Last3Mon/.env via register-credentials.sh) + Ollama as the fallback.
# docker compose up -d (run from this folder)
# n8n editor : http://localhost:5678
# Ollama API : http://localhost:11434 (n8n uses http://ollama:11434 inside the network)
# Course stack for days 65-79: the official n8n one-line setup + Ollama (fallback LLM).
#
# 1) Install n8n once with the official script, into ~/day65-n8n (the folder name becomes the
# Docker project name, so the network stays day65-n8n_default for the day 67+ data APIs):
# cd ~ && curl -fsSL https://get.n8n.io | N8N_DIR=./day65-n8n sh -s -- --version 2.42.6
# 2) From this folder, run everything together:
# docker compose up -d (start / stop / ps / logs n8n / exec ollama ... as usual)
#
# This file includes ~/day65-n8n/compose.yml (n8n, task runners, sandbox, search) as written by the
# script, and adds Ollama. n8n reaches Ollama at http://ollama:11434; WSL programs use localhost:11434.
name: day65-n8n
services:
n8n:
image: docker.n8n.io/n8nio/n8n:2.42.6
ports:
- "5678:5678"
environment:
- GENERIC_TIMEZONE=Asia/Seoul
- TZ=Asia/Seoul
- N8N_SECURE_COOKIE=false
volumes:
- n8n-data:/home/node/.n8n
- ./workflows:/home/node/workflows:ro
depends_on:
- ollama
restart: unless-stopped
include:
- path: ${N8N_HOME:-../../../../day65-n8n}/compose.yml
services:
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
# Reuse the models downloaded on day 64 by setting OLLAMA_DATA in .env
# (default: a new Docker volume, then run: docker compose exec ollama ollama pull gemma3:4b)
- ${OLLAMA_DATA:-ollama-data}:/root/.ollama
restart: unless-stopped
volumes:
n8n-data:
ollama-data:
+4 -1
View File
@@ -2,6 +2,7 @@
# Register the course credentials in n8n from the .env file, so the API key is never typed into
# a workflow or committed to git.
# cd Last3Mon/65/n8n && docker compose up -d && bash register-credentials.sh
# N8N_CONTAINER=<name> if your n8n container has another name (docker ps).
#
# Creates (or updates) two credentials with fixed ids that the course workflows already use:
# OpenAI (.env) id openAiCourse0001 <- OPENAI_API_KEY (and OPENAI_BASE_URL if set)
@@ -39,7 +40,9 @@ fi
credentials=$(printf '[{"id":"openAiCourse0001","name":"OpenAI (.env)","type":"openAiApi","data":{"apiKey":"%s","url":"%s"}},{"id":"ollamaLocal0001","name":"Ollama local","type":"ollamaApi","data":{"baseUrl":"http://ollama:11434"}}]' "$key" "$base_url")
# The JSON goes through stdin into a temporary file inside the container, then is deleted.
printf '%s' "$credentials" | docker compose exec -T n8n sh -c \
container="${N8N_CONTAINER:-day65-n8n-n8n-1}"
docker inspect "$container" >/dev/null 2>&1 || { echo "n8n container '$container' not found. Start n8n first: cd Last3Mon/65/n8n && docker compose up -d" >&2; exit 1; }
printf '%s' "$credentials" | docker exec -i "$container" sh -c \
'cat > /tmp/course-credentials.json && n8n import:credentials --input=/tmp/course-credentials.json; status=$?; rm -f /tmp/course-credentials.json; exit $status'
echo "Registered 'OpenAI (.env)' and 'Ollama local' from $env_file"