https://cal.com logo
Join Slack
Powered by
# docker
  • j

    Josh

    12/22/2022, 2:30 AM
    also, i’m running into exactly this 😅… https://github.com/calcom/docker/issues/121 followed the steps to build and did
    DOCKER_BUILDKIT=0 docker compose build calcom
    (all on my dev machine)… one question i have is… does
    docker
    somehow need a connection to the database while building the image? /cc @Colin - Krumware
  • c

    Colin - Krumware

    12/22/2022, 2:33 AM
    You should be able to just use those variables as runtime
    j
    • 2
    • 2
  • c

    Colin - Krumware

    12/22/2022, 2:33 AM
    Yes, a database is required during build due to Prisma and the schema generation, also the migration scripting is currently part of the build. It does not have to be the same database as the one you use at runtime
    j
    • 2
    • 2
  • j

    Josh

    12/22/2022, 4:08 AM
    hmm. i really can’t seem to get the custom docker image building instructions to work. everything works up until the command:
    docker compose up -d database
    then, with my
    .env
    configured to:
    Copy code
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=postgres
    POSTGRES_DB=calendso
    DATABASE_HOST=database:5432
    DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
    i do:
    DOCKER_BUILDKIT=0 docker compose build calcom
    and end up with the error:
    Copy code
    @calcom/prisma:build: Error: P1001: Can't reach database server at `database`:`5432`
    @calcom/prisma:build: 
    @calcom/prisma:build: Please make sure your database server is running at `database`:`5432`.
    @calcom/prisma:build: error Command failed with exit code 1.
    @calcom/prisma:build: info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
    @calcom/prisma:build: error Command failed with exit code 1.
    @calcom/prisma:build: info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
    everything else about the project is stock. any thoughts here?
    e
    n
    • 3
    • 14
  • j

    Josh

    12/22/2022, 5:49 AM
    OK, after spending a few hours on it, i think i figured out a fix: 1. Currently, internal creation of
    DATABASE_URL
    value from the env for the prisma build step seems to be broken. Notice above, where the error message says ‘Error: P1001: Can’t reach database server at `database`:`5432`’. (The additional backtick marks seems suspicious.) What DOES work is passing in this value via the command line, like:
    DOCKER_BUILDKIT=0 docker compose build --build-arg DATABASE_URL=<postgresql://postgres:postgres@host:5432/database> calcom
    . (I tested setting the URL component values in the env to the same values as passed in via the command line like above: The env method failed and the command line method worked.) 2. The LAN IP address of the
    database
    container needs to be used at the command line, not the generic
    database:5432
    addressing. That is, before calling the above command, the user needs to
    docker-compose up database --detach
    ,
    docker exec -it database bash
    , inside the
    database
    container get the LAN IP address via
    hostname -I
    , and then use that value as the appropriate URL host address within the command above. Example:
    DOCKER_BUILDKIT=0 docker compose build --build-arg DATABASE_URL=<postgresql://postgres:postgres@172.24.0.2:5432/database> calcom
    c
    • 2
    • 2
  • z

    zomars

    12/22/2022, 9:16 PM
    @alannnc
    c
    • 2
    • 30
  • c

    Colin - Krumware

    12/22/2022, 9:21 PM
    health checks look like they're configured here https://github.com/calcom/cal.com/blob/main/packages/prisma/docker-compose.yml
  • j

    Josh

    12/23/2022, 2:15 AM
    one note from someone new to Docker and an M1 Mac user… this change is required when building a custom image: https://stackoverflow.com/a/73400257
  • j

    Josh

    12/23/2022, 2:15 AM
    maybe it’s common knowledge to experts, but it’s definitely not to new folks. maybe worth calling that out in the README.md?
  • f

    Fernando Sánchez

    12/23/2022, 11:01 AM
    Hi guys, I am trying to deploy calcom in production, but when we execute the dockerfile using the yarn start, Dockerfile returns a 0 task total result.
    Copy code
    zamas_next  | + scripts/replace-placeholder.sh  
    zamas_next  | Nothing to replace, the value is already set to .
    zamas_next  | + yarn build
    zamas_next  | yarn run v1.22.19
    zamas_next  | $ turbo run build --filter=@calcom/web...
    zamas_next  |  WARNING  cannot find a .git folder. Falling back to manual file hashing (which may be slower). If you are running this build in a pruned directory, you can ignore this message. Otherwise, please initialize a git repos
    itory in the root of your monorepo
    zamas_next  | • Packages in scope: 
    zamas_next  | • Running build in 0 packages
    zamas_next  | 
    zamas_next  |  Tasks:    0 successful, 0 total
    zamas_next  | Cached:    0 cached, 0 total
    zamas_next  |   Time:    2.963s
    zamas_next  | 
    zamas_next  | Done in 5.17s.
    zamas_next  | yarn run v1.22.19
    zamas_next  | $ turbo run start --scope="@calcom/web"
    zamas_next  | • Packages in scope:
    zamas_next  | 
    zamas_next  |  Tasks:    0 successful, 0 total
    zamas_next  | Cached:    0 cached, 0 total
    zamas_next  |   Time:    107ms
    Has anyone experienced this issue? This is my dockerfile
    Copy code
    FROM node:16 as builder
    
    RUN mkdir -p /app
    
    WORKDIR /app
    ARG NEXTAUTH_SECRET=secret
    ARG CALENDSO_ENCRYPTION_KEY=secret
    ARG NEXTAUTH_URL='<https://scheduling.hrbotfactory.com>'
    ARG MAX_OLD_SPACE_SIZE=4096
    
    ENV NEXTAUTH_SECRET=${NEXTAUTH_SECRET} \
        CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY}
    
    COPY package.json yarn.lock turbo.json ./
    COPY packages ./packages
    COPY apps/web ./apps/web
    
    
    RUN yarn global add turbo && \
        yarn config set network-timeout 1000000000 -g && \
        turbo prune --scope=@calcom/web --docker && \
        yarn --global-folder /tmp/yarn/ install
    
    #RUN yarn turbo run build --filter=@calcom/web
    
    FROM node:16 as runner
    
    WORKDIR /app
    
    ARG NEXT_PUBLIC_WEBAPP_URL=<http://localhost:3000>
    
    #ENV NODE_ENV production
    
    RUN apt-get update && \
        apt-get -y install netcat && \
        rm -rf /var/lib/apt/lists/* && \
        npm install --global prisma
    
    COPY package.json yarn.lock turbo.json ./
    COPY --from=builder /app/node_modules ./node_modules
    COPY --from=builder /app/packages ./packages
    COPY --from=builder /app/apps/web ./apps/web
    COPY --from=builder /app/packages/prisma/schema.prisma ./prisma/schema.prisma
    COPY scripts scripts
    
    RUN scripts/replace-placeholder.sh <http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER> ${NEXT_PUBLIC_WEBAPP_URL}
    
    #ENV NODE_ENV development
    
    RUN chmod 777 -R /app/node_modules/.cache/*
    RUN chmod 777 -R /app/node_modules/.cache/turbo
    
    COPY .env ./
    COPY .env.example ./
    COPY .env.appStore.example ./
    
    COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next ./apps/web
    
    
    EXPOSE 3000
    
    CMD ["/app/scripts/start.sh"]
    start.sh file:
    Copy code
    #!/bin/sh
    set -x
    
    # Replace the statically built BUILT_NEXT_PUBLIC_WEBAPP_URL with run-time NEXT_PUBLIC_WEBAPP_URL
    # NOTE: if these values are the same, this will be skipped.
    scripts/replace-placeholder.sh "$BUILT_NEXT_PUBLIC_WEBAPP_URL" "$NEXT_PUBLIC_WEBAPP_URL"
    yarn build
    yarn start
  • j

    Josh

    12/23/2022, 4:17 PM
    @Fernando Sánchez did you initialize the git submodule? Step 3 here: https://github.com/calcom/docker#advanced-users-build-and-run-calcom
  • c

    Colin - Krumware

    12/23/2022, 7:15 PM
    @Fernando Sánchez are you trying to build your own image or just run the public image?
  • f

    Fernando Sánchez

    12/26/2022, 5:02 PM
    Hi @Josh that was the problem, now I can go further but then, it thros the following error. => ERROR [runner 5/10] COPY --from=builder /node_modules ./node_modules 0.0s => ERROR [runner 6/10] COPY --from=builder /packages ./packages 0.0s => ERROR [runner 7/10] COPY --from=builder /apps/web ./apps/web 0.0s => ERROR [runner 8/10] COPY --from=builder /packages/prisma/schema.prisma ./prisma/schema.prisma 0.0s ------ > [runner 5/10] COPY --from=builder /node_modules ./node_modules: ------ ------ > [runner 6/10] COPY --from=builder /packages ./packages: ------ ------ > [runner 7/10] COPY --from=builder /apps/web ./apps/web: ------ ------ > [runner 8/10] COPY --from=builder /packages/prisma/schema.prisma ./prisma/schema.prisma: ------ failed to solve: failed to compute cache key: "/packages/prisma/schema.prisma" not found: not found
    j
    c
    • 3
    • 7
  • n

    Nhan Nguyen

    12/30/2022, 4:43 AM
    Hi self-hosters, any documentations about the server requirements? Something like how are RAM, CPU… for 100 CCU, 1000 CCU… Thanks
  • c

    Colin - Krumware

    12/30/2022, 3:09 PM
    We dont have strict minimums published yet. The requirements are very low for running the image. If you're self-hosting Postgres then also include their recommended amounts in your considerations. I reserved 500ccu and 400mb RAM on my end for the calcom container on its own, think I can still go smaller
  • j

    Josh

    12/30/2022, 6:44 PM
    i’m currently hosting on lightsail and found it necessary to have 2GB RAM. i think that left a few hundred MB of RAM free at idle.
  • j

    Josh

    12/30/2022, 6:45 PM
    if you use the improved geoip csv, that alone will eat 1GB of RAM, IIRC (a comment from the maintainers is floating around the comments of one of the last 2 or 3 releases on github https://github.com/calcom/cal.com/tags)
  • d

    David Billsbrough

    01/03/2023, 9:08 PM
    I'm trying to build on Vultr and have found that the Cloud Compute (1 vCPU, 2 GB, 2.00 TB, 55 GB) VPS errors with heap memory overflow while doing a "yarn build".
  • j

    Jeff Loiselle

    01/03/2023, 9:24 PM
    @David Billsbrough 2GB of memory, yeah? I had to bump up Codespaces default to 8GB today not to get OOM error
  • j

    Jeff Loiselle

    01/03/2023, 9:24 PM
    YMMV ¯\_(ツ)_/¯
  • c

    Colin - Krumware

    01/04/2023, 2:40 PM
    Yea the build is beefy because of all the turborepo stuff, unfortunately
  • c

    Colin - Krumware

    01/04/2023, 2:41 PM
    just curious for my insight/tracking, what are y'all working on that requires the local build versus just pulling the image?
  • j

    Jeff Loiselle

    01/04/2023, 2:42 PM
    @Colin - Krumware Funny you should say that, because I ended up being forced to do that and was lucky I found the docker repo.
  • j

    Jeff Loiselle

    01/04/2023, 2:43 PM
    Thanks for all your hard work on that
  • c

    Colin - Krumware

    01/04/2023, 2:44 PM
    ok sweet
  • j

    Jeff Loiselle

    01/04/2023, 2:44 PM
    https://github.com/calcom/cal.com/pull/6255
  • c

    Colin - Krumware

    01/04/2023, 2:45 PM
    do you want to add the render yaml to the docker repo directly?
  • j

    Jeff Loiselle

    01/04/2023, 2:46 PM
    It needs to be another repo
  • j

    Jeff Loiselle

    01/04/2023, 2:47 PM
    https://github.com/phishy/docker-render
  • j

    Jeff Loiselle

    01/04/2023, 2:47 PM
    It tries to clone the repo and build. It won’t accept images.
1...567...10Latest