eco Beginner Tutorial/How-to

Installing Cal.com on a VPS: Docker, PostgreSQL, SSL, SMTP, and Backups

We earn commissions when you shop through the links below.

calendar_month Oct 10, 2026 schedule 20 min read visibility 1227 views
Установка Cal.com на VPS: Docker, PostgreSQL, SSL, SMTP и резервные копии
dns No server for this guide yet? Vultr, DigitalOcean, Contabo sellDeal UKHost4u: 30% off everything until Jul 31 Get deal →

Installing Cal.com on a VPS: Docker, PostgreSQL, SSL, SMTP, and Backups

TL;DR

In this guide, we will deploy Cal.com on our own VPS using Docker Compose, PostgreSQL, and Redis, connect a domain and HTTPS through Caddy, configure SMTP email delivery, and set up automatic backups of the database and configuration.

  • We will use Ubuntu Server 24.04 LTS, Docker Engine 28.x, and Docker Compose v2.
  • Cal.com will run in a container, while PostgreSQL and Redis will run in separate containers.
  • External access will be provided through Caddy with an automatic Let’s Encrypt certificate.
  • We will store secrets and connection parameters in the .env file rather than in the source code.
  • Backups of PostgreSQL, Docker configuration, and user data will run on a schedule via cron and Restic.

1. TL;DR

In this guide, we will deploy Cal.com on our own VPS using Docker Compose, PostgreSQL, and Redis, connect a domain and HTTPS through Caddy, configure SMTP email delivery, and set up automatic backups of the database and configuration.

  • We will use Ubuntu Server 24.04 LTS, Docker Engine 28.x, and Docker Compose v2.
  • Cal.com will run in a container, while PostgreSQL and Redis will run in separate containers.
  • External access will be provided through Caddy with an automatic Let’s Encrypt certificate.
  • We will store secrets and connection parameters in the .env file rather than in the source code.
  • Backups of PostgreSQL, Docker configuration, and user data will run on a schedule via cron and Restic.

dnsA server for this guide

Matching plans from verified providers, prices updated daily.

sell UKHost4u: 30% off everything · until Jul 31 Get deal →

Compare:Vultr vs DigitalOceanVultr vs ContaboAll VPS by price

Affiliate links: we may earn a commission, your price stays the same.

2. Contents

The installation is intended for a clean server with a public IPv4 address and a domain, such as calendar.example.com. Before starting, replace this domain with your own in all commands and configuration files.

The commands are intended for a user with sudo privileges. If the server is already being used for other websites, check the ports in use and existing Docker networks: Cal.com and Caddy should have an isolated configuration.

3. What We Are Configuring and Why

Схема: 3. Что мы настраиваем и зачем
Diagram: 3. What We Are Configuring and Why

What Is Cal.com

Cal.com is a platform for scheduling meetings and booking time. A user creates calendar events, publishes an availability page, and allows other people to choose an available slot. The system supports working hours, buffers between meetings, different event types, team calendars, and integrations with external calendars.

With a self-hosted Cal.com installation, the application, database, cache, and reverse proxy are controlled by the server owner. This is convenient for a team, internal service, or SaaS prototype when you need your own domain, independent data storage, and the ability to change the configuration without cloud-plan restrictions.

What Will Work After Following the Instructions

  • Cal.com will be available at an address such as https://calendar.example.com.
  • PostgreSQL will store users, events, settings, and integrations.
  • Redis will be used for queues and caching if required by the selected version of Cal.com.
  • Caddy will accept HTTPS connections and proxy them to the application container.
  • The SMTP server will send confirmation emails, invitations, and notifications.
  • Backups will be transferred to separate storage located on a different disk.

Self-hosted or Cloud Cal.com

Criterion Cloud Version Self-hosted on a VPS
Launch Does not require server configuration You need to configure the OS, Docker, and domain yourself
Data Control Data is stored by the cloud operator The database and configuration are stored on your server
Updates Performed automatically or by the operator Controlled by the administrator
Flexibility Depends on the plan and available integrations You can change the infrastructure and network architecture
Responsibility A significant portion of the tasks is handled by the provider Backups, security, and recovery are your responsibility

A VPS is suitable if you are ready to monitor updates, disk space, SMTP, and recovery from backups yourself. For several users, this setup is usually simpler and cheaper than a separate Kubernetes cluster. For a mission-critical service, prepare a second server or a rapid recovery procedure in advance.

How the Architecture Works

Public traffic reaches Caddy on ports 80 and 443. Caddy obtains a certificate and forwards requests to the Cal.com container over the internal Docker network. The application connects to PostgreSQL and Redis by container names, so the databases do not need to be exposed to the internet.

Internet
    |
    | 80/443
    v
Caddy ---- internal network ---- Cal.com:3000
                                  |       |
                                  v       v
                            PostgreSQL   Redis

4. What VPS Configuration Is Needed for This Task

Схема: 4. Какой VPS-конфиг нужен под эту задачу
Diagram: 4. What VPS Configuration Is Needed for This Task

Minimum Configuration

For a small personal calendar or a team of up to 10–20 people, two virtual CPUs, 4 GB of RAM, and a 40–60 GB SSD are sufficient. This server is suitable for the application itself, PostgreSQL, Redis, and Caddy, but memory headroom will be limited during updates and backups.

Scenario CPU RAM SSD Network
Testing and personal use 2 vCPU 4 GB 40 GB 100 Mbps
Small team 4 vCPU 8 GB 80 GB 100–1000 Mbps
Several organizations or SaaS 8 vCPU 16 GB 160 GB NVMe 1 Gbps

A practical starting option is 4 vCPU, 8 GB of RAM, 80–100 GB of NVMe storage, a disk backup or separate object storage, and a public IPv4 address. You can choose a VPS with these specifications if it meets the requirements for the OS, network, and backups.

Disk and Backups

The Cal.com database is usually small compared with backup files and logs. Nevertheless, do not size the disk too tightly. For a server with a 10 GB database, leave at least 30–50 GB of free space. Docker stores images, layers, and old containers, while logs can grow in the event of SMTP or external integration errors.

It is best to store backups on a different disk. If an attacker deletes the server or the file system is damaged, a local archive will not help. Use S3-compatible object storage, a separate VPS over SSH, or a remote server with Restic.

When a Dedicated Server Is Needed

A dedicated server for a single Cal.com instance is usually excessive. It becomes justified if dozens of services run on the same machine, guaranteed disk performance is required, a large PostgreSQL cluster needs to be hosted, or the infrastructure must be isolated from neighboring virtual machines.

For a typical installation, a fast SSD, stable network, regular snapshots, and a clear recovery procedure are more important than the physical server type. As the load grows, first scale the VPS vertically, then move PostgreSQL and background tasks to separate nodes.

Choosing a Location

The location affects request latency and personal data processing requirements. Choose a data center closer to your main users, but consider where external calendars, SMTP, and object storage are hosted. For meetings, latency of several tens of milliseconds is rarely critical, although fast interface access is noticeable when working with a large number of events.

5. Server Preparation

Ubuntu Server 24.04 LTS with an IPv4 address is used below. In the DNS panel, create an A record calendar.example.com pointing to the server's IP. For automatic certificate issuance, the domain must be accessible from the internet, and ports 80 and 443 must not be blocked by an external firewall.

Creating an Administrator

Connect to the server using the initial user, usually root, and create a separate administrative account. Do not run production containers as root unless necessary.

# Создаём пользователя для администрирования
adduser deploy

# Добавляем его в группу sudo
usermod -aG sudo deploy

# Проверяем наличие пользователя
id deploy

On the local computer, generate an SSH key if you do not already have one, and install the public part on the server.

# Выполняется на локальном компьютере
ssh-keygen -t ed25519 -C "deploy@calendar-server"

# Копируем ключ на сервер
ssh-copy-id deploy@SERVER_IP

# Проверяем вход по ключу
ssh deploy@SERVER_IP

Updating Ubuntu and Basic Packages

# Обновляем индексы пакетов и устанавливаем исправления
sudo apt update && sudo apt full-upgrade -y

# Устанавливаем инструменты для администрирования и репозиториев
sudo apt install -y ca-certificates curl gnupg git jq unzip \
  htop vim ufw fail2ban unattended-upgrades

# Проверяем версию операционной системы
. /etc/os-release && echo "$PRETTY_NAME"

After the update, check whether a reboot is required because of a new kernel.

# Показываем необходимость перезагрузки
if [ -f /var/run/reboot-required ]; then echo "Reboot required"; fi

# Перезагружаем сервер при необходимости
sudo reboot

Configuring SSH

Before disabling password authentication, make sure the new SSH key works in a separate terminal window. Then create a separate configuration fragment.

# Запрещаем вход root и вход по паролю
sudo tee /etc/ssh/sshd_config.d/ hardening.conf >/dev/null <<'EOF'
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
EOF

# Проверяем синтаксис конфигурации SSH
sudo sshd -t

# Применяем настройки без разрыва существующей сессии
sudo systemctl reload ssh

The first line of the command above must not contain a space within the path. The correct version, if the shell does not accept the form with a space, is:

sudo tee /etc/ssh/sshd_config.d/hardening.conf >/dev/null <<'EOF'
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
EOF

Firewall and fail2ban

Open SSH, HTTP, and HTTPS. If SSH runs on a non-standard port, replace 22/tcp with the required value. Docker can bypass some UFW rules for published ports, so we will not publish PostgreSQL and Redis externally.

# Разрешаем необходимые входящие соединения
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Включаем межсетевой экран
sudo ufw --force enable

# Проверяем правила
sudo ufw status verbose

# Включаем защиту SSH от перебора паролей
sudo systemctl enable --now fail2ban
sudo fail2ban-client status

After disabling password authentication, the standard fail2ban filter for SSH remains useful, although key-based authentication becomes the primary protection. Check the logs periodically:

# Смотрим последние события SSH-защиты
sudo fail2ban-client status sshd

# Проверяем ошибки авторизации
sudo journalctl -u ssh --since "24 hours ago" --no-pager

6. Software Installation — Step by Step

Step 1. Installing Docker Engine

In 2026, use the current stable Docker Engine 28.x branch or a newer compatible version. Packages are installed from the official Docker repository, not from a random script or an old system package.

# Создаём каталог для ключей репозиториев
sudo install -m 0755 -d /etc/apt/keyrings

# Загружаем ключ официального репозитория Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# Разрешаем чтение ключа пакетным менеджером
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Добавляем репозиторий для Ubuntu 24.04
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list >/dev/null

# Устанавливаем Docker Engine и Compose v2
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io \
  docker-buildx-plugin docker-compose-plugin

# Добавляем deploy в группу Docker
sudo usermod -aG docker "$USER"

# Проверяем версии
docker --version
docker compose version

After being added to the Docker group, log out of SSH and connect again. Group membership effectively grants root privileges through the Docker API, so add only trusted administrators to it.

Step 2. Creating Project Directories

# Создаём каталог приложения и каталог резервных копий
sudo mkdir -p /opt/calcom/{caddy,data,backups,db-init}

# Передаём каталог проекта административному пользователю
sudo chown -R "$USER":"$USER" /opt/calcom

# Переходим в рабочий каталог
cd /opt/calcom

Step 3. Obtaining the Official Docker Template

The structure of Cal.com Docker files changes between releases. For production, use the Compose file from the project's official repository and pin a specific stable tag rather than using an unpredictable nightly image. The standalone minimal option below is suitable for a basic installation.

# Создаём файл переменных окружения
touch /opt/calcom/.env

# Ограничиваем права доступа к секретам
chmod 600 /opt/calcom/.env

# Переходим в каталог проекта
cd /opt/calcom

Step 4. Generating Secrets

Cal.com uses secrets for sessions and encrypting integration tokens. The CALENDSO_ENCRYPTION_KEY value must not be changed after creating production integrations without understanding the consequences: encrypted tokens may become inaccessible.

# Генерируем секрет сессий длиной 64 hex-символа
openssl rand -hex 32

# Генерируем ключ шифрования Cal.com
openssl rand -hex 32

# Генерируем пароль PostgreSQL
openssl rand -base64 32

Copy the three results into a temporary protected file or directly into .env. Do not send this file to Git, messengers, or monitoring systems.

Step 5. Preparing Docker Compose

The example uses a Cal.com image from the project's official registry, PostgreSQL 16, and Redis 7. In 2026, before upgrading, check the recommended Cal.com tag and the compatibility of the environment variables in the documentation for the relevant release.

# Создаём Compose-файл
cat > /opt/calcom/compose.yml <<'EOF'
services:
  db:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - internal
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 10s
      timeout: 5s
      retries: 10

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --appendonly yes
    volumes:
      - redis_data:/data
    networks:
      - internal
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 10

  calcom:
    image: ${CALCOM_IMAGE}
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    env_file:
      - .env
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
      REDIS_URL: redis://redis:6379
      NODE_ENV: production
      PORT: 3000
      HOSTNAME: 0.0.0.0
    expose:
      - "3000"
    networks:
      - internal
      - proxy

networks:
  internal:
    internal: true
  proxy:

volumes:
  postgres_data:
  redis_data:
EOF

# Проверяем синтаксис и подстановку переменных
docker compose config

Step 6. First Database and Application Launch

# Загружаем образы PostgreSQL, Redis и Cal.com
docker compose pull

# Запускаем контейнеры в фоне
docker compose up -d

# Проверяем состояние всех сервисов
docker compose ps

# Смотрим последние логи приложения
docker compose logs --tail=100 calcom

On the first launch, Cal.com may run database migrations. Do not restart the container several times in a row before checking the logs. If the image requires a separate migration command, run it according to the documentation for the specific release, for example via docker compose exec calcom.

Step 7. Installing Caddy

Caddy will be installed on the host rather than in a container. This simplifies certificate acquisition and allows multiple Docker projects to be proxied through a single reverse proxy.

# Устанавливаем Caddy из официального репозитория
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | \
  sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | \
  sudo tee /etc/apt/sources.list.d/caddy-stable.list

sudo apt update
sudo apt install -y caddy

# Проверяем установленную версию
caddy version

Step 8. Creating a Cal.com Administrator

Open the domain in a browser after configuring Caddy in the next section. The first registered user usually becomes the owner of the installation. Use a work email address, since without SMTP some recovery and invitation features will not work.

7. Configuration

Diagram: 7. Configuration
Diagram: 7. Configuration

Environment Variables File

Open the /opt/calcom/.env file and fill it in. Replace the value of CALCOM_IMAGE with a specific stable tag published for your version of Cal.com. Do not use latest in a critical production environment: a floating tag may unexpectedly change the database schema or set of variables.

sudo -u "$USER" tee /opt/calcom/.env >/dev/null <<'EOF'
# Версия образа Cal.com. Зафиксируйте стабильный тег текущего релиза.
CALCOM_IMAGE=calcom/cal.com:v5

# Основные параметры PostgreSQL
POSTGRES_DB=calcom
POSTGRES_USER=calcom
POSTGRES_PASSWORD=REPLACE_WITH_LONG_RANDOM_PASSWORD

# URL приложения
NEXTAUTH_URL=https://calendar.example.com
NEXT_PUBLIC_WEBAPP_URL=https://calendar.example.com

# Секрет сессий и ключ шифрования интеграций
NEXTAUTH_SECRET=REPLACE_WITH_64_HEX_CHARACTERS
CALENDSO_ENCRYPTION_KEY=REPLACE_WITH_64_HEX_CHARACTERS

# Настройки электронной почты
[email protected]
EMAIL_SERVER_HOST=smtp.example.net
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER=smtp-user
EMAIL_SERVER_PASSWORD=REPLACE_WITH_SMTP_PASSWORD
EMAIL_SERVER_SECURE=false

# Параметры окружения
NODE_ENV=production
NEXT_PUBLIC_LICENSE_CONSENT=agree
EOF

# Закрываем файл от чтения другими пользователями
chmod 600 /opt/calcom/.env

# Проверяем, что Docker видит обязательные переменные
docker compose config --environment

In some releases, the names of SMTP variables or required settings may differ. Compare them with the .env.example example from the same Cal.com tag. This is especially important after switching between major versions.

Configuring Caddy and HTTPS

Create a Caddyfile. Caddy will automatically request a Let’s Encrypt certificate if DNS already points to the server, ports 80 and 443 are open, and the domain is not protected by additional authorization.

# Создаём конфигурацию reverse proxy
sudo tee /etc/caddy/Caddyfile >/dev/null <<'EOF'
calendar.example.com {
    encode gzip zstd

    reverse_proxy 127.0.0.1:3000 {
        header_up Host {host}
        header_up X-Real-IP {remote_host}
        header_up X-Forwarded-For {remote_host}
        header_up X-Forwarded-Proto {scheme}
    }

    log {
        output file /var/log/caddy/calcom-access.log
        format json
    }
}
EOF

# Создаём каталог для журнала Caddy
sudo mkdir -p /var/log/caddy
sudo chown caddy:caddy /var/log/caddy

# Проверяем синтаксис Caddyfile
sudo caddy validate --config /etc/caddy/Caddyfile

# Запускаем и добавляем Caddy в автозагрузку
sudo systemctl enable --now caddy

# Перечитываем конфигурацию без остановки сервиса
sudo systemctl reload caddy

In the current Compose file, the Cal.com container does not publish port 3000 on the host. For Caddy on the host to access the application, add port publishing only on the loopback interface.

# Показываем фрагмент текущего Compose-файла
grep -A5 -B3 "expose" /opt/calcom/compose.yml

Replace the expose block inside the calcom service with the following:

ports:
  - "127.0.0.1:3000:3000"

Restart the container after making the change:

# Пересоздаём только контейнер приложения с новым портом
cd /opt/calcom
docker compose up -d calcom

# Проверяем локальный ответ приложения
curl -I http://127.0.0.1:3000

# Проверяем статус Caddy
sudo systemctl status caddy --no-pager

# Проверяем HTTPS с сервера
curl -I https://calendar.example.com

Checking the Database and Redis

# Проверяем готовность PostgreSQL
docker compose exec db pg_isready -U calcom -d calcom

# Проверяем Redis
docker compose exec redis redis-cli ping

# Проверяем состояние контейнеров
docker compose ps

# Просматриваем ошибки приложения за последние минуты
docker compose logs --since=10m calcom | grep -iE "error|warn|migration"

SMTP

For the standard SMTP port 587, STARTTLS is usually used: EMAIL_SERVER_SECURE=false. For SMTPS on port 465, EMAIL_SERVER_SECURE=true is more often required. Do not confuse SMTP encryption with HTTPS: the website certificate is not responsible for email delivery.

After changing the SMTP variables, recreate the container so that it receives the new values:

# Пересоздаём приложение с обновлёнными SMTP-настройками
cd /opt/calcom
docker compose up -d --force-recreate calcom

# Проверяем журнал отправки и ошибок SMTP
docker compose logs --since=15m calcom | grep -iE "smtp|email|mail|error"

For production, use an SMTP provider with separate application credentials and sending rate limits. Do not run your own mail server on the same VPS unless necessary: it will require SPF, DKIM, DMARC, reverse DNS, queue monitoring, and IP reputation management.

Checking Automatic Startup

# Проверяем, что контейнеры автоматически перезапускаются
docker inspect -f '{{.Name}}: {{.HostConfig.RestartPolicy.Name}}' \
  $(docker compose ps -q)

# Имитируем перезапуск Docker
sudo systemctl restart docker

# Убеждаемся, что сервисы вернулись
sleep 15
cd /opt/calcom
docker compose ps

8. Backups and Maintenance

Diagram: 8. Backups and Maintenance
Diagram: 8. Backups and Maintenance

What Needs to Be Saved

  • PostgreSQL dump: users, events, settings, teams, and integrations.
  • The .env file: without it, some connections and secrets cannot be restored.
  • compose.yml and the Caddy configuration.
  • Docker volumes, if the selected Cal.com version stores uploaded files or additional data.
  • Encryption keys and information about the recovery procedure.

The database is the primary source of Cal.com state. Simply copying the container is not enough: containers can be recreated from the image, while PostgreSQL data must be exported in a consistent manner using pg_dump.

Installing Restic

Restic encrypts files before sending them to remote storage. The example uses S3-compatible storage. Obtain a separate bucket and a key with minimal permissions: the backup application does not need access to the entire account.

# Устанавливаем Restic из пакетов Ubuntu
sudo apt update
sudo apt install -y restic

# Проверяем версию
restic version

# Создаём каталог для временных дампов
sudo mkdir -p /opt/calcom/backup-work
sudo chown -R "$USER":"$USER" /opt/calcom/backup-work

Backup Script

Create the /usr/local/sbin/calcom-backup file. It is better to store the Restic repository password and S3 parameters in a separate file with 600 permissions rather than specifying them directly in the script.

# Создаём файл секретов Restic
sudo tee /root/.config/calcom-restic.env >/dev/null <<'EOF'
export RESTIC_REPOSITORY=s3:https://s3.example.net/calcom-backups
export AWS_ACCESS_KEY_ID=REPLACE_WITH_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=REPLACE_WITH_SECRET_KEY
export RESTIC_PASSWORD=REPLACE_WITH_LONG_REPOSITORY_PASSWORD
EOF

# Ограничиваем доступ к секретам
sudo chmod 600 /root/.config/calcom-restic.env

# Создаём скрипт резервного копирования
sudo tee /usr/local/sbin/calcom-backup >/dev/null <<'EOF'
#!/usr/bin/env bash
set -Eeuo pipefail

PROJECT=/opt/calcom
WORK="$PROJECT/backup-work"
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
DUMP="$WORK/calcom-$STAMP.sql.gz"

source /root/.config/calcom-restic.env
mkdir -p "$WORK"

# Создаём согласованный сжатый дамп PostgreSQL
cd "$PROJECT"
docker compose exec -T db \
  pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" --no-owner --no-acl \
  | gzip -9 > "$DUMP"

# Инициализируем репозиторий при первом запуске
restic snapshots >/dev/null 2>&1 || restic init

# Сохраняем дамп, конфигурацию и Compose-файл
restic backup "$DUMP" "$PROJECT/.env" "$PROJECT/compose.yml" \
  /etc/caddy/Caddyfile

# Удаляем локальные дампы старше двух дней
find "$WORK" -type f -name '.sql.gz' -mtime +2 -delete

# Удаляем старые удалённые снимки по политике хранения
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
EOF

# Делаем скрипт исполняемым
sudo chmod 750 /usr/local/sbin/calcom-backup

The database and user name are taken from the container variables. If the script runs pg_dump with empty variables, pass them explicitly or load the values from a protected file. For this Compose configuration, the corresponding part can be replaced with:

docker compose exec -T db \
  pg_dump -U calcom -d calcom --no-owner --no-acl \
  | gzip -9 > "$DUMP"

First Run and Archive Verification

# Запускаем резервное копирование вручную
sudo /usr/local/sbin/calcom-backup

# Проверяем список снимков
sudo bash -c 'source /root/.config/calcom-restic.env && restic snapshots'

# Проверяем целостность последних данных
sudo bash -c 'source /root/.config/calcom-restic.env && restic check'

Cron Scheduler

Run the backup at night, when the likelihood of active data changes is lower. The PostgreSQL dump remains consistent even while the application is running, so stopping Cal.com every day is not necessary.

# Создаём ежедневное задание в cron
sudo tee /etc/cron.d/calcom-backup >/dev/null <<'EOF'
17 03    root /usr/local/sbin/calcom-backup >> /var/log/calcom-backup.log 2>&1
EOF

# Проверяем права и содержимое задания
sudo chmod 644 /etc/cron.d/calcom-backup
cat /etc/cron.d/calcom-backup

Periodically perform a test recovery in a separate temporary environment. A backup that has never been restored is merely an assumption that the data exists.

Updating Cal.com

Do not automatically update production to a floating tag. First read the release notes, check the requirements for Node.js, PostgreSQL, and environment variables, then make a full backup.

# Сохраняем текущий список образов
cd /opt/calcom
docker compose images

# Делаем резервную копию перед обновлением
sudo /usr/local/sbin/calcom-backup

# Меняем CALCOM_IMAGE на новый проверенный тег
sudo vim /opt/calcom/.env

# Загружаем новый образ и пересоздаём приложение
docker compose pull calcom
docker compose up -d calcom

# Наблюдаем за миграциями и ошибками
docker compose logs -f --tail=200 calcom

For a small team, use a short maintenance window and notify users in advance about possible unavailability. A rolling update with two application instances is possible, but requires a separate load balancer, migration compatibility checks, and background task monitoring. For a single VPS, a sequential update with a prepared rollback is safer.

Resource Monitoring

# Показываем загрузку контейнеров
docker stats --no-stream

# Проверяем заполнение диска
df -h

# Проверяем размер Docker-данных
sudo du -sh /var/lib/docker

# Смотрим использование памяти
free -h

# Проверяем ошибки ядра и диска
sudo journalctl -p warning..alert --since "24 hours ago" --no-pager

Set up an alert when disk usage exceeds 80–85 percent. A full PostgreSQL disk can lead not only to halted writes but also to corruption of active processes if the system cannot create temporary files.

9. Troubleshooting and FAQ

Cal.com returns a 502 Bad Gateway error. What should I check?

First, check docker compose ps and the logs using docker compose logs --tail=200 calcom. Then make sure port 3000 is published on 127.0.0.1 and that the application is actually listening on it: curl -I http://127.0.0.1:3000. If the container keeps restarting, check the required variables in .env, the PostgreSQL status, and the migration results. The Caddy log is available through journalctl -u caddy.

The HTTPS certificate is not being issued. Why?

Check that the domain's A record points to the correct IPv4 address and that the AAAA record does not point to an unreachable IPv6 address. Ports 80 and 443 must be open in UFW, the provider's control panel, and the external firewall. Make sure another web server is not occupying these ports: sudo ss -ltnp | grep -E ':80|:443'. After correcting DNS, check the log with sudo journalctl -u caddy -n 100 and repeat the Caddy reload.

Emails are not being sent, although the website opens. What should I do?

Check the SMTP host, port, username, password, and TLS mode. Port 587 usually requires STARTTLS and the value EMAIL_SERVER_SECURE=false; for 465, use the SMTPS settings recommended by your provider. Check the Cal.com logs after recreating the container. Also check whether the provider blocks outgoing SMTP connections and whether the sender address is authorized. SPF, DKIM, and DMARC affect deliverability but do not fix incorrect SMTP authentication.

Which error indicates that Cal.com cannot connect to PostgreSQL?

Messages such as ECONNREFUSED, password authentication failed, or database does not exist indicate a connection or variable issue. Within Compose, the host should be the db service, not localhost. Check docker compose exec db pg_isready -U calcom -d calcom, then compare the database name, user, and password in Compose and .env. After changing the password, the existing PostgreSQL volume will not be reinitialized automatically.

What is the minimum suitable VPS configuration?

For a test or personal installation, 2 vCPUs, 4 GB of RAM, and 40–60 GB of SSD storage are sufficient. For a small team, it is better to choose 4 vCPUs, 8 GB of RAM, and at least 80 GB of NVMe storage, especially if the server will also run monitoring, backups, or additional services. You need Ubuntu 24.04 LTS, a public IPv4 address, open ports 80 and 443, and the ability to make outgoing HTTPS and SMTP connections. Store backups separately from the VPS.

What should I choose—VPS or dedicated for this task?

For a single Cal.com instance or a small team, choose a VPS: the resources are sufficient, and scaling is done by changing the plan. A dedicated server is justified if the server simultaneously hosts many projects, guaranteed disk performance is required, or physical isolation is needed. A dedicated server alone does not solve security and backup issues. In both cases, you need updates, monitoring, separate backup storage, and a recovery plan.

Calendar integrations disappeared after an update. How can I restore them?

Check whether CALENDSO_ENCRYPTION_KEY has changed. If the key differs from the one used when the integrations were created, Cal.com may be unable to decrypt the stored tokens. Restore the previous value from secure storage and restart the container. If the key is lost, restore the database together with the original key from a compatible backup. Do not delete the PostgreSQL volume before completing the diagnosis, and be sure to save the current logs.

The disk is filling up quickly. What actions are safe?

Check df -h, docker system df, the size of Docker directories, and the Caddy logs. Delete only unused images after confirming that the required release is already running: docker image prune does not delete running images, but still run it deliberately. Configure log rotation for Docker and limit the retention period for local dumps. Do not manually delete the PostgreSQL volume or the /var/lib/docker/volumes directory.

10. Conclusions and Next Steps

Diagram: 10. Conclusions and Next Steps
Diagram: 10. Conclusions and Next Steps

As a result, Cal.com runs in Docker on a VPS, data is stored in PostgreSQL, requests are secured with HTTPS through Caddy, and notifications are sent through an external SMTP service. A separate Restic backup stores the database, configuration, and secrets in an encrypted remote repository.

As the next step, configure monitoring for availability, disk space, memory, and certificate expiration. As the load grows, move PostgreSQL to a separate node, add a second application instance, and test the recovery procedure in a clean environment. Before each major update, record the current image tag, perform a backup, and verify migrations on a staging server.

Affiliate links: we may earn a commission, your price stays the same.

Was this guide helpful?

Your feedback helps us improve our guides.

Share this post:

Send this guide to someone who may find it useful.

Telegram VKVK WhatsApp Facebook LinkedIn XX

cal.com installation on VPS: Docker, PostgreSQL, SSL, SMTP, and backups