Subir archivos a "docs"
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
# ☁️ Instalación de n8n en Google Cloud VM
|
||||
|
||||
> ← [Anterior: 🪟 WSL2](./01-wsl2-n8n.md) | [Volver al índice](../README.md) | Siguiente: [🔐 HTTPS →](./03-https-nginx.md)
|
||||
|
||||
---
|
||||
|
||||
## Requisitos previos
|
||||
|
||||
- Cuenta en [Google Cloud Console](https://console.cloud.google.com/)
|
||||
- Proyecto activo con facturación habilitada
|
||||
- `gcloud` CLI instalado *(opcional, también se puede hacer desde la web)*
|
||||
|
||||
---
|
||||
|
||||
## Paso 1 — Crear la VM en Google Cloud
|
||||
|
||||
1. Ingresa a [Google Cloud Console](https://console.cloud.google.com/).
|
||||
2. Ve a **Compute Engine > VM Instances**.
|
||||
3. Haz clic en **Create Instance** y configura:
|
||||
|
||||
| Campo | Valor recomendado |
|
||||
|-------|------------------|
|
||||
| **Nombre** | `n8n-vm` |
|
||||
| **Región/Zona** | La más cercana a tu ubicación |
|
||||
| **Machine type** | `e2-medium` (2 vCPU, 4 GB RAM) |
|
||||
| **Boot disk** | Ubuntu 24.04 LTS |
|
||||
| **Firewall** | ✅ Allow HTTP traffic / ✅ Allow HTTPS traffic |
|
||||
|
||||
4. Haz clic en **Create**.
|
||||
|
||||
---
|
||||
|
||||
## Paso 2 — Conectarse a la VM
|
||||
|
||||
Desde la consola o terminal:
|
||||
|
||||
```bash
|
||||
gcloud compute ssh n8n-vm --zone us-central1-a
|
||||
```
|
||||
|
||||
También puedes usar el botón **SSH** directamente desde la consola web de GCP.
|
||||
|
||||
---
|
||||
|
||||
## Paso 3 — Actualizar paquetes
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Paso 4 — Instalar dependencias y n8n
|
||||
|
||||
```bash
|
||||
# Instalar NVM
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||
|
||||
# Recargar bash
|
||||
source ~/.bashrc
|
||||
|
||||
# Instalar Node.js LTS
|
||||
nvm install --lts
|
||||
|
||||
# Verificar versiones
|
||||
node -v
|
||||
npm -v
|
||||
|
||||
# Instalar n8n
|
||||
npm install -g n8n@latest
|
||||
|
||||
# Ejecutar n8n
|
||||
n8n
|
||||
```
|
||||
|
||||
n8n quedará escuchando en el puerto **5678** por defecto.
|
||||
|
||||
---
|
||||
|
||||
## Paso 5 — Abrir puertos en el firewall de Google Cloud
|
||||
|
||||
### Opción A: Desde la consola web
|
||||
|
||||
1. Ve a **VPC Network > Firewall**.
|
||||
2. Clic en **Create Firewall Rule** y configura:
|
||||
|
||||
| Campo | Valor |
|
||||
|-------|-------|
|
||||
| **Name** | `allow-n8n` |
|
||||
| **Targets** | All instances in the network |
|
||||
| **Source IP ranges** | `0.0.0.0/0` *(o tu IP para mayor seguridad)* |
|
||||
| **Protocols/Ports** | TCP: `80, 443, 5678` |
|
||||
|
||||
### Opción B: Con gcloud CLI
|
||||
|
||||
```bash
|
||||
gcloud compute firewall-rules create allow-n8n \
|
||||
--allow tcp:80,tcp:443,tcp:5678 \
|
||||
--source-ranges=0.0.0.0/0 \
|
||||
--target-tags=n8n-server
|
||||
```
|
||||
|
||||
Luego edita tu VM y en **Network tags** agrega `n8n-server`.
|
||||
|
||||
---
|
||||
|
||||
## Paso 6 — Acceder a n8n
|
||||
|
||||
Abre en tu navegador:
|
||||
|
||||
👉 `http://EXTERNAL_IP:5678`
|
||||
|
||||
*(La IP externa está visible en la consola de GCP)*
|
||||
|
||||
---
|
||||
|
||||
## Paso 7 (Opcional) — Ejecutar n8n en segundo plano con PM2
|
||||
|
||||
Sin PM2, n8n se detiene al cerrar la sesión SSH.
|
||||
|
||||
```bash
|
||||
npm install -g pm2
|
||||
|
||||
pm2 start n8n
|
||||
pm2 save
|
||||
pm2 startup
|
||||
```
|
||||
|
||||
PM2 se asegura de que n8n se reinicie automáticamente tras reinicios de la VM.
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Nota de seguridad
|
||||
|
||||
> No expongas el puerto `5678` directamente en producción. Lo ideal es configurar un **proxy inverso con Nginx + SSL**.
|
||||
> Consulta el siguiente paso: [🔐 Habilitar HTTPS](./03-https-nginx.md)
|
||||
|
||||
---
|
||||
|
||||
> ← [Anterior: 🪟 WSL2](./01-wsl2-n8n.md) | [Volver al índice](../README.md) | Siguiente: [🔐 HTTPS →](./03-https-nginx.md)
|
||||
Reference in New Issue
Block a user