Skip to content

Instantly share code, notes, and snippets.

@vzarytovskii
Last active February 3, 2025 13:58
Show Gist options
  • Save vzarytovskii/1dd6ef97878c517a9af529a491c4fdf5 to your computer and use it in GitHub Desktop.
Save vzarytovskii/1dd6ef97878c517a9af529a491c4fdf5 to your computer and use it in GitHub Desktop.
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB_HOST=postgres
POSTGRES_DB_PORT=5432
POSTGRES_DATABASES=langflow,n8n,windmill
POSTGRES_DB_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_DB_HOST}:${POSTGRES_DB_PORT}/
LANGFLOW_DATABASE_URL=${POSTGRES_DB_URL}langflow
WINDMILL_DATABASE_URL=${POSTGRES_DB_URL}windmill
WM_IMAGE=ghcr.io/windmill-labs/windmill:main
{
layer4 {
:25 {
proxy {
to windmill_server:2525
}
}
}
}
{$BASE_URL} {
bind {$ADDRESS}
reverse_proxy /ws/* http://lsp:3001
reverse_proxy /* http://windmill_server:8000
}
services:
postgres:
image: pgvector/pgvector:pg17
restart: always
container_name: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DATABASES: ${POSTGRES_DATABASES}
ports:
- "5432:5432"
volumes:
- postgres:/var/lib/postgresql/data
- .:/docker-entrypoint-initdb.d
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER}']
interval: 5s
timeout: 5s
retries: 10
langflow:
extra_hosts:
- "host.docker.internal:host-gateway"
image: langflowai/langflow:latest
pull_policy: always
restart: always
ports:
- "7860:7860"
depends_on:
postgres:
condition: service_healthy
environment:
LANGFLOW_DATABASE_URL: ${LANGFLOW_DATABASE_URL}
PGVECTOR_URL: ${POSTGRES_DB_URL}
volumes:
- langflow-data:/app/langflow
n8n:
extra_hosts:
- "host.docker.internal:host-gateway"
image: n8nio/n8n
pull_policy: always
restart: always
ports:
- "5678:5678"
depends_on:
postgres:
condition: service_healthy
environment:
DB_TYPE: postgresdb
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_HOST: ${POSTGRES_DB_HOST}
DB_POSTGRESDB_PORT: ${POSTGRES_DB_PORT}
DB_POSTGRESDB_USER: ${POSTGRES_USER}
DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- n8n-data:/home/node/.n8n
windmill_server:
extra_hosts:
- "host.docker.internal:host-gateway"
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 1
restart: unless-stopped
expose:
- 8000
- 2525
environment:
- DATABASE_URL=${WINDMILL_DATABASE_URL}
- MODE=server
depends_on:
postgres:
condition: service_healthy
volumes:
- worker_logs:/tmp/windmill/logs
windmill_worker:
extra_hosts:
- "host.docker.internal:host-gateway"
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 1
resources:
limits:
cpus: "1"
memory: 2048M
restart: unless-stopped
environment:
- DATABASE_URL=${WINDMILL_DATABASE_URL}
- MODE=worker
- WORKER_GROUP=default
depends_on:
postgres:
condition: service_healthy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- worker_dependency_cache:/tmp/windmill/cache
- worker_logs:/tmp/windmill/logs
windmill_worker_native:
extra_hosts:
- "host.docker.internal:host-gateway"
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 1
resources:
limits:
cpus: "1"
memory: 2048M
# for GB, use syntax '2Gi'
restart: unless-stopped
environment:
- DATABASE_URL=${WINDMILL_DATABASE_URL}
- MODE=worker
- WORKER_GROUP=native
- NUM_WORKERS=8
- SLEEP_QUEUE=200
depends_on:
postgres:
condition: service_healthy
volumes:
- worker_logs:/tmp/windmill/logs
lsp:
image: ghcr.io/windmill-labs/windmill-lsp:latest
pull_policy: always
restart: unless-stopped
expose:
- 3001
volumes:
- lsp_cache:/pyls/.cache
caddy:
image: ghcr.io/windmill-labs/caddy-l4:latest
restart: unless-stopped
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
ports:
- 8000:80
- 25:25
# - 443:443 # Uncomment to enable HTTPS handling by Caddy
environment:
- BASE_URL=":8000"
volumes:
postgres: null
langflow-data: null
n8n-data: null
worker_dependency_cache: null
worker_logs: null
windmill_index: null
lsp_cache: null
caddy_data: null
#!/bin/bash
set -e
set -u
function create_user_and_database() {
local database=$1
echo " Creating user and database '$database'"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE DATABASE $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER;
EOSQL
}
if [ -n "$POSTGRES_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_DATABASES"
for db in $(echo $POSTGRES_DATABASES | tr ',' ' '); do
create_user_and_database "$db"
done
echo "Multiple databases created"
else
echo "No databases to create."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment