very basic docker compose for local setup of n8n and waha
- navigate to
http://localhost:11100/dashboard/ - retrive api key from Workers
- link your whatsapp account in default session and start it
| volumes: | |
| db_storage: | |
| n8n_storage: | |
| services: | |
| postgres: | |
| container_name: postgres | |
| image: postgres:16 | |
| restart: always | |
| environment: | |
| - POSTGRES_USER | |
| - POSTGRES_PASSWORD | |
| - POSTGRES_DB | |
| - POSTGRES_NON_ROOT_USER | |
| - POSTGRES_NON_ROOT_PASSWORD | |
| volumes: | |
| - ./db_data/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 | |
| n8n: | |
| container_name: 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} | |
| ports: | |
| - 5678:5678 | |
| links: | |
| - postgres | |
| extra_hosts: | |
| - "host.docker.internal:host-gateway" | |
| volumes: | |
| - n8n_storage:/home/node/.n8n | |
| depends_on: | |
| postgres: | |
| condition: service_healthy | |
| waha: | |
| image: devlikeapro/waha:latest | |
| container_name: waha | |
| restart: always | |
| ports: | |
| - '11100:3000' |
| #!/bin/bash | |
| set -e; | |
| if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then | |
| psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | |
| CREATE USER ${POSTGRES_NON_ROOT_USER} WITH PASSWORD '${POSTGRES_NON_ROOT_PASSWORD}'; | |
| GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_NON_ROOT_USER}; | |
| GRANT CREATE ON SCHEMA public TO ${POSTGRES_NON_ROOT_USER}; | |
| EOSQL | |
| else | |
| echo "SETUP INFO: No Environment variables given!" | |
| fi |
| POSTGRES_USER=postgres | |
| POSTGRES_PASSWORD=postgrespassword | |
| POSTGRES_DB=n8n | |
| POSTGRES_NON_ROOT_USER=n8nuser | |
| POSTGRES_NON_ROOT_PASSWORD=postgrespassword |