Skip to content

The open alternative to Salesforce, designed for AI.

feat: add a docker-compose file for production (#4609)

Quentin Gaee6d49ea950
diff --git a/packages/twenty-docker/prod/.env.example b/packages/twenty-docker/prod/.env.example
new file mode 100644
index 00000000000..03628af3f81
--- /dev/null
+++ b/packages/twenty-docker/prod/.env.example
@@ -0,0 +1,16 @@
+TAG=latest
+
+POSTGRES_ADMIN_PASSWORD=replace_me_with_a_strong_password
+
+PG_DATABASE_HOST=db:5432
+
+SERVER_URL=http://localhost:3000
+# Uncoment if you are serving your front on another server than the API (eg. bucket)
+# FRONT_BASE_URL=http://localhost:3000
+
+# Use openssl rand -base64 32 for each secret
+# ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
+# LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
+# REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
+
+SIGN_IN_PREFILLED=true
diff --git a/packages/twenty-docker/prod/docker-compose.yml b/packages/twenty-docker/prod/docker-compose.yml
new file mode 100644
index 00000000000..887b820c31d
--- /dev/null
+++ b/packages/twenty-docker/prod/docker-compose.yml
@@ -0,0 +1,52 @@
+version: '3.8'
+name: twenty
+
+services:
+ server:
+ image: twentycrm/twenty:${TAG}
+ volumes:
+ - server-local-data:/app/.local-storage
+ ports:
+ - "3000:3000"
+ environment:
+ PORT: 3000
+ PG_DATABASE_URL: postgres://twenty:twenty@${PG_DATABASE_HOST}/default
+ SERVER_URL: ${SERVER_URL}
+ FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL}
+
+ ENABLE_DB_MIGRATIONS: true
+
+ SIGN_IN_PREFILLED: ${SIGN_IN_PREFILLED}
+ STORAGE_TYPE: local
+ STORAGE_LOCAL_PATH: .local-storage
+ ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET}
+ LOGIN_TOKEN_SECRET: ${LOGIN_TOKEN_SECRET}
+ REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET}
+ depends_on:
+ db:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD-SHELL", "curl --silent --fail http://localhost:3000/healthz | jq -e '.status == \"ok\"' > /dev/null || exit 1"]
+ interval: 5s
+ timeout: 5s
+ retries: 10
+ restart: always
+
+ db:
+ image: twentycrm/twenty-postgres:${TAG}
+ volumes:
+ - db-data:/var/lib/postgresql/data
+ environment:
+ POSTGRES_PASSWORD: ${POSTGRES_ADMIN_PASSWORD}
+ #POSTGRES_USER: ${POSTGRES_USER}
+ #POSTGRES_DB: ${POSTGRES_DB}
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U twenty -d default"]
+ interval: 5s
+ timeout: 5s
+ retries: 10
+ restart: always
+
+volumes:
+ db-data:
+ server-local-data: