which is the best solution to selfhosted n8n? reddit / selfhosted ---------------------------------------------------------------------- roycorderov · 2023-11-29 00:02 hi folks i am starting to use n8n and i want to do some automations in my kommo crm and other things, but i have seen that there are several ways to install n8n in a self hosted way, so my question is for those who have n8n as self hosted services, which would be the best way to install it? \- docker without database? \- docker with database and which database would be better postgress or mysql? thanks ---------------------------------------------------------------------- SillyLilBear · 2023-11-29 00:44 docker w/ postgres, but really up to you. Either would be fine. ---------------------------------------------------------------------- adamshand · 2023-11-29 01:31 It's mostly just preference. If you are already familiar with MySQL or Postgres, use what you know. If you just want simple and lightweight, use it with SQLite (no external database). ---------------------------------------------------------------------- Sudden_Cheetah7530 · 2023-11-29 02:01 If you design an application, choosing database would be a big deal, but since you are the user, you can choose whatever you want. My go to is postgre though. ---------------------------------------------------------------------- subven1 · 2023-11-29 03:30 Cloudron (free tier - 2 apps). Get a server, install Cloudron, install n8n from the app store. Done. ---------------------------------------------------------------------- roycorderov · 2023-11-29 03:36 aa ok thanks ---------------------------------------------------------------------- roycorderov · 2023-11-29 03:39 I will create a lxc conteiner in my proxmox just for him so my question would be... which one would be more secure that it will not have problems in the future? for example that it is slower or easier to be damaged or lose information or that it lacks some feature, do you know what I mean? ---------------------------------------------------------------------- roycorderov · 2023-11-29 03:42 hehe thanks but i wanit to selfhosted in my local server to play whit it and make it work good for my business, Plus this way I won't have to pay for anything I already have. ---------------------------------------------------------------------- roycorderov · 2023-11-29 03:43 >I will create a lxc conteiner in my proxmox just for him so my question would be... which one would be more secure that it will not have problems in the future? for example that it is slower or easier to be damaged or lose information or that it lacks some feature, do you know what I mean? but ok i wil go with a database thanks! ---------------------------------------------------------------------- adamshand · 2023-11-29 03:58 Use SQLite. Easy to backup, no process taking up cpu/memory, no users to manage. ---------------------------------------------------------------------- roycorderov · 2023-11-29 04:02 thanks I will go for postgres database because of what I have been advised and additionally because I have been told that soon n8n will remove mysql/mariadb support. ---------------------------------------------------------------------- subven1 · 2023-11-29 05:41 Cloudron can be used on a rented server online or within your homelab. It is server management software that gives you all the tools and services you need to easily selfhost many FOSS. People often start with something like a Raspberry Pi, some Docker containers und Portainer. While this works out in short term, it is quite unpleasant and you have to do a lot to keep it alive long term. Cloudron makes all of that comfortable. ---------------------------------------------------------------------- roycorderov · 2023-11-29 05:46 Please, I'm struggling with the docker-compose with postgres to get my n8n up and running... so just copy the docker-compose from the doc and made changes for my needs, could you tell me if im doin it rigth? or should I change something? i want all data in: `/docker/n8n/` so root@13-n8n-RL23-WG /docker/n8n# nano .env `POSTGRES_USER=user-root` `POSTGRES_PASSWORD=password-root` `POSTGRES_DB=n8n` `POSTGRES_NON_ROOT_USER=user-nonroot` `POSTGRES_NON_ROOT_PASSWORD=password-nonroot` root@13-n8n-RL23-WG /docker/n8n# nano docker-compose.yml `version: '3.8'` `volumes:` `db_storage:` `n8n_storage:` `services:` `postgres:` `image: postgres:11` `restart: always` `environment:` `- POSTGRES_USER` `- POSTGRES_PASSWORD` `- POSTGRES_DB` `- POSTGRES_NON_ROOT_USER` `- POSTGRES_NON_ROOT_PASSWORD` `volumes:` `- /docker/n8n/postgresql/data:/var/lib/postgresql/data` `- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh` `healthcheck:` `test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']` `interval: 5s` `timeout: 5s` `retries: 10` `n8n:` `image: docker.n8n.io/n8nio/n8n` `restart: always` `environment:` `- DB_TYPE=postgresdb` `- DB_POSTGRESDB_HOST=postgres` `- DB_POSTGRESDB_PORT=5432` `- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}` `- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}` `- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}` `- WEBHOOK_URL=https://subdomain.wtf.org/` `- EXECUTIONS_PROCESS=main` `- GENERIC_TIMEZONE=America/La_Paz` `- TZ=America/La_Paz` `ports:` `- 5678:5678` `links:` `- postgres` `volumes:` `- /docker/n8n:/home/node/.n8n` `depends_on:` `postgres:` `condition: service_healthy` ---------------------------------------------------------------------- subven1 · 2023-11-29 06:49 And so it begins \^\^ ---------------------------------------------------------------------- Impressive-Self9135 · 2023-11-29 20:02 I wouldn't know if someone can help me. I have this has my Portainer Stack and all the variables configuration in the environment variables but while container works fine when first access, it reset when I edit the container or update and I have to create a new login. I discovered recently that while other containers works fine, the worker container wouldn't. I'm new to docker and container and would appreciate help This my docker-compose file ``` version: '3.8' volumes: db_storage: n8n_storage: redis_storage: x-shared: &shared restart: always environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=postgres - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=${POSTGRES_DB} - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER} - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD} - EXECUTIONS_MODE=queue - QUEUE_BULL_REDIS_HOST=redis - QUEUE_HEALTH_CHECK_ACTIVE=true - N8N_BASIC_AUTH_ACTIVE=true - N8N_BASIC_AUTH_USER - N8N_BASIC_AUTH_PASSWORD links: - postgres - redis volumes: - n8n_storage:/home/node/ depends_on: redis: condition: service_healthy postgres: condition: service_healthy services: postgres: image: postgres:11 restart: always environment: - POSTGRES_USER - POSTGRES_PASSWORD - POSTGRES_DB - POSTGRES_NON_ROOT_USER - POSTGRES_NON_ROOT_PASSWORD volumes: - db_storage:/var/lib/postgresql/data - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh healthcheck: test: ["CMD-SHELL", "pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 10 redis: image: redis:6-alpine restart: always volumes: - redis_storage:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 10 n8n: <<: *shared image: n8nio/n8n command: /bin/sh -c "n8n start --tunnel" ports: - 5678:5678 n8n-worker: <<: *shared image: n8nio/n8n command: /bin/sh -c "sleep 5; n8n worker" depends_on: - n8n ``` ---------------------------------------------------------------------- roycorderov · 2023-11-29 21:18 ok... I couldn't install docker with postgres so I did it with sql and that's it I hope I don't miss out in the future because I will have to look for someone to help me install it thanks friends