Skip to content

Instantly share code, notes, and snippets.

@kuldar
Created March 5, 2025 11:42
Show Gist options
  • Save kuldar/1cdfb6a5cded1109c60ba521bd139b51 to your computer and use it in GitHub Desktop.
Save kuldar/1cdfb6a5cded1109c60ba521bd139b51 to your computer and use it in GitHub Desktop.
# documentation: https://twenty.com/developers/section/self-hosting/docker-compose
# slogan: Twenty is a CRM designed to fit your unique business needs.
# tags: crm, self-hosted, dashboard
# logo: svgs/twenty.svg
# port: 3000
services:
change-vol-ownership:
image: ubuntu
user: root
restart: "no"
exclude_from_hc: true
volumes:
- server-local-data:/tmp/server-local-data
- docker-data:/tmp/docker-data
command: >
bash -c "
chown -R 1000:1000 /tmp/server-local-data &&
chown -R 1000:1000 /tmp/docker-data &&
echo 'Volume ownership changed successfully'"
server:
image: twentycrm/twenty:${TWENTY_VERSION:-latest}
volumes:
- server-local-data:/app/packages/twenty-server/.local-storage
- docker-data:/app/docker-data
environment:
- SERVICE_FQDN_SERVER_3000
- NODE_PORT=3000
- PG_DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db:5432/default
- FRONTEND_URL=$SERVICE_FQDN_SERVER
- SERVER_URL=$SERVICE_FQDN_SERVER
- REDIS_URL=redis://redis:6379
# Required setting for successful startup
- SIGN_IN_PREFILLED=true
# Storage configuration
- STORAGE_TYPE=${STORAGE_TYPE:-local}
- STORAGE_S3_REGION=${STORAGE_S3_REGION}
- STORAGE_S3_NAME=${STORAGE_S3_NAME}
- STORAGE_S3_ENDPOINT=${STORAGE_S3_ENDPOINT}
# Security
- APP_SECRET=$SERVICE_BASE64_32_SECRET
depends_on:
change-vol-ownership:
condition: service_completed_successfully
db:
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:3000/healthz || exit 1
interval: 10s
timeout: 5s
retries: 30
start_period: 40s
worker:
image: twentycrm/twenty:${TWENTY_VERSION:-latest}
command: ["yarn", "worker:prod"]
volumes:
- server-local-data:/app/packages/twenty-server/.local-storage
- docker-data:/app/docker-data
environment:
- PG_DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db:5432/default
- SERVER_URL=$SERVICE_FQDN_SERVER
- REDIS_URL=redis://redis:6379
- DISABLE_DB_MIGRATIONS=true
# Storage configuration
- STORAGE_TYPE=${STORAGE_TYPE:-local}
- STORAGE_S3_REGION=${STORAGE_S3_REGION}
- STORAGE_S3_NAME=${STORAGE_S3_NAME}
- STORAGE_S3_ENDPOINT=${STORAGE_S3_ENDPOINT}
# Security
- APP_SECRET=$SERVICE_BASE64_32_SECRET
depends_on:
db:
condition: service_healthy
server:
condition: service_healthy
db:
image: postgres:16
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES
healthcheck:
test: pg_isready -U postgres -h localhost -d default
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
volumes:
db-data:
redis-data:
server-local-data:
docker-data:
@ConnorCyborg
Copy link

The first one that worked, thanks

@gbissland
Copy link

Worked great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment