diff --git a/.env.example b/.env.example deleted file mode 100644 index e455aa6..0000000 --- a/.env.example +++ /dev/null @@ -1,10 +0,0 @@ -# n8n 访问端口(本机如果 5678 冲突就改成 5679/5680...) -N8N_PORT=5678 - -# 时区 -TZ=Asia/Shanghai - -# Postgres(默认即可) -POSTGRES_USER=n8n -POSTGRES_PASSWORD=n8npass -POSTGRES_DB=n8n \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0525e16..c75bd4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .env n8n-data/ postgres-data/ -.DS_Store \ No newline at end of file +.DS_Store +.idea \ No newline at end of file diff --git a/README.md b/README.md index 4335cac..3a7c3f7 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,6 @@ git clone <你的仓库地址> cd n8n-local -cp .env.example .env -# 如端口冲突,编辑 .env 修改 N8N_PORT=5679 - docker compose up -d docker compose ps ``` @@ -21,3 +18,4 @@ docker compose ps 备注: - 当前固定使用 `n8nio/n8n:2.2.4` - `postgres` 加了健康检查,`n8n` 会等待数据库就绪后再启动 +- Mac 上如果遇到 `Restarting (139)`,已在 `docker-compose.yml` 中加入 `platform: linux/amd64` 和 `user: "0:0"` diff --git a/docker-compose.yml b/docker-compose.yml index 6e73d36..4d363e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,14 +4,14 @@ services: container_name: n8n-postgres restart: unless-stopped environment: - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DB: ${POSTGRES_DB} - TZ: ${TZ} + POSTGRES_USER: n8n + POSTGRES_PASSWORD: n8npass + POSTGRES_DB: n8n + TZ: Asia/Shanghai volumes: - ./postgres-data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] + test: ["CMD-SHELL", "pg_isready -U n8n -d n8n"] interval: 10s timeout: 5s retries: 5 @@ -21,15 +21,18 @@ services: container_name: n8n restart: unless-stopped ports: - - "${N8N_PORT}:5678" + - "5678:5678" + # Mac 上如遇 `Restarting (139)` 可开启以下两项: + # platform: linux/amd64 + # user: "0:0" environment: DB_TYPE: postgresdb DB_POSTGRESDB_HOST: postgres DB_POSTGRESDB_PORT: 5432 - DB_POSTGRESDB_DATABASE: ${POSTGRES_DB} - DB_POSTGRESDB_USER: ${POSTGRES_USER} - DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD} - TZ: ${TZ} + DB_POSTGRESDB_DATABASE: n8n + DB_POSTGRESDB_USER: n8n + DB_POSTGRESDB_PASSWORD: n8npass + TZ: Asia/Shanghai volumes: - ./n8n-data:/home/node/.n8n depends_on: