Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Calcom template #3251

Merged
merged 2 commits into from
Oct 14, 2024
Merged

Conversation

FranckKe
Copy link
Contributor

Add Calcom template

Docker compose from their Github

Different logos available on their website, included in this pr the white text svg.

@peaklabs-dev peaklabs-dev added the ⚙️ Service Issues requesting or PRs adding/fixing service templates. label Aug 29, 2024
@FranckKe
Copy link
Contributor Author

FranckKe commented Sep 5, 2024

Some variables did not set up as I thought they would like $SERVICE_BASE64_CALCOM_KEY. I do not grasp all of the magic yet, looking for feedback if anyone is testing this.

@SamAmann
Copy link

SamAmann commented Sep 6, 2024

I've managed to make the instance start with this compose.yaml:

version: '3.8'
services:
  calcom:
    image: 'calcom/cal.com:latest'
    environment:
      - 'DATABASE_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'
      - 'DATABASE_DIRECT_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'
      - 'WEBAPP_URL=${SERVICE_FQDN_CALCOM}'
      - 'NEXTAUTH_URL=${SERVICE_FQDN_CALCOM_API_AUTH}'
      - 'NEXTAUTH_SECRET=${SERVICE_BASE64_32_SECRET}'
      - 'CALENDSO_ENCRYPTION_KEY=${SERVICE_BASE64_32_SECRET}'
      - 'NEXT_PUBLIC_WEBAPP_URL=${SERVICE_FQDN_CALCOM}'
      - 'NEXT_PUBLIC_API_V2_URL=${SERVICE_API_V2_URL}'
      - 'CALCOM_TELEMETRY_DISABLED=${CALCOM_TELEMETRY_DISABLED}'
      - 'EMAIL_SERVER_HOST=${SMTP_HOST}'
      - 'EMAIL_SERVER_PORT=${SMTP_PORT}'
      - 'EMAIL_SERVER_USER=${SMTP_USER}'
      - 'EMAIL_SERVER_PASSWORD=${SMTP_PASSWORD}'
      - 'EMAIL_FROM=${MAIL_FROM}'
    depends_on:
      postgres:
        condition: service_healthy
    command: "sh -c \"\n  npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma &&\n  npx prisma db seed --schema /calcom/packages/prisma/schema.prisma &&\n  npm run start\n\"\n"
    healthcheck:
      test:
        - CMD
        - curl
        - '-f'
        - 'http://localhost:3000'
      interval: 30s
      timeout: 10s
      retries: 5
    restart: unless-stopped
  postgres:
    image: 'postgres:16-alpine'
    environment:
      - 'POSTGRES_USER=${SERVICE_USER_POSTGRES}'
      - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}'
      - 'POSTGRES_DB=${POSTGRES_DATABASE:-calcom}'
    volumes:
      - 'calcom-postgresql-data:/var/lib/postgresql/data'
    healthcheck:
      test:
        - CMD-SHELL
        - 'pg_isready -U ${SERVICE_USER_POSTGRES} -d ${POSTGRES_DATABASE:-calcom}'
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped
volumes:
  calcom-postgresql-data: null

However, this instance does not starts "as new", skipping the first user creation...
I'm then unable to connect to it 😅

Anyone has tried something?

EDIT!
OFC it was the command: "sh -c \"\n npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma &&\n npx prisma db seed --schema /calcom/packages/prisma/schema.prisma &&\n npm run start\n\"\n"

Remove it and you are good to go!

Copy link

@SamAmann SamAmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my working version:

version: '3.8'
services:
  calcom:
    image: 'calcom/cal.com:latest'
    environment:
      - 'DATABASE_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'
      - 'DATABASE_DIRECT_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'
      - 'ALLOWED_HOSTNAMES=["${SERVICE_FQDN_CALCOM}"]'
      - 'NEXTAUTH_URL=${SERVICE_FQDN_CALCOM_API_AUTH}'
      - 'NEXTAUTH_SECRET=${SERVICE_BASE64_32_SECRET}'
      - 'CALENDSO_ENCRYPTION_KEY=${SERVICE_BASE64_32_SECRET}'
      - 'NEXT_PUBLIC_WEBAPP_URL=${SERVICE_FQDN_CALCOM}'
      - 'NEXT_PUBLIC_API_V2_URL=${SERVICE_API_V2_URL}'
      - 'CALCOM_TELEMETRY_DISABLED=${CALCOM_TELEMETRY_DISABLED}'
      - 'EMAIL_SERVER_HOST=${SMTP_HOST}'
      - 'EMAIL_SERVER_PORT=${SMTP_PORT}'
      - 'EMAIL_SERVER_USER=${SMTP_USER}'
      - 'EMAIL_SERVER_PASSWORD=${SMTP_PASSWORD}'
      - 'EMAIL_FROM=${MAIL_FROM}'
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test:
        - CMD
        - curl
        - '-f'
        - 'http://localhost:3000'
      interval: 30s
      timeout: 10s
      retries: 5
    restart: unless-stopped
  postgres:
    image: 'postgres:16-alpine'
    environment:
      - 'POSTGRES_USER=${SERVICE_USER_POSTGRES}'
      - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}'
      - 'POSTGRES_DB=${POSTGRES_DATABASE:-calcom}'
    volumes:
      - 'calcom-postgresql-data:/var/lib/postgresql/data'
    healthcheck:
      test:
        - CMD-SHELL
        - 'pg_isready -U ${SERVICE_USER_POSTGRES} -d ${POSTGRES_DATABASE:-calcom}'
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped
volumes:
  calcom-postgresql-data: null

EDIT:
Added the ALLOWED_HOSTNAMES=["${SERVICE_FQDN_CALCOM"] to allow apps to be added (tested with Calendar ICS, which is working as intended).

Removed WEBAPP_URL as deprecated and replaced by NEXT_PUBLIC_WEBAPP_URL wich is already present.

I'm still having some issues (something related to the auth, as I'm regularly getting redirected to the localhost:3000 instead of the next_auth_url).

Copy link

gitguardian bot commented Sep 19, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@morpheus-sapiens-amans
Copy link

Here is my working version:

version: '3.8'
services:
  calcom:
    image: 'calcom/cal.com:latest'
    environment:
      - 'DATABASE_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'
      - 'DATABASE_DIRECT_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'
      - 'ALLOWED_HOSTNAMES=["${SERVICE_FQDN_CALCOM}"]'
      - 'NEXTAUTH_URL=${SERVICE_FQDN_CALCOM_API_AUTH}'
      - 'NEXTAUTH_SECRET=${SERVICE_BASE64_32_SECRET}'
      - 'CALENDSO_ENCRYPTION_KEY=${SERVICE_BASE64_32_SECRET}'
      - 'NEXT_PUBLIC_WEBAPP_URL=${SERVICE_FQDN_CALCOM}'
      - 'NEXT_PUBLIC_API_V2_URL=${SERVICE_API_V2_URL}'
      - 'CALCOM_TELEMETRY_DISABLED=${CALCOM_TELEMETRY_DISABLED}'
      - 'EMAIL_SERVER_HOST=${SMTP_HOST}'
      - 'EMAIL_SERVER_PORT=${SMTP_PORT}'
      - 'EMAIL_SERVER_USER=${SMTP_USER}'
      - 'EMAIL_SERVER_PASSWORD=${SMTP_PASSWORD}'
      - 'EMAIL_FROM=${MAIL_FROM}'
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test:
        - CMD
        - curl
        - '-f'
        - 'http://localhost:3000'
      interval: 30s
      timeout: 10s
      retries: 5
    restart: unless-stopped
  postgres:
    image: 'postgres:16-alpine'
    environment:
      - 'POSTGRES_USER=${SERVICE_USER_POSTGRES}'
      - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}'
      - 'POSTGRES_DB=${POSTGRES_DATABASE:-calcom}'
    volumes:
      - 'calcom-postgresql-data:/var/lib/postgresql/data'
    healthcheck:
      test:
        - CMD-SHELL
        - 'pg_isready -U ${SERVICE_USER_POSTGRES} -d ${POSTGRES_DATABASE:-calcom}'
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped
volumes:
  calcom-postgresql-data: null

EDIT: Added the ALLOWED_HOSTNAMES=["${SERVICE_FQDN_CALCOM"] to allow apps to be added (tested with Calendar ICS, which is working as intended).

Removed WEBAPP_URL as deprecated and replaced by NEXT_PUBLIC_WEBAPP_URL wich is already present.

I'm still having some issues (something related to the auth, as I'm regularly getting redirected to the localhost:3000 instead of the next_auth_url).

I have tried to run calcom on coolify as well. Nor the compose.yml nor the .env-exemple are good to deploy via docker-compose on coolify. Actualy, your template got me the farthest. I see 2 green services, I click to access the link and for a fraction of a second, I can spot the logo and auth-initial login screen, but then the system turns black.

@peaklabs-dev
Copy link
Member

There is another PR open #3503 maybe you guys can work it out together but both of your templates did not work properly in my testing so it would be great if you could fix it and let me know when it works, thanks so much.

@peaklabs-dev peaklabs-dev added the 💤 Waiting for feedback Issues awaiting a response from the author. label Oct 10, 2024
@FranckKe FranckKe force-pushed the add_calcom_template branch from 47efed1 to 4f76dc8 Compare October 12, 2024 19:05
@FranckKe
Copy link
Contributor Author

Thank you for the different feedback, here is an updated version. Completed the onboarding, connected an ICS calendar and tested login/logout without additional configuration.
Please let me know in more details if you have any issues

@peaklabs-dev peaklabs-dev removed the 💤 Waiting for feedback Issues awaiting a response from the author. label Oct 12, 2024
@peaklabs-dev peaklabs-dev self-assigned this Oct 12, 2024
@peaklabs-dev
Copy link
Member

Thank you for the PR 💜. I will test it and fix it if necessary.

@peaklabs-dev peaklabs-dev merged commit ca33f19 into coollabsio:next Oct 14, 2024
1 check passed
@github-actions github-actions bot removed the ⚙️ Service Issues requesting or PRs adding/fixing service templates. label Oct 14, 2024
@DesmondLouis
Copy link

Hi @FranckKe I might be late on my comment but could you consider an update to enable external database usage? As of my last test, this service depends on a PostgreSQL database that is created internally. What if I already have a PostgreSQL database I want to use? How can I configure it?
Fyi @peaklabs-dev

@peaklabs-dev
Copy link
Member

@DesmondLouis You can just remove the Postgres DB form the compose file and add the details of your external DB to the env variabels. Make sure you connect cal.com to the same network as your DB to make it work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants