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

Added cal.com as template #2119

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open

Added cal.com as template #2119

wants to merge 2 commits into from

Conversation

kunumigab
Copy link
Contributor

Scheduling infrastructure for absolutely everyone.

Docker-Compose instructions used here: https://github.com/calcom/docker

Scheduling infrastructure for absolutely everyone.

Docker-Compose instructions used here: https://github.com/calcom/docker
@RayBB
Copy link
Contributor

RayBB commented May 2, 2024

@kunumigab
Not a maintainer but two small bits of feedback based on what I've seen in this repo:

  1. Usually the app service goes before the database service in the compose file (probably just so it's higher up when you edit variables)
  2. Usually template files end with a newline

Unfortunately, I can't test this right now since my main server is ARM.

@RayBB
Copy link
Contributor

RayBB commented May 13, 2024

@andrasbacsai any chance you could review this PR this week?
@kunumigab

@SamAmann
Copy link

@kunumigab

Love, the idea, could really use the template!

I've tried your file, but encountered some hiccups.

What I've done

I've used your docker compose file to install Cal on a coolify instance using the wildcard domain <domain.com>.
My coolify instance is accessible in https://coolify.<domain.com>.
The instance is used to deploy a Next.js web app that is successfully working on https://app.<domain.com>
This is relevant as my issues are related to the proxy not delivering the cert for my Cal instance.
So the proxy IS working correctly in other usage of my coolify instance.

The docker compose ressource is installed on the same 'localhost' server than my coolify instance.

I've tried both to set a custom url for the 'Calcom' service (https://cal.<domain.com>) or to leave it empty (trying to reach it with IP address).

The services are successfully spinning on start up, even if the Calcom service is flagged as 'unhealthy'.

Here are the deployement logs:

Saved configuration files to /data/coolify/services/bskokk8.
Creating Docker network.
Starting service.
Pulling images.
 postgres Pulling 
 calcom Pulling 
 postgres Pulled 
 calcom Pulled 
Starting containers.
 Container postgres-bskokk8  Creating
 Container postgres-bskokk8  Created
 Container calcom-bskokk8  Creating
 Container calcom-bskokk8  Created
 Container postgres-bskokk8  Starting
 Container postgres-bskokk8  Started
 Container calcom-bskokk8  Starting
 Container calcom-bskokk8  Started

My faced issues

Calcom service logs

I have issues with the prismaClient, something to do with the base user table not being properly created?
This error repeat itself every few seconds.

2024-05-31T13:28:37.521481964Z @calcom/web:start: 13:28:37:520	ERROR[redactError] Error:  {"name":"PrismaClientKnownRequestError","code":"P2021","clientVersion":"5.4.2","meta":{"table":"public.Feature"}}
2024-05-31T13:28:37.530654313Z @calcom/web:start: PrismaClientKnownRequestError: 
2024-05-31T13:28:37.530676055Z @calcom/web:start: Invalid `prisma.user.count()` invocation:
2024-05-31T13:28:37.530685713Z @calcom/web:start: 
2024-05-31T13:28:37.530693218Z @calcom/web:start: 
2024-05-31T13:28:37.530699580Z @calcom/web:start: The table `public.users` does not exist in the current database.
2024-05-31T13:28:37.530708577Z @calcom/web:start:     at Cn.handleRequestError (/calcom/node_modules/@prisma/client/runtime/library.js:123:6817)
2024-05-31T13:28:37.530717594Z @calcom/web:start:     at Cn.handleAndLogRequestError (/calcom/node_modules/@prisma/client/runtime/library.js:123:6206)
2024-05-31T13:28:37.530726402Z @calcom/web:start:     at Cn.request (/calcom/node_modules/@prisma/client/runtime/library.js:123:5926)
2024-05-31T13:28:37.530734707Z @calcom/web:start:     at async l (/calcom/node_modules/@prisma/client/runtime/library.js:128:9968)
2024-05-31T13:28:37.530743194Z @calcom/web:start:     at async getServerSideProps (/calcom/apps/web/.next/server/pages/auth/login.js:1:11918) {
2024-05-31T13:28:37.530751269Z @calcom/web:start:   code: 'P2021',
2024-05-31T13:28:37.530758384Z @calcom/web:start:   clientVersion: '5.4.2',
2024-05-31T13:28:37.530766269Z @calcom/web:start:   meta: { table: 'public.users' }
2024-05-31T13:28:37.530771628Z @calcom/web:start: }

Calcom service target URL

I've tried both to leave empty the domain or to fill it with a subdomain, and both have the same result: No cert is created.
I've checked the proxy logs, nothing comes from there (I mean really nothing, no error logs, no success, it seems that it does not even try to obtain a cert).
Result is, even if the service is running (but flagged as 'unhealthy' though), it is impossible to reach the URL, as browser blocks the connexion due to unsecured address. It's not a 404 error, it's just not secured so browser won't connect to it.

Same as @RayBB, I'm no maintainers or nothing to the project.
I've just had the occasion to test out the docker compose file, so I did 😄

After some time on the Discord, (thanks a lot again @iamEvanYT for your time and explanations!), we couldn't find any workaround so I figure here maybe someone has one, or it can help improve the template.

Hope this helps,

@CuvlBoi
Copy link

CuvlBoi commented Jun 1, 2024

Hey i have just solved this issue. I will also help you with the next issue you will be facing :)

I really have no idea why this is the case. I found the scripts from https://github.com/calcom/docker/blob/main/scripts/start.sh that is run during build.

npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma

I have run this from command line that is present in coolify dashboard. It gave me the error that DATABASE_DIRECT_URL is not set. Eventhough read me from calcom docker repo says it is optional. I think in this case it is required.

You need to add the following to the docker compose as well for the calcom.

     - 'DATABASE_DIRECT_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'

Then after you create a admin account. You will not be able to get admin privileges, because you can't set a 2fa.

This problem is because of these lines:
- 'NEXTAUTH_SECRET=${SERVICE_BASE64_64_SECRET}' - 'CALENDSO_ENCRYPTION_KEY=${SERVICE_BASE64_64_SECRET}'

If you inspect console logs it will say "ERR_CRYPTO_INVALID_KEYLEN". Because CALENDSO_ENCRYPTION_KEY is too long for this. I have used the following command that i found in original calcom/cal example .env file.
dd if=/dev/urandom bs=1K count=1 | md5sum

When i set this new secret for CALENDSO_ENCRYPTION_KEY. Everything seems to be working fine. I am trying to set my instance up. If i face anything i will let you know.

@CuvlBoi
Copy link

CuvlBoi commented Jun 1, 2024

@SamAmann @kunumigab sorry forgot to mention you guys :)

@kunumigab
Copy link
Contributor Author

kunumigab commented Jun 1, 2024

Hey i have just solved this issue. I will also help you with the next issue you will be facing :)

I really have no idea why this is the case. I found the scripts from https://github.com/calcom/docker/blob/main/scripts/start.sh that is run during build.

npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma

I have run this from command line that is present in coolify dashboard. It gave me the error that DATABASE_DIRECT_URL is not set. Eventhough read me from calcom docker repo says it is optional. I think in this case it is required.

You need to add the following to the docker compose as well for the calcom.

     - 'DATABASE_DIRECT_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DATABASE:-calcom}'

Then after you create a admin account. You will not be able to get admin privileges, because you can't set a 2fa.

This problem is because of these lines: - 'NEXTAUTH_SECRET=${SERVICE_BASE64_64_SECRET}' - 'CALENDSO_ENCRYPTION_KEY=${SERVICE_BASE64_64_SECRET}'

If you inspect console logs it will say "ERR_CRYPTO_INVALID_KEYLEN". Because CALENDSO_ENCRYPTION_KEY is too long for this. I have used the following command that i found in original calcom/cal example .env file. dd if=/dev/urandom bs=1K count=1 | md5sum

When i set this new secret for CALENDSO_ENCRYPTION_KEY. Everything seems to be working fine. I am trying to set my instance up. If i face anything i will let you know.

Hey!, Can you test this again?, I don't have a x86 server right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants