Cal.com with Docker in the Hetzner Cloud
4 Minuten Lesezeit

Cal.com with Docker in the Hetzner Cloud

Cal.com is a popular open-source alternative to Calendly. With Docker and Polycrate, you can run your own instance of Cal.com on Hetzner in less than 5 minutes.
apps docker calcom hetzner

Cal.com

In this article, we demonstrate the fastest and most convenient way to self-host Cal.com with Docker in the Hetzner Cloud. With the help of Polycrate, you can access your own Cal.com instance on Hetzner in less than 5 minutes.

Your Cal.com instance allows numerous integrations with calendar and meeting tools, such as:

In this article, your Cal.com instance will be integrated with Microsoft 365 so you can immediately access your MS365 calendars and meetings.

What is Cal.com?

Cal.com

Cal.com (formerly known as Calendso) is a popular open-source alternative to Calendly, supported by thousands of developers, known for its booking and scheduling solutions. Cal.com makes scheduling transparent and accessible for you and your clients.

With Cal.com, you enable your clients and prospects to conveniently book meetings with you or your team directly from your website. Cal.com ensures that only available slots from your team’s connected calendars are considered for scheduling.

Why self-host?

There are many reasons. Many companies rely on running software on their own infrastructure and cannot use SaaS offerings like Cal.com. Others, including us at ayedo, prefer to keep critical business components under their own control. This can be for various reasons: more flexibility, better control over pricing, improved data security.

Either way, Cal.com is AGPLv3 licensed open-source software, making it suitable for running on your own infrastructure. Fortunately, Cal.com also offers a ready-made Docker setup for self-hosting, which we have packaged and made configurable for you with Polycrate.

Why Hetzner and not AWS?

Among all providers worldwide, Hetzner offers the best price-performance ratio, outperforming most competitors in terms of infrastructure pricing and delivered performance. Additionally, Hetzner is a European cloud provider, which helps avoid many potential issues regarding compliance, GDPR, and the Cloud Act.

Installation

Preparation

You will need some credentials and tools for the correct setup of your Cal.com instance:

  • The latest version of Polycrate
  • Microsoft Credentials for connecting to Outlook and Teams
  • Cal.com credentials for data encryption (simply generate 2 random Secrets)
  • SMTP credentials for sending booking and confirmation emails
  • An API token from your Hetzner Cloud project
  • A DNS zone and an A-record for the hostname of the Cal.com instance pointing to your Hetzner server

Install Polycrate

If you haven’t installed Polycrate yet, please follow this guide.

Create Workspace

Create a new folder for the Polycrate Workspace: mkdir calcom.

Navigate to the workspace folder: cd calcom

Create the file workspace.poly and insert the following content:

x-letsencrypt-email: &letsencrypt-email "info@mycompany.com"
x-hcloud-token: &hcloud-token "HCLOUD_API_TOKEN"
x-calcom-nextauth-secret: &calcom-nextauth-secret "GENERATED_SECRET_1"
x-calcom-calendso-encryption-key: &calcom-calendso-encryption-key "GENERATED_SECRET_2"
x-calcom-email-host: &calcom-email-host "mail.mycompany.com"
x-calcom-email-port: &calcom-email-port 587
x-calcom-email-user: &calcom-email-user "noreply@mycompany.com"
x-calcom-email-password: &calcom-email-password "SMTP_PASSWORD"
x-calcom-email-from: &calcom-email-from "noreply@mycompany.com"
x-calcom-hostname: &calcom-hostname "cal.mycompany.com"
x-calcom-microsoft-graph-client-id: &calcom-microsoft-graph-client-id "MICROSOFT_CLIENT_ID"
x-calcom-microsoft-graph-client-secret: &calcom-microsoft-graph-client-secret "MICROSOFT_CLIENT_SECRET"

name: *workspace-name

blocks:
  - name: vpc
    from: cargo.ayedo.cloud/ayedo/hcloud/vpc:0.0.9
    config:
      ssh:
        port: 22
        user: "root"
      vpc:
        name: *workspace-name
      token: *hcloud-token
      node_defaults:
        nodename:
          prefix: *workspace-name
        type: cx31
        image: ubuntu-22.04
        location: fsn1
        firewalls: 
          - *workspace-name
        networks:
          - *workspace-name
        placement_group: *workspace-name
      nodes:
        - name: docker-1
      networks:
        - name: *workspace-name
          enabled: true
          zone: eu-central
          ip_range: 10.11.0.0/16
          delete_protection: false
          type: cloud
          subnet:
            enabled: true
            ip_range: 10.11.3.0/24
      placement_groups:
        - name: *workspace-name
          enabled: true
          type: spread
      firewalls:
        - name: *workspace-name
          enabled: true
          rules: 
            - description: allow 22
              direction: in
              port: 22
              protocol: tcp
              source_ips:
                - 0.0.0.0/0
            - description: allow 80
              direction: in
              port: 80
              protocol: tcp
              source_ips:
                - 0.0.0.0/0
            - description: allow 443
              direction: in
              port: 443
              protocol: tcp
              source_ips:
                - 0.0.0.0/0
            - description: allow icmp
              direction: in
              protocol: icmp
              source_ips:
                - 0.0.0.0/0

  - name: docker
    from: cargo.ayedo.cloud/ayedo/linux/docker:0.0.5
    inventory:
      from: vpc

  - name: traefik
    from: cargo.ayedo.cloud/ayedo/docker/traefik:0.1.1
    inventory:
      from: vpc
    config:
      tls:
        resolver:
          email: *letsencrypt-email
        solver:
          http:
            enabled: true

  - name: calcom
    from: cargo.ayedo.cloud/ayedo/docker/calcom:0.0.1
    inventory:
      from: vpc
    config:
      calcom:
        nextauth_secret: *calcom-nextauth-secret
        calendso_encryption_key: *calcom-calendso-encryption-key
        email:
          host: *calcom-email-host
          port: *calcom-email-port
          user: *calcom-email-user
          password: *calcom-email-password
          from: *calcom-email-from
        traefik:
          hostname: *calcom-hostname
        microsoft:
          graph_client_id: *calcom-microsoft-graph-client-id
          graph_client_secret: *calcom-microsoft-graph-client-secret

Adjust the values of the x- variables according to the prepared secrets and information. Once all values are entered, we can begin the installation.

Install Workspace

Execute the following commands to initialize the workspace, provision a VM at Hetzner, install Docker on it, and then start Traefik and Cal.com in Docker:

polycrate init 
polycrate --blocks-auto-pull install vpc
polycrate --blocks-auto-pull install docker
polycrate --blocks-auto-pull install traefik
polycrate --blocks-auto-pull install calcom

After all commands have completed successfully, you only need to set the IP of your Hetzner server as the target for the A-record from x-calcom-hostname in your DNS zone. Within a few minutes, name resolution should work. Traefik will then automatically fetch a TLS certificate from LetsEncrypt to secure your Cal.com instance.

You can now access your scheduling tool at cal.mycompany.com (or the hostname you configured) and begin the initial setup:

Setup

  <div class="text-sm leading-relaxed text-gray-700 dark:text-gray-300">
    <p>Do you need a more complex setup of Cal.com, e.g., in Kubernetes or with <a href="/en/posts/sso-was-sind-eigentlich-oauth-openid-saml-und-scim/">Enterprise SSO</a>?</p>

Contact us!

  </div>
</div>

Ähnliche Artikel