Manage your meetings like a boss with self-hosted calender
Tags: opensource, showdev, devops, productivity
Published: 2021-10-02 21:12:12

---
title: Manage your meetings like a boss with self-hosted calender
published: true
description: Calendso is an open source Calendly alternative that's simple to self-host 
tags: opensource, showdev, devops, productivity 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xw9h8fv2b0db217tip3b.png
---

Calendly and other scheduling tools are awesome. It made our lives massively easier. We're using it for business meetings, side projects and anything else where we need some flexible coordination. However, most tools are very limited in terms of control, customization, data protection, and most important - they are not free! That's where Calendso & Synpse come in. Self-hosted, all your data sitting on your own machines. API-driven and ready to be deployed on your own domain. Full control of your events and data.

**In this tutorial we will be deploying a self-hosted Calendso instance that lives under your own DNS domain. You will be able to share meeting links such as [https://calendar.synpse.net/karolis/quick-chat](https://calendar.synpse.net/karolis/quick-chat) with your colleagues, clients and friends:**

![calendso-karolis](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g6myuf6j24ngkxg7qv7z.png)

You will also be able to:
- Integrate it with your Google calendar 
- Create multiple users for your organization
- Create teams

## The setup

Deployment will be handled in a declarative way through Synpse. Incoming traffic will be handled by [Caddy](https://caddyserver.com/) server which will terminate HTTPS (it will also automatically retrieve TLS certificates for you) and route traffic to [Calendso](https://cal.com/).

You will also be able to access [Prisma Studio](https://www.prisma.io/studio) locally to create your and your team's users.

## Prerequisites

- [Synpse account](https://cloud.synpse.net) - Deployment
- [Cloudflare account](https://cloudflare.com) - DNS (or any other DNS provider)

If you don't have your own DNS domain, just jump in our Discord channel and I will help you out with some alternatives (you can either use Webhook Relay's subdomains or use services like DuckDNS).

## Configure DNS

If you are using Cloudflare, creating an A record looks like this:

![a-record](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxq5di9bxi85vrb3e43h.png)


You can consult your DNS provider's documentation on managing A records.

## Configure port forwarding on your router (optional)

If you server where you are setting this up is within your local network, you will need to expose it to the internet. The easy way to do it is just using your own router to forward the ports:

![port-forward](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19mbva0jr22ss7wope8b.png)
> If you don't have a static IP or your network is behind a CGNAT, you can use [https://webhookrelay.com](https://webhookrelay.com) instead. We will be providing a tutorial on that setup as well.

## Integrating with Google calendar

Bookings are great but it would be tedious to check your Calendso instance every day. To allow Calendso to read from and write to our Google calendar, we need to create API credentials and provide them to Calendso. 

### Enable the API

To do that, head to the Google API console and create a new project. It might take a little bit for Google to set up your project but once that's done, head over to the project and click the Enable APIs and Services button.

Once you click the button, you'll be taken to the API library. In the search box, look for calendar and select the Google Calendar API result and then enable it.

### Retrieve credentials

Next, let's head to our credentials page in the Google API console so we can create the Calendso OAuth ID and add our production origin and redirect URI.

![gcp-creds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jmjgjwhet5u7f1t3aoz.png)
 

Your key will be created and you'll be redirected back to the Credentials page where you will see your newly generated OAuth 2.0 Client ID. Select the download option and save this file to your computer. Copy all the contents of the file and add that as the value for the GOOGLE_API_CREDENTIALS environment variable:

![gcp-creds-secret](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9nnbov8g9lkka5xa649y.png)
 
## Deploy through Synpse

With Synpse we will be deploying multiple containers to provide us with admin capabilities, database, tunneling (to expose it to the internet) and the Calendso itself.

### Preparing the secrets

First, go to your secrets page and create:

- **calendsoPostgres** with your database password
- **calendsoPostgresConnString** with `postgresql://calendso:PASSWORD@postgres:5432/calendso` (just replace PASSWORD with your database password)
- **calendsoEncKey** with a random key that you generate yourself. You can generate one in your terminal with command `openssl rand -base64 32`

![secrets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipy3qvmnyw8iyjemtnf7.png)
 
### Creating the application

The full spec looks like this:

```yaml
# Name of your app
name: synpse-calendso
scheduling:
  type: Conditional
  # Need to match your labels
  # Ref: https://docs.synpse.net/synpse-core/applications/scheduling
  selectors:
    type: controller
spec:
  containers:
    - name: calendso
      image: ctadeu/calendso:0.0.17-1
      env:
        - name: BASE_URL
          value: https://calendar.synpse.net
        - name: NEXTAUTH_URL
          value: https://calendar.synpse.net
        - name: DATABASE_URL
          fromSecret: calendsoPostgresConnString
        - name: CALENDSO_ENCRYPTION_KEY
          fromSecret: calendsoEncKey
        - name: GOOGLE_API_CREDENTIALS
          fromSecret: calendsoGoogleApiCredentials
      restartPolicy: {}
    - name: prisma
      image: codejamninja/prisma-studio:latest
      ports:
        - 5555:5555
      env:
        - name: POSTGRES_URL
          fromSecret: calendsoPostgresConnString
      restartPolicy: {}
    - name: postgres
      image: postgres:latest
      volumes:
        - /data/calendso-postgres:/var/lib/postgresql/data
      env:
        - name: PGDATA
          value: /var/lib/postgresql/data/pgdata
        - name: POSTGRES_USER
          value: calendso
        - name: POSTGRES_DB
          value: calendso
        - name: POSTGRES_PASSWORD
          fromSecret: calendsoPostgres
      restartPolicy: {}
    # Caddy provides HTTPS
    - name: caddy
      image: caddy:latest
      args:
        - caddy
        - reverse-proxy
        - --from
        - calendar.synpse.net:7300 # This should be your domain and port, same as in your router
        - --to
        - calendso:3000
      ports:
        - 7300:7300
      volumes:
        - /data/calendso-caddy:/data
        - /data/calendso-caddy-cfg:/config
      restartPolicy: {}

```

Now, if you click on Allocations, you should see all containers running and in device details you can see the ports:

![synpse-device](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5goljuhlg5vkjaztjuxn.png)
 

If you click on Prisma and if your device is locally reachable, you will be able to access the admin dashboard.

> Please note, that if your device is exposed to the internet, you should not leave the Prisma container with the port exposed.

Once in Prisma, follow the official guide from [self-hosting section](https://docs.cal.com/docs/self-hosting/docker) and:

1. Click on the User model to add a new user record.
2. Fill out the fields (remembering to encrypt your password with [BCrypt](https://bcrypt-generator.com/)) and click Save 1 Record to create your first user.

Once you have logged in, go to the integrations section and connect it with the Google's calendar.

## References

- Calendso docs: [https://docs.cal.com/](https://docs.cal.com/)
- Synpse docs: [https://docs.synpse.net](https://docs.synpse.net)
- Webhook Relay docs: [https://docs.webhookrelay.com](https://docs.webhookrelay.com)
- Cloudflare: [https://cloudflare.com](https://cloudflare.com)
 

> Originally published on https://synpse.net/blog/self-hosting-calendso-caddy/