The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Added support for podman deployment (#11600)
thomasdn3ad110da33ea
diff --git a/packages/twenty-docker/k8s/README.md b/packages/twenty-docker/k8s/README.mdindex df1cde70978..d538d21ba07 100644--- a/packages/twenty-docker/k8s/README.md+++ b/packages/twenty-docker/k8s/README.md@@ -1,4 +1,7 @@# README+DISCLAIMER: The k8s and podman deployments are not maintained by the core team.+These files are provided and maintained by the community. Twenty core team+maintains support for docker deployment.## Overviewdiff --git a/packages/twenty-docker/podman/README.md b/packages/twenty-docker/podman/README.mdnew file mode 100644index 00000000000..91aa202c8e0--- /dev/null+++ b/packages/twenty-docker/podman/README.md@@ -0,0 +1,48 @@+# How to deploy twenty on podman++DISCLAIMER: The k8s and podman deployments are not maintained by the core team.+These files are provided and maintained by the community. Twenty core team+maintains support for docker deployment.+++## How to use++1. Edit `.env` file. At the minimum set `POSTGRES_PASSWORD`, `SERVER_URL`, and `APP_SECRET`.+2. Start twenty by running `podman-compose up -d`.++If you need to stop twenty, you can do so by running `podman-compose down`.+++### Install systemd service (optional)++If you want to install a systemd service to run twenty, you can use the provided systemd service.++Edit `twentycrm.service` and change these two variables:+++ WorkingDirectory=/opt/apps/twenty+ EnvironmentFile=/opt/apps/twenty/.env++`WorkingDirectory` should be changed to the path in which `podman-compose.yml` is located.++`EnvironmentFile` should be changed to the path in which your `.env`file is located.++You can run the script `install-systemd-user-service` to install the systemd service under the current user.+++ ./install-systemd-user-service++Note: this script will enable the service and also start it. So it will assume that twenty is not currently running.+If you started it previously, bring it down using:++ podman-compose down++++## Compatibility++These files should be compatible with podman 4.3+.++I have tested this on Debian GNU/Linux 12 (bookworm) and with the podman that is distributed with the official Debian stable mirrors (podman v4.3.1+ds1-8+deb12u1, podman-compose v1.0.3-3).++diff --git a/packages/twenty-docker/podman/install-systemd-user-service b/packages/twenty-docker/podman/install-systemd-user-servicenew file mode 100755index 00000000000..4e10ba116c1--- /dev/null+++ b/packages/twenty-docker/podman/install-systemd-user-service@@ -0,0 +1,11 @@+#!/bin/bash+set -e++mkdir -p ~/.config/systemd/user+[ -f twentycrm.service ] || { echo "Error: twentycrm.service not found"; exit 1; }+cp twentycrm.service ~/.config/systemd/user+++systemctl --user daemon-reload+systemctl --user enable twentycrm.service+systemctl --user start twentycrm.servicediff --git a/packages/twenty-docker/podman/manual-steps-to-deploy-twenty-on-podman b/packages/twenty-docker/podman/manual-steps-to-deploy-twenty-on-podmannew file mode 100644index 00000000000..beb979756b6--- /dev/null+++ b/packages/twenty-docker/podman/manual-steps-to-deploy-twenty-on-podman@@ -0,0 +1,71 @@+#!/bin/bash+set -e+if [ ! -f "$(dirname "$0")/.env" ]; then+ echo "Error: .env file not found"+ exit 1+fi+source "$(dirname "$0")/.env"++## steps to cleanup and start over from scratch - useful when testing+#podman pod stop twenty-pod+#podman pod rm twenty-pod+#podman volume rm twenty-db-data twenty-server-data twenty-redis-data+# end of cleanup++podman volume create twenty-db-data+podman volume create twenty-server-data+podman volume create twenty-redis-data++podman pod create --name twenty-pod -p 127.0.0.1:8080:3000++podman run -d --pod twenty-pod --name twenty-db \+ -e POSTGRES_DB=twenty \+ -e POSTGRES_USER=twenty \+ -e POSTGRES_PASSWORD="$POSTGRES_PASSWORD" \+ -v twenty-db-data:/var/lib/postgresql/data:Z \+ docker.io/library/postgres:16++podman run -d --pod twenty-pod --name twenty-redis \+ -v twenty-redis-data:/data:Z \+ docker.io/library/redis:latest++podman run -d --pod twenty-pod --name twenty-server \+ -e NODE_PORT=3000 \+ -e SERVER_URL="$SERVER_URL" \+ -e PG_DATABASE_URL="postgresql://twenty:$POSTGRES_PASSWORD@twenty-db:5432/twenty" \+ -e REDIS_URL="redis://twenty-redis:6379" \+ -e APP_SECRET="$APP_SECRET" \+ -e NODE_ENV=production \+ -e LOG_LEVEL=info \+ -v twenty-server-data:/app/docker-data:Z \+ docker.io/twentycrm/twenty:latest++podman run -d --pod twenty-pod --name twenty-worker \+ --init \+ -e SERVER_URL="$SERVER_URL" \+ -e PG_DATABASE_URL="postgresql://twenty:$POSTGRES_PASSWORD@twenty-db:5432/twenty" \+ -e REDIS_URL="redis://twenty-redis:6379" \+ -e APP_SECRET="$APP_SECRET" \+ -e DISABLE_DB_MIGRATIONS=true \+ -e NODE_ENV=production \+ -e LOG_LEVEL=info \+ -v twenty-server-data:/app/docker-data:Z \+ docker.io/twentycrm/twenty:latest \+ yarn worker:prod++# wait some time, check status+sleep 30+podman ps --pod -f name=twenty-pod+++mkdir -p ~/.config/systemd/user+if [ ! -f "twentycrm.service" ]; then+ echo "Error: twentycrm.service file not found"+ exit 1+fi+cp twentycrm.service ~/.config/systemd/user++systemctl --user daemon-reload+systemctl --user enable twentycrm.service+systemctl --user start twentycrm.service+diff --git a/packages/twenty-docker/podman/podman-compose.yml b/packages/twenty-docker/podman/podman-compose.ymlnew file mode 100644index 00000000000..826e1e96262--- /dev/null+++ b/packages/twenty-docker/podman/podman-compose.yml@@ -0,0 +1,55 @@+version: "3.8"++services:+ db:+ container_name: twenty-db+ image: postgres:16+ environment:+ POSTGRES_DB: twenty+ POSTGRES_USER: twenty+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}+ volumes:+ - twenty-db-data:/var/lib/postgresql/data:Z++ redis:+ container_name: twenty-redis+ image: redis:latest+ volumes:+ - twenty-redis-data:/data:Z++ server:+ container_name: twenty-server+ image: twentycrm/twenty:latest+ environment:+ NODE_PORT: "3000"+ SERVER_URL: ${SERVER_URL}+ PG_DATABASE_URL: "postgresql://twenty:${POSTGRES_PASSWORD}@twenty-db:5432/twenty"+ REDIS_URL: "redis://twenty-redis:6379"+ APP_SECRET: ${APP_SECRET}+ NODE_ENV: production+ LOG_LEVEL: info+ volumes:+ - twenty-server-data:/app/docker-data:Z+ ports:+ - 127.0.0.1:8080:3000++ worker:+ container_name: twenty-worker+ image: twentycrm/twenty:latest+ command: yarn worker:prod+ environment:+ SERVER_URL: ${SERVER_URL}+ PG_DATABASE_URL: "postgresql://twenty:${POSTGRES_PASSWORD}@twenty-db:5432/twenty"+ REDIS_URL: "redis://twenty-redis:6379"+ APP_SECRET: ${APP_SECRET}+ DISABLE_DB_MIGRATIONS: "true"+ NODE_ENV: production+ LOG_LEVEL: info+ volumes:+ - twenty-server-data:/app/docker-data:Z+ init: true++volumes:+ twenty-db-data:+ twenty-server-data:+ twenty-redis-data:diff --git a/packages/twenty-docker/podman/twentycrm.service b/packages/twenty-docker/podman/twentycrm.servicenew file mode 100644index 00000000000..5364993897d--- /dev/null+++ b/packages/twenty-docker/podman/twentycrm.service@@ -0,0 +1,15 @@+[Unit]+Description=TwentyCRM Container Stack via Podman-Compose+After=network.target++[Service]+Type=simple+WorkingDirectory=/opt/apps/twenty+EnvironmentFile=/opt/apps/twenty/.env+ExecStart=/usr/bin/podman-compose -f podman-compose.yml up -d+ExecStop=/usr/bin/podman-compose -f podman-compose.yml down+RemainAfterExit=yes++[Install]+WantedBy=default.target+