VPS Tutorials
Self-host scheduling: Cal.diy labs and Cal.com deployment limits
Build a personal Cal.diy scheduling lab with Docker, PostgreSQL and Caddy. Understand the community edition's non-production recommendation and removed enterprise features, then configure SMTP, calendar OAuth, event time zones, private ports and tested recovery.

Self-hosted scheduling can give you control over appointment data, your domain and email integration. It also makes you responsible for PostgreSQL, OAuth credentials, notifications, backups and upgrades. Hosting costs and feature licenses still matter when comparing it with a managed service.
Choose the edition first. As checked November 16, 2026, the public Cal.com repository is Cal.diy, an MIT-licensed community fork. Its maintainers recommend personal, non-production use and state that Teams, Organizations, Insights, Workflows and SSO/SAML enterprise features were removed. This guide treats Cal.diy as a personal lab. Team/round-robin and business deployment requirements below apply only to an edition that actually supports and licenses them, such as an appropriate Cal.com offering.
The Ubuntu 24.04, Docker Compose, PostgreSQL and Caddy layout is useful for learning. These resource budgets are examples, not a production endorsement of Cal.diy:
| Resource | Lab example | Capacity example for a supported business deployment |
|---|---|---|
| CPU | 2 vCPU | 4 vCPU or more |
| RAM | 2 GB; builds may need more | 4 GB or more, then measure |
| Disk | 30 GB SSD | 60 GB SSD or more |
| Host | Ubuntu 22.04/24.04 | Ubuntu 24.04 LTS |
| Domain | cal.example.com | Dedicated scheduling subdomain |
Set valid A/AAAA records and open only needed management and public 80/443 ports in the provider firewall. PostgreSQL stays private. Check free -h, df -h and docker stats when sharing a server; see VPS sizing.
sudo apt update
sudo apt install -y ca-certificates curl openssl
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker "$USER"
newgrp docker
sudo mkdir -p /opt/calcom
sudo chown -R "$USER":"$USER" /opt/calcom
cd /opt/calcom
Review the root-level convenience installer or use the supported package method. Docker membership grants powerful host access.
openssl rand -hex 32
openssl rand -base64 32
These commands generate random material, but do not use an arbitrary output for every setting. The current Cal.diy README specifies openssl rand -base64 32 for NEXTAUTH_SECRET and openssl rand -base64 24 for CALENDSO_ENCRYPTION_KEY, producing the required 32-character key for that configuration. Preserve the encryption key across restarts and recovery.
The older service sketch below uses calcom/cal.com and is not a verified current Cal.diy image/template:
services:
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: calcom
POSTGRES_USER: calcom
POSTGRES_PASSWORD: change-a-long-password
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U calcom -d calcom"]
interval: 10s
timeout: 5s
retries: 10
calcom:
image: calcom/cal.com:latest
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://calcom:change-a-long-password@db:5432/calcom
NEXT_PUBLIC_WEBAPP_URL: https://cal.example.com
NEXTAUTH_URL: https://cal.example.com
NEXTAUTH_SECRET: change-another-long-secret
CALENDSO_ENCRYPTION_KEY: change-a-32-byte-key
NODE_ENV: production
ports:
- "127.0.0.1:3000:3000"
volumes:
postgres_data:
For a Cal.diy lab, start with the community repository's Docker instructions:
cd /opt/calcom
git clone --recursive https://github.com/calcom/cal.diy.git
cd cal.diy
cp .env.example .env
Review and pin a release/commit and an available matching image tag before startup. The provided template includes more services than the sketch; keep database names, service hosts, migrations and credentials consistent. Its database placeholders must be replaced. Bind web publication to 127.0.0.1:3000:3000; inspect and make private any API/Redis publication too. Do not let an additional API service compete with Caddy for port 80.
Avoid latest. Keep secrets in protected .env or the release's supported secret mechanism. Configure the final public URL before building; some NEXT_PUBLIC values are compiled into an image, so runtime variables alone do not necessarily change browser URLs. If building, follow the version's database/build requirements rather than transplanting startup commands.
After reviewing the effective configuration, use the selected project's startup procedure:
docker compose config
docker compose pull
docker compose up -d
docker compose ps
docker compose logs --tail=150 calcom
Compose config can print secrets; do not put its full output in public logs. Never seed development accounts on an internet-facing instance.
ssh -L 3000:127.0.0.1:3000 root@SERVER_IP
Open http://127.0.0.1:3000 through the tunnel for initial checks. Because the final configured URLs use HTTPS, complete login/OAuth tests on the final HTTPS hostname rather than treating the temporary HTTP address as equivalent.
- Make
NEXT_PUBLIC_WEBAPP_URLmatch the final public domain. - Make
NEXTAUTH_URLmatch the documented authentication URL exactly. - Keep the encryption key stable.
- In the illustrative template, the database hostname is
db, notlocalhost; use the actual service name in the official template. - Prepare sender-domain DNS and test registration/login notifications.
sudo apt install -y caddy
sudo nano /etc/caddy/Caddyfile
cal.example.com {
encode gzip zstd
reverse_proxy 127.0.0.1:3000
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
}
}
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
curl -I https://cal.example.com
Have one gateway own public 80/443. Verify DNS, upstream 3000, forwarded host/protocol and the installed release's proxy settings. Use HSTS/includeSubDomains only when the affected names support HTTPS. See Caddy troubleshooting.
Prepare and test:
- SMTP host/port, username and an appropriate application credential.
- Sender address and display name.
- SPF, DKIM and DMARC for the sender domain.
- A booking confirmation and a cancellation email, including their links.
External calendars need configured OAuth applications and permitted scopes. The following is a Google sign-in callback, not the only calendar callback:
https://cal.example.com/api/auth/callback/google
The current Cal.diy instructions additionally specify /api/integrations/googlecalendar/callback for Google Calendar and /api/integrations/office365calendar/callback for Microsoft. Register full URLs on your final HTTPS domain, configure the corresponding server-side credentials and follow the installed release's integration setup. Google API enablement, consent/test-user settings and verification may affect who can connect.
Keep Client Secrets and refresh-token encryption keys out of the browser and public repositories. Test each user's connection and revocation independently. OAuth identity/login and calendar access are different permissions.
Configure in order:
- Site identity, time zone and working week.
- Team/member invitations only in a licensed edition that supports them; Cal.diy currently does not provide those enterprise teams.
- Event types such as 30-minute consultations or 60-minute demos.
- The relevant calendars and busy/available rules.
- Buffers, minimum notice and cancellation deadlines.
- Deliberate public booking links; do not assume an unlisted URL alone is access control.
- Guest tests for booking, rescheduling, cancellation and time-zone display.
Round-robin/team workflows also require the appropriate supported edition. Test on desktop and mobile and across actual time zones, including daylight-saving boundaries. A page loading does not establish correct conflict detection or email delivery.
Save PostgreSQL, .env, the Compose template and persistent encryption/integration keys:
mkdir -p /opt/calcom/backups
docker compose exec -T db pg_dump -U calcom -d calcom | gzip > /opt/calcom/backups/calcom-$(date +%F).sql.gz
cp .env docker-compose.yml /opt/calcom/backups/
Use the selected template's actual database service/user; the sketch's db/calcom names may differ. Enable pipefail and check dump success before trusting a compressed file. Copy the active configuration filename and actual additional persistent volumes, protect secrets and keep encrypted offsite copies.
Restore a matching release into a clean lab and verify login, events, calendar connections and email. Keep restored scheduled tasks disabled until you intend to send real notifications. See the restore drill.
docker compose config > /opt/calcom/backups/compose-$(date +%F).yaml
docker compose pull
docker compose up -d
docker compose ps
docker compose logs --tail=200 calcom
These commands illustrate recreation, not a complete migration plan. Pin the old/new images, test required migrations and check edition-specific release notes. Avoid following latest without a backup. Rolling back an image after a database migration may require restoring the matching database and secrets.
docker compose ps
docker compose logs --tail=200 calcom
sudo journalctl -u caddy -n 100 --no-pager
ss -lntp | grep -E ':3000|:80|:443'
Verify the intended host publication 127.0.0.1:3000, actual container readiness, Caddy's upstream and OOM records. The application inside a container generally needs to listen on its container interface, not only its own loopback.
Compare final URL, registered integration/login callbacks, exact path, browser hostname, clock and proxy scheme. An HTTP tunnel or temporary IP is not a substitute for the registered HTTPS callback.
Inspect application errors, SMTP credentials/TLS/port, DNS, provider bounces and spam folders. Test booking and cancellation separately. Missing VAPID settings can also affect startup in versions that enable web push; use the release's documented keys rather than suppressing unexplained errors.
- The personal-lab versus supported commercial-edition boundary is understood.
- Domain, HTTPS, login and complete booking flow work.
- SMTP and sender-domain records are verified.
- Calendar/login callbacks match the final hostname.
- PostgreSQL and internal service ports are private.
.env, database and encryption keys have offsite copies.- A clean restore has been tested.
- Version, migration and recovery steps are recorded.
For a Cal.diy lab, use test calendars and recipients first. For a business scheduling service, choose a supported deployment and feature license before committing real appointment operations to it.