Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
es:linux:n8n:installation_compose [2023/11/17 01:37] – Automatic translation 65.108.67.8 | es:linux:n8n:installation_compose [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Instalación de n8n con Docker Compose ====== | ||
- | Instalación de n8n con Docker Compose, certificado Let's Encrypt [[wpde> | ||
- | |||
- | ===== 1ª instalación de Docker (Debian) ===== | ||
- | |||
- | ==== 1.1 Desinstalar versiones antiguas ==== | ||
- | |||
- | <code bash> | ||
- | sudo apt-get remove docker docker-engine docker.io containerd runc | ||
- | </ | ||
- | |||
- | ==== 1.2 Instalación de repositorios ==== | ||
- | |||
- | === 1.2.1 Actualizar apt y activar HTTPS === | ||
- | |||
- | <code bash> | ||
- | sudo apt-get update | ||
- | |||
- | sudo apt-get install \ | ||
- | ca-certificates \ | ||
- | curl \ | ||
- | gnupg \ | ||
- | lsb-release | ||
- | | ||
- | sudo mkdir -m 0755 -p / | ||
- | curl -fsSL https:// | ||
- | echo \ | ||
- | "deb [arch=$(dpkg --print-architecture) signed-by=/ | ||
- | $(lsb_release -cs) stable" | ||
- | </ | ||
- | | ||
- | === 1.2.2 Añadir clave GPG de Docker === | ||
- | |||
- | <code bash> | ||
- | sudo mkdir -m 0755 -p / | ||
- | curl -fsSL https:// | ||
- | </ | ||
- | |||
- | === 1.2.3 Configuración del repositorio === | ||
- | |||
- | <code bash> | ||
- | echo \ | ||
- | "deb [arch=$(dpkg --print-architecture) signed-by=/ | ||
- | $(lsb_release -cs) stable" | ||
- | </ | ||
- | |||
- | ==== 1.3 Instalar el motor Docker ==== | ||
- | |||
- | <code bash> | ||
- | sudo apt-get update | ||
- | sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
- | </ | ||
- | |||
- | ===== 2. Instalar Docker Compose ===== | ||
- | |||
- | <code bash> | ||
- | sudo apt-get install docker-compose-plugin | ||
- | </ | ||
- | |||
- | ===== 3. Entrada DNS ===== | ||
- | |||
- | <code bash> | ||
- | Type: A | ||
- | Name: n8n | ||
- | IP address: < | ||
- | </ | ||
- | |||
- | ===== 4. crear archivo Docker Compose ===== | ||
- | |||
- | < | ||
- | |||
- | ==== 4.1 Desafío HTTP-01 (Puerto TLS estándar 443) ==== | ||
- | |||
- | < | ||
- | <code bash> | ||
- | version: " | ||
- | |||
- | services: | ||
- | traefik: | ||
- | image: " | ||
- | restart: always | ||
- | command: | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | ports: | ||
- | - " | ||
- | - " | ||
- | volumes: | ||
- | - ${DATA_FOLDER}/ | ||
- | - / | ||
- | |||
- | n8n: | ||
- | image: n8nio/n8n | ||
- | restart: always | ||
- | ports: | ||
- | - " | ||
- | labels: | ||
- | - traefik.enable=true | ||
- | - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`) | ||
- | - traefik.http.routers.n8n.tls=true | ||
- | - traefik.http.routers.n8n.entrypoints=web, | ||
- | - traefik.http.routers.n8n.tls.certresolver=mytlschallenge | ||
- | - traefik.http.middlewares.n8n.headers.SSLRedirect=true | ||
- | - traefik.http.middlewares.n8n.headers.STSSeconds=315360000 | ||
- | - traefik.http.middlewares.n8n.headers.browserXSSFilter=true | ||
- | - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true | ||
- | - traefik.http.middlewares.n8n.headers.forceSTSHeader=true | ||
- | - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME} | ||
- | - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true | ||
- | - traefik.http.middlewares.n8n.headers.STSPreload=true | ||
- | - traefik.http.routers.n8n.middlewares=n8n@docker | ||
- | environment: | ||
- | - N8N_BASIC_AUTH_ACTIVE=true | ||
- | - N8N_BASIC_AUTH_USER | ||
- | - N8N_BASIC_AUTH_PASSWORD | ||
- | - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME} | ||
- | - N8N_PORT=5678 | ||
- | - N8N_PROTOCOL=https | ||
- | - NODE_ENV=production | ||
- | - WEBHOOK_URL=https:// | ||
- | - GENERIC_TIMEZONE=${GENERIC_TIMEZONE} | ||
- | # this section reduces the database size and speed up performance, | ||
- | - EXECUTIONS_DATA_SAVE_ON_ERROR=all | ||
- | - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none | ||
- | - EXECUTIONS_DATA_SAVE_ON_PROGRESS=true | ||
- | - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false | ||
- | - EXECUTIONS_DATA_PRUNE=true | ||
- | - EXECUTIONS_DATA_MAX_AGE=336 | ||
- | - EXECUTIONS_DATA_PRUNE_MAX_COUNT=50000 | ||
- | - DB_SQLITE_VACUUM_ON_STARTUP=true | ||
- | volumes: | ||
- | - ${DATA_FOLDER}/ | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ==== 4.2 Desafío DNS-01 (Puertos TLS alternativos) ==== | ||
- | |||
- | El proveedor [[wpde> | ||
- | |||
- | < | ||
- | <code bash> | ||
- | version: " | ||
- | |||
- | services: | ||
- | traefik: | ||
- | image: " | ||
- | restart: always | ||
- | command: | ||
- | #- " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | #- " | ||
- | - " | ||
- | - " | ||
- | ports: | ||
- | - " | ||
- | - " | ||
- | environment: | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | - " | ||
- | volumes: | ||
- | - ${DATA_FOLDER}/ | ||
- | - / | ||
- | |||
- | n8n: | ||
- | image: n8nio/n8n | ||
- | restart: always | ||
- | ports: | ||
- | - " | ||
- | labels: | ||
- | - traefik.enable=true | ||
- | - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`) | ||
- | - traefik.http.routers.n8n.tls=true | ||
- | - traefik.http.routers.n8n.entrypoints=web, | ||
- | - traefik.http.routers.n8n.tls.certresolver=myresolver | ||
- | - traefik.http.middlewares.n8n.headers.SSLRedirect=true | ||
- | - traefik.http.middlewares.n8n.headers.STSSeconds=315360000 | ||
- | - traefik.http.middlewares.n8n.headers.browserXSSFilter=true | ||
- | - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true | ||
- | - traefik.http.middlewares.n8n.headers.forceSTSHeader=true | ||
- | - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME} | ||
- | - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true | ||
- | - traefik.http.middlewares.n8n.headers.STSPreload=true | ||
- | - traefik.http.routers.n8n.middlewares=n8n@docker | ||
- | environment: | ||
- | - N8N_BASIC_AUTH_ACTIVE=true | ||
- | - N8N_BASIC_AUTH_USER | ||
- | - N8N_BASIC_AUTH_PASSWORD | ||
- | - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME} | ||
- | - N8N_PORT=5678 | ||
- | - N8N_PROTOCOL=https | ||
- | - NODE_ENV=production | ||
- | - WEBHOOK_URL=https:// | ||
- | - GENERIC_TIMEZONE=${GENERIC_TIMEZONE} | ||
- | # this section reduces the database size and speed up performance, | ||
- | - EXECUTIONS_DATA_SAVE_ON_ERROR=all | ||
- | - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none | ||
- | - EXECUTIONS_DATA_SAVE_ON_PROGRESS=true | ||
- | - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false | ||
- | - EXECUTIONS_DATA_PRUNE=true | ||
- | - EXECUTIONS_DATA_MAX_AGE=336 | ||
- | - EXECUTIONS_DATA_PRUNE_MAX_COUNT=50000 | ||
- | - DB_SQLITE_VACUUM_ON_STARTUP=true | ||
- | #- N8N_LOG_LEVEL=debug | ||
- | #- N8N_LOG_OUTPUT=console | ||
- | volumes: | ||
- | - ${DATA_FOLDER}/ | ||
- | </ | ||
- | </ | ||
- | |||
- | ===== 5. crear archivo .env ===== | ||
- | |||
- | < | ||
- | |||
- | <code bash> | ||
- | # Folder where data should be saved | ||
- | DATA_FOLDER=/ | ||
- | |||
- | # The top level domain to serve from | ||
- | DOMAIN_NAME=example.com | ||
- | |||
- | # The subdomain to serve from | ||
- | SUBDOMAIN=n8n | ||
- | |||
- | # DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from | ||
- | # above example would result in: https:// | ||
- | |||
- | # The user name to use for authentication - IMPORTANT ALWAYS CHANGE! | ||
- | N8N_BASIC_AUTH_USER=user | ||
- | |||
- | # The password to use for authentication - IMPORTANT ALWAYS CHANGE! | ||
- | N8N_BASIC_AUTH_PASSWORD=password | ||
- | |||
- | # Optional timezone to set which gets used by Cron-Node by default | ||
- | # If not set New York time will be used | ||
- | GENERIC_TIMEZONE=Europe/ | ||
- | |||
- | # The email address to use for the SSL certificate creation | ||
- | SSL_EMAIL=user@example.com | ||
- | </ | ||
- | |||
- | ===== 6. crear directorio de datos ===== | ||
- | |||
- | <code bash> | ||
- | mkdir / | ||
- | </ | ||
- | |||
- | ===== 7. iniciar y detener ===== | ||
- | |||
- | ==== 7.1 Arranque ==== | ||
- | |||
- | <code bash> | ||
- | sudo docker compose up -d | ||
- | </ | ||
- | |||
- | === 7.1.1 Inicio con salida === | ||
- | |||
- | <code bash> | ||
- | sudo docker compose up | ||
- | </ | ||
- | |||
- | ==== 7.2 Parada ==== | ||
- | |||
- | <code bash> | ||
- | sudo docker compose stop | ||
- | </ | ||
- | |||
- | ===== 8 Actualización ===== | ||
- | |||
- | ==== 8.1 Actualizar imagen ==== | ||
- | |||
- | <code bash> | ||
- | docker pull n8nio/n8n | ||
- | </ | ||
- | |||
- | ==== 8.2 Reiniciar ==== | ||
- | |||
- | <code bash> | ||
- | # Stop current setup | ||
- | sudo docker compose stop | ||
- | # Delete it (will only delete the docker-containers, | ||
- | sudo docker compose rm | ||
- | # Then start it again, in ingteractive mode to check for errors | ||
- | sudo docker compose up | ||
- | </ | ||
- | |||
- | Si todo funciona sin errores, finalice el proceso con CTRL+C e inícielo en modo demonio | ||
- | |||
- | <code bash> | ||
- | sudo docker compose up -d | ||
- | </ |