Compare commits

..

1 Commits

Author SHA1 Message Date
actions-user
a2dccc1156 tag version Cal.com version v3.5.2 2023-11-23 16:58:06 +00:00
10 changed files with 224 additions and 258 deletions

View File

@@ -13,7 +13,6 @@ LICENSE=
# NEXT_PUBLIC_APP_URL=http://localhost:3000 # NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000 NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
NEXT_PUBLIC_API_V2_URL=http://localhost:5555/api/v2
# Configure NEXTAUTH_URL manually if needed, otherwise it will resolve to {NEXT_PUBLIC_WEBAPP_URL}/api/auth # Configure NEXTAUTH_URL manually if needed, otherwise it will resolve to {NEXT_PUBLIC_WEBAPP_URL}/api/auth
# NEXTAUTH_URL=http://localhost:3000/api/auth # NEXTAUTH_URL=http://localhost:3000/api/auth
@@ -33,9 +32,6 @@ POSTGRES_PASSWORD=magical_password
POSTGRES_DB=calendso POSTGRES_DB=calendso
DATABASE_HOST=database:5432 DATABASE_HOST=database:5432
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB} DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
# Needed to run migrations while using a connection pooler like PgBouncer
# Use the same one as DATABASE_URL if you're not using a connection pooler
DATABASE_DIRECT_URL=${DATABASE_URL}
GOOGLE_API_CREDENTIALS={} GOOGLE_API_CREDENTIALS={}
# Set this to '1' if you don't want Cal to collect anonymous usage # Set this to '1' if you don't want Cal to collect anonymous usage
@@ -51,7 +47,6 @@ ZOOM_CLIENT_SECRET=
# E-mail settings # E-mail settings
# Configures the global From: header whilst sending emails. # Configures the global From: header whilst sending emails.
EMAIL_FROM_NAME=YourOrganizationName
EMAIL_FROM=notifications@example.com EMAIL_FROM=notifications@example.com
# Configure SMTP settings (@see https://nodemailer.com/smtp/). # Configure SMTP settings (@see https://nodemailer.com/smtp/).

View File

@@ -1,77 +1,59 @@
name: "Create Gitea Release" name: "Create Release"
# This workflow is triggered manually from the Gitea Actions UI on: # yamllint disable-line rule:truthy
on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
RELEASE_TAG: RELEASE_TAG:
description: 'The release tag to create, formatted as v{Major}.{Minor}.{Patch}' description: 'v{Major}.{Minor}.{Patch}'
required: true
jobs: jobs:
release: release:
name: "Release" name: "Release"
permissions:
contents: write
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
# Step 1: Check out the repository source code and its submodules.
# The TOKEN_GITEA is used here to grant permission for the later 'git push'.
- name: Checkout source - name: Checkout source
uses: "actions/checkout@v4" uses: actions/checkout@v3
with: with:
token: ${{ secrets.TOKEN_GITEA }} token: ${{ secrets.ACTIONS_ACCESS_TOKEN }}
submodules: true submodules: true
# Step 2: Create a new release branch, update the submodule to the specified tag, - name: Create branch and tag submodule
# and push the new branch to the Gitea repository.
- name: Create Branch and Update Submodule
run: | run: |
# Configure git user for the commit git config user.email "actions@github.com"
git config user.email "actions@gitea.local" git config user.name "actions-user"
git config user.name "Gitea Actions" git submodule update --init --remote
# Create the new release branch
git checkout -b 'release-${{ inputs.RELEASE_TAG }}' git checkout -b 'release-${{ inputs.RELEASE_TAG }}'
# Enter the submodule directory, fetch the latest tags, and check out the correct one.
# This points the submodule to the specific commit associated with the release tag.
(cd calcom && git fetch --tags origin && git checkout 'refs/tags/${{ inputs.RELEASE_TAG }}') (cd calcom && git fetch --tags origin && git checkout 'refs/tags/${{ inputs.RELEASE_TAG }}')
# Stage and commit the change to the submodule pointer
git add calcom git add calcom
git commit -m "Update submodule to Cal.com version ${{ inputs.RELEASE_TAG }}" git commit -m "tag version Cal.com version ${{ inputs.RELEASE_TAG }}"
# Push the newly created release branch to the remote Gitea repository
git push origin 'release-${{ inputs.RELEASE_TAG }}' git push origin 'release-${{ inputs.RELEASE_TAG }}'
# Step 3: Call the Gitea API to create the official release object. # note: instead of secrets.GITHUB_TOKEN here, we need to use a PAT
# This uses the same API token to authorize the action. # so that the release creation triggers the image build workflow
- name: "Create Gitea Release" - name: "Create release"
env: uses: "actions/github-script@v6"
GITEA_TOKEN: ${{ secrets.TOKEN_GITEA }} with:
GITEA_API_URL: https://git.nethery.dev/api/v1 github-token: "${{ secrets.ACTIONS_ACCESS_TOKEN }}"
OWNER: ${{ gitea.repository_owner }} script: |
REPO: ${{ gitea.repository_name }} try {
run: | const response = await github.rest.repos.createRelease({
# Determine if the tag indicates a pre-release draft: false,
is_prerelease=false generate_release_notes: true,
if [[ "${{ inputs.RELEASE_TAG }}" == *"-rc"* || "${{ inputs.RELEASE_TAG }}" == *"-beta"* ]]; then body: 'For Cal.com release details, see: https://github.com/calcom/cal.com/releases/tag/${{ inputs.RELEASE_TAG }}',
is_prerelease=true name: '${{ inputs.RELEASE_TAG }}',
fi target_commitish: 'release-${{ inputs.RELEASE_TAG }}',
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: '${{ inputs.RELEASE_TAG }}',
});
echo "Creating release ${{ inputs.RELEASE_TAG }}..." core.exportVariable('RELEASE_ID', response.data.id);
echo "Is prerelease: $is_prerelease" core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
# Use curl to send a POST request to the Gitea API's 'create release' endpoint core.setFailed(error.message);
curl --fail --silent --show-error -L -X POST \ }
-H "accept: application/json" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${GITEA_API_URL}/repos/${OWNER}/${REPO}/releases" \
-d '{
"tag_name": "${{ inputs.RELEASE_TAG }}",
"target_commitish": "release-${{ inputs.RELEASE_TAG }}",
"name": "${{ inputs.RELEASE_TAG }}",
"body": "For Cal.com release details, see: https://github.com/calcom/cal.com/releases/tag/${{ inputs.RELEASE_TAG }}",
"prerelease": '${is_prerelease}'
}'

View File

@@ -20,7 +20,7 @@ on:
# Uncomment below to allow specific version workflow run # Uncomment below to allow specific version workflow run
# inputs: # inputs:
# version: # version:
# description: 'Version to build' # description: 'Version to build'
# required: true # required: true
# Leaving in example for releases. Initially we simply push to 'latest' # Leaving in example for releases. Initially we simply push to 'latest'
@@ -37,52 +37,44 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# Free about 4.5 GB, elminating our disk space issues
tool-cache: true
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it, uncomment below # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it, uncomment below
# - name: Checkout code at specified version # - name: Checkout code at specified version
# uses: actions/checkout@v2 # uses: actions/checkout@v2
# with: # with:
# ref: ${{ github.event.inputs.version }} # ref: ${{ github.event.inputs.version }}
- name: Base requirements
run: |
# packages
apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Git submodule update - name: Git submodule update
run: | run: |
git submodule update --init git submodule update --init
- name: Log in to the Docker Hub registry - name: Log in to the Docker Hub registry
uses: docker/login-action@v3 uses: docker/login-action@v2
with: with:
# Username used to log against the Docker registry
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.DOCKER_HUB_TOKEN }} password: ${{ secrets.DOCKER_HUB_TOKEN }}
# Log out from the Docker registry at the end of a job
logout: true # optional, default is true
- name: Log in to the Github Container registry - name: Log in to the Github Container registry
uses: docker/login-action@v3 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: nnethery username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v4
with: with:
images: | images: |
ghcr.io/nnethery/cal.com docker.io/calendso/calendso
nnethery/cal.com docker.io/calcom/cal.com
flavor: | ghcr.io/calcom/cal.com
latest=${{ !github.event.release.prerelease }}
- name: Copy env - name: Copy env
run: | run: |
@@ -92,107 +84,110 @@ jobs:
eval $(sed -e '/^#/d' -e 's/^/export /' -e 's/$/;/' .env) ; eval $(sed -e '/^#/d' -e 's/^/export /' -e 's/$/;/' .env) ;
# Temporarily disable ARM build due to runner performance issues # Temporarily disable ARM build due to runner performance issues
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
- name: Start database - name: Start database
run: | run: |
docker compose up -d database docker compose up -d database
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v2
with: with:
driver-opts: | driver-opts: |
network=container:database network=container:database
buildkitd-flags: | buildkitd-flags: |
--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
# config-inline: | # config-inline: |
# [worker.oci] # [worker.oci]
# max-parallelism = 1 # max-parallelism = 1
- name: Build image - name: Build image
id: docker_build id: docker_build
uses: docker/build-push-action@v5 uses: docker/build-push-action@v4
with: with:
context: ./ context: ./
file: ./Dockerfile file: ./Dockerfile
load: true # Load the image into the Docker daemon load: true # Load the image into the Docker daemon
push: false # Do not push the image at this stage push: false # Do not push the image at this stage
platforms: linux/arm64 # Changed from linux/amd64 platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
build-args: | build-args: |
NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }} NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }}
NEXT_PUBLIC_API_V2_URL=${{ env.NEXT_PUBLIC_API_V2_URL }}
NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }} NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }}
NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }} NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }}
DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }} DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
DATABASE_DIRECT_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
# - name: Test runtime - name: Test runtime
run: |
tags="${{ steps.meta.outputs.tags }}"
IFS=',' read -ra ADDR <<< "$tags" # Convert string to array using ',' as delimiter
tag=${ADDR[0]} # Get the first tag
docker run --rm --network stack \
-p 3000:3000 \
-e DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@database/${{ env.POSTGRES_DB }} \
-e NEXTAUTH_SECRET=${{ env.NEXTAUTH_SECRET }} \
-e CALENDSO_ENCRYPTION_KEY=${{ env.CALENDSO_ENCRYPTION_KEY }} \
$tag &
server_pid=$!
echo "Waiting for the server to start..."
sleep 120
echo ${{ env.NEXT_PUBLIC_WEBAPP_URL }}/auth/login
for i in {1..60}; do
echo "Checking server health ($i/60)..."
response=$(curl -o /dev/null -s -w "%{http_code}" ${{ env.NEXT_PUBLIC_WEBAPP_URL }}/auth/login)
echo "HTTP Status Code: $response"
if [[ "$response" == "200" ]] || [[ "$response" == "307" ]]; then
echo "Server is healthy"
# Now, shutdown the server
kill $server_pid
exit 0
fi
sleep 1
done
echo "Server health check failed"
kill $server_pid
exit 1
env:
NEXTAUTH_SECRET: 'EI4qqDpcfdvf4A+0aQEEx8JjHxHSy4uWiZw/F32K+pA='
CALENDSO_ENCRYPTION_KEY: '0zfLtY99wjeLnsM7qsa8xsT+Q0oSgnOL'
# - name: Push image
# run: | # run: |
# tags="${{ steps.meta.outputs.tags }}" # tags="${{ steps.meta.outputs.tags }}"
# IFS=',' read -ra ADDR <<< "$tags" # Convert string to array using ',' as delimiter # IFS=',' read -ra ADDR <<< "$tags" # Convert string to array using ',' as delimiter
# tag=${ADDR[0]} # Get the first tag # for tag in "${ADDR[@]}"; do
# docker push $tag
# docker run --rm --network stack \ # done
# -p 3000:3000 \
# -e DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@database/${{ env.POSTGRES_DB }} \
# -e DATABASE_DIRECT_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@database/${{ env.POSTGRES_DB }} \
# -e NEXTAUTH_SECRET=${{ env.NEXTAUTH_SECRET }} \
# -e CALENDSO_ENCRYPTION_KEY=${{ env.CALENDSO_ENCRYPTION_KEY }} \
# $tag &
# server_pid=$!
# echo "Waiting for the server to start..."
# sleep 120
# echo ${{ env.NEXT_PUBLIC_WEBAPP_URL }}/auth/login
# apk add curl
# for i in {1..60}; do
# echo "Checking server health ($i/60)..."
# response=$(curl -o /dev/null -s -w "%{http_code}" ${{ env.NEXT_PUBLIC_WEBAPP_URL }}/auth/login)
# echo "HTTP Status Code: $response"
# if [[ "$response" == "200" ]] || [[ "$response" == "307" ]]; then
# echo "Server is healthy"
# # Now, shutdown the server
# kill $server_pid
# exit 0
# fi
# sleep 1
# done
# echo "Server health check failed"
# kill $server_pid
# exit 1
# env:
# NEXTAUTH_SECRET: 'EI4qqDpcfdvf4A+0aQEEx8JjHxHSy4uWiZw/F32K+pA='
# CALENDSO_ENCRYPTION_KEY: '0zfLtY99wjeLnsM7qsa8xsT+Q0oSgnOL'
- name: Push image - name: Push image
id: docker_push id: docker_push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v4
with: with:
context: ./ context: ./
file: ./Dockerfile file: ./Dockerfile
push: true push: true
platforms: linux/arm64 # Changed from linux/amd64 platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
build-args: | build-args: |
NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }} NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }}
NEXT_PUBLIC_API_V2_URL=${{ env.NEXT_PUBLIC_API_V2_URL }}
NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }} NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }}
NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }} NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }}
DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }} DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
DATABASE_DIRECT_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
if: ${{ !github.event.release.prerelease }}
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}
- name: Cleanup - name: Cleanup
run: | run: |
docker compose down docker compose down

14
.github/workflows/scarf-data-export.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Export Scarf data
on:
schedule:
- cron: '0 0 * * *'
jobs:
export-scarf-data:
runs-on: ubuntu-latest
steps:
- uses: docker://scarf.docker.scarf.sh/scarf-sh/scarf-postgres-exporter:latest
env:
SCARF_API_TOKEN: ${{ secrets.SCARF_API_TOKEN }}
SCARF_ENTITY_NAME: Calcom
PSQL_CONN_STRING: ${{ secrets.PSQL_CONN_STRING }}

View File

@@ -1,87 +1,75 @@
FROM node:18 AS builder FROM node:18 as builder
WORKDIR /calcom WORKDIR /calcom
ARG NEXT_PUBLIC_LICENSE_CONSENT ARG NEXT_PUBLIC_LICENSE_CONSENT
ARG NEXT_PUBLIC_WEBSITE_TERMS_URL ARG CALCOM_TELEMETRY_DISABLED
ARG NEXT_PUBLIC_WEBSITE_PRIVACY_POLICY_URL ARG DATABASE_URL
ARG CALCOM_TELEMETRY_DISABLED ARG NEXTAUTH_SECRET=secret
ARG DATABASE_URL ARG CALENDSO_ENCRYPTION_KEY=secret
ARG NEXTAUTH_SECRET=secret ARG MAX_OLD_SPACE_SIZE=4096
ARG CALENDSO_ENCRYPTION_KEY=secret
ARG MAX_OLD_SPACE_SIZE=4096 ENV NEXT_PUBLIC_WEBAPP_URL=http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER \
ARG NEXT_PUBLIC_API_V2_URL NEXT_PUBLIC_LICENSE_CONSENT=$NEXT_PUBLIC_LICENSE_CONSENT \
CALCOM_TELEMETRY_DISABLED=$CALCOM_TELEMETRY_DISABLED \
ENV NEXT_PUBLIC_WEBAPP_URL=http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER \ DATABASE_URL=$DATABASE_URL \
NEXT_PUBLIC_API_V2_URL=$NEXT_PUBLIC_API_V2_URL \ NEXTAUTH_SECRET=${NEXTAUTH_SECRET} \
NEXT_PUBLIC_LICENSE_CONSENT=$NEXT_PUBLIC_LICENSE_CONSENT \ CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY} \
NEXT_PUBLIC_WEBSITE_TERMS_URL=$NEXT_PUBLIC_WEBSITE_TERMS_URL \ NODE_OPTIONS=--max-old-space-size=${MAX_OLD_SPACE_SIZE}
NEXT_PUBLIC_WEBSITE_PRIVACY_POLICY_URL=$NEXT_PUBLIC_WEBSITE_PRIVACY_POLICY_URL \
CALCOM_TELEMETRY_DISABLED=$CALCOM_TELEMETRY_DISABLED \ COPY calcom/package.json calcom/yarn.lock calcom/.yarnrc.yml calcom/playwright.config.ts calcom/turbo.json calcom/git-init.sh calcom/git-setup.sh ./
DATABASE_URL=$DATABASE_URL \ COPY calcom/.yarn ./.yarn
DATABASE_DIRECT_URL=$DATABASE_URL \ COPY calcom/apps/web ./apps/web
NEXTAUTH_SECRET=${NEXTAUTH_SECRET} \ COPY calcom/packages ./packages
CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY} \ COPY calcom/tests ./tests
NODE_OPTIONS=--max-old-space-size=${MAX_OLD_SPACE_SIZE} \
BUILD_STANDALONE=true RUN yarn config set httpTimeout 1200000 && \
npx turbo prune --scope=@calcom/web --docker && \
COPY calcom/package.json calcom/yarn.lock calcom/.yarnrc.yml calcom/playwright.config.ts calcom/turbo.json calcom/i18n.json ./ yarn install && \
COPY calcom/.yarn ./.yarn yarn db-deploy && \
COPY calcom/apps/web ./apps/web yarn --cwd packages/prisma seed-app-store
COPY calcom/apps/api/v2 ./apps/api/v2
COPY calcom/packages ./packages RUN yarn turbo run build --filter=@calcom/web
COPY calcom/tests ./tests
# RUN yarn plugin import workspace-tools && \
RUN yarn config set httpTimeout 1200000 # yarn workspaces focus --all --production
RUN npx turbo prune --scope=@calcom/web --scope=@calcom/trpc --docker RUN rm -rf node_modules/.cache .yarn/cache apps/web/.next/cache
RUN yarn install
RUN yarn db-deploy FROM node:18 as builder-two
RUN yarn --cwd packages/prisma seed-app-store
# Build and make embed servable from web/public/embed folder WORKDIR /calcom
RUN yarn workspace @calcom/trpc run build ARG NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
RUN yarn --cwd packages/embeds/embed-core workspace @calcom/embed-core run build
RUN yarn --cwd apps/web workspace @calcom/web run build ENV NODE_ENV production
# RUN yarn plugin import workspace-tools && \ COPY calcom/package.json calcom/.yarnrc.yml calcom/yarn.lock calcom/turbo.json ./
# yarn workspaces focus --all --production COPY calcom/.yarn ./.yarn
RUN rm -rf node_modules/.cache .yarn/cache apps/web/.next/cache COPY --from=builder /calcom/node_modules ./node_modules
COPY --from=builder /calcom/packages ./packages
FROM node:18 AS builder-two COPY --from=builder /calcom/apps/web ./apps/web
COPY --from=builder /calcom/packages/prisma/schema.prisma ./prisma/schema.prisma
WORKDIR /calcom COPY scripts scripts
ARG NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
# Save value used during this build stage. If NEXT_PUBLIC_WEBAPP_URL and BUILT_NEXT_PUBLIC_WEBAPP_URL differ at
ENV NODE_ENV=production # run-time, then start.sh will find/replace static values again.
ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \
COPY calcom/package.json calcom/.yarnrc.yml calcom/turbo.json calcom/i18n.json ./ BUILT_NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL
COPY calcom/.yarn ./.yarn
COPY --from=builder /calcom/yarn.lock ./yarn.lock RUN scripts/replace-placeholder.sh http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER ${NEXT_PUBLIC_WEBAPP_URL}
COPY --from=builder /calcom/node_modules ./node_modules
COPY --from=builder /calcom/packages ./packages FROM node:18 as runner
COPY --from=builder /calcom/apps/web ./apps/web
COPY --from=builder /calcom/packages/prisma/schema.prisma ./prisma/schema.prisma
COPY scripts scripts WORKDIR /calcom
COPY --from=builder-two /calcom ./
# Save value used during this build stage. If NEXT_PUBLIC_WEBAPP_URL and BUILT_NEXT_PUBLIC_WEBAPP_URL differ at ARG NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
# run-time, then start.sh will find/replace static values again. ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \
ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \ BUILT_NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL
BUILT_NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL
ENV NODE_ENV production
RUN scripts/replace-placeholder.sh http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER ${NEXT_PUBLIC_WEBAPP_URL} EXPOSE 3000
FROM node:18 AS runner HEALTHCHECK --interval=30s --timeout=30s --retries=5 \
CMD wget --spider http://localhost:3000 || exit 1
WORKDIR /calcom CMD ["/calcom/scripts/start.sh"]
COPY --from=builder-two /calcom ./
ARG NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \
BUILT_NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL
ENV NODE_ENV=production
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=30s --retries=5 \
CMD wget --spider http://localhost:3000 || exit 1
CMD ["/calcom/scripts/start.sh"]

View File

@@ -52,7 +52,7 @@ If you are evaluating Cal.com or running with minimal to no modifications, this
1. Clone calcom/docker 1. Clone calcom/docker
```bash ```bash
git clone --recursive https://github.com/calcom/docker.git git clone https://github.com/calcom/docker.git
``` ```
2. Change into the directory 2. Change into the directory
@@ -67,24 +67,24 @@ If you are evaluating Cal.com or running with minimal to no modifications, this
cp .env.example .env cp .env.example .env
``` ```
Most configurations can be left as-is, but for configuration options see [Important Run-time variables](#important-run-time-variables) below. Most configurations can be left as-is, but for configuration options see [Important Run-time variables](#important-run-time-variables) below.
Update the appropriate values in your .env file, then proceed. Update the appropriate values in your .env file, then proceed.
4. (optional) Pre-Pull the images by running the following command: 4. (optional) Pre-Pull the images by running the following command:
```bash ```bash
docker compose pull docker compose pull
``` ```
This will use the default image locations as specified by `image:` in the docker-compose.yaml file. This will use the default image locations as specified by `image:` in the docker-compose.yaml file.
Note: To aid with support, by default Scarf.sh is used as registry proxy for download metrics. Note: To aid with support, by default Scarf.sh is used as registry proxy for download metrics.
5. Start Cal.com via docker compose 5. Start Cal.com via docker compose
(Most basic users, and for First Run) To run the complete stack, which includes a local Postgres database, Cal.com web app, and Prisma Studio: (Most basic users, and for First Run) To run the complete stack, which includes a local Postgres database, Cal.com web app, and Prisma Studio:
```bash ```bash
docker compose up -d docker compose up -d
``` ```
@@ -139,7 +139,7 @@ If you are evaluating Cal.com or running with minimal to no modifications, this
cd calcom-docker cd calcom-docker
``` ```
3. Update the calcom submodule. 3. Update the calcom submodule.
```bash ```bash
git submodule update --remote --init git submodule update --remote --init
@@ -151,7 +151,7 @@ If you are evaluating Cal.com or running with minimal to no modifications, this
For configuration options see [Build-time variables](#build-time-variables) below. Update the appropriate values in your .env file, then proceed. For configuration options see [Build-time variables](#build-time-variables) below. Update the appropriate values in your .env file, then proceed.
5. Build the Cal.com docker image: 5. Build the Cal.com docker image:
Note: Due to application configuration requirements, an available database is currently required during the build process. Note: Due to application configuration requirements, an available database is currently required during the build process.
@@ -206,24 +206,20 @@ These variables must also be provided at runtime
| NEXTAUTH_URL | Location of the auth server. By default, this is the Cal.com docker instance itself. | optional | `{NEXT_PUBLIC_WEBAPP_URL}/api/auth` | | NEXTAUTH_URL | Location of the auth server. By default, this is the Cal.com docker instance itself. | optional | `{NEXT_PUBLIC_WEBAPP_URL}/api/auth` |
| NEXTAUTH_SECRET | must match build variable | required | `secret` | | NEXTAUTH_SECRET | must match build variable | required | `secret` |
| CALENDSO_ENCRYPTION_KEY | must match build variable | required | `secret` | | CALENDSO_ENCRYPTION_KEY | must match build variable | required | `secret` |
| DATABASE_URL | database url with credentials - if using a connection pooler, this setting should point there | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` | | DATABASE_URL | database url with credentials | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` |
| DATABASE_DIRECT_URL | direct database url with credentials if using a connection pooler (e.g. PgBouncer, Prisma Accelerate, etc.) | optional | |
### Build-time variables ### Build-time variables
If building the image yourself, these variables must be provided at the time of the docker build, and can be provided by updating the .env file. Currently, if you require changes to these variables, you must follow the instructions to build and publish your own image. If building the image yourself, these variables must be provided at the time of the docker build, and can be provided by updating the .env file. Currently, if you require changes to these variables, you must follow the instructions to build and publish your own image.
Updating these variables is not required for evaluation, but is required for running in production. Instructions for generating variables can be found in the [cal.com instructions](https://github.com/calcom/cal.com) Updating these variables is not required for evaluation, but is required for running in production. Instructions for generating variables can be found in the [cal.com instructions](https://github.com/calcom/cal.com)
| Variable | Description | Required | Default | | Variable | Description | Required | Default |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| NEXT_PUBLIC_WEBAPP_URL | Base URL injected into static files | optional | `http://localhost:3000` | | NEXT_PUBLIC_WEBAPP_URL | Base URL injected into static files | optional | `http://localhost:3000` |
| NEXT_PUBLIC_LICENSE_CONSENT | license consent - true/false | | | | NEXT_PUBLIC_LICENSE_CONSENT | license consent - true/false | | |
| NEXT_PUBLIC_WEBSITE_TERMS_URL | custom URL for terms and conditions website | optional | `https://cal.com/terms` |
| NEXT_PUBLIC_WEBSITE_PRIVACY_POLICY_URL | custom URL for privacy policy website | optional | `https://cal.com/privacy` |
| CALCOM_TELEMETRY_DISABLED | Allow cal.com to collect anonymous usage data (set to `1` to disable) | | | | CALCOM_TELEMETRY_DISABLED | Allow cal.com to collect anonymous usage data (set to `1` to disable) | | |
| DATABASE_URL | database url with credentials - if using a connection pooler, this setting should point there | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` | | DATABASE_URL | database url with credentials | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` |
| DATABASE_DIRECT_URL | direct database url with credentials if using a connection pooler (e.g. PgBouncer, Prisma Accelerate, etc.) | optional | |
| NEXTAUTH_SECRET | Cookie encryption key | required | `secret` | | NEXTAUTH_SECRET | Cookie encryption key | required | `secret` |
| CALENDSO_ENCRYPTION_KEY | Authentication encryption key | required | `secret` | | CALENDSO_ENCRYPTION_KEY | Authentication encryption key | required | `secret` |
@@ -253,7 +249,7 @@ Certain versions may have trouble creating a user if the field `metadata` is emp
If you experience this error, it may be the way the default Auth callback in the server is using the WEBAPP_URL as a base url. The container does not necessarily have access to the same DNS as your local machine, and therefor needs to be configured to resolve to itself. You may be able to correct this by configuring `NEXTAUTH_URL=http://localhost:3000/api/auth`, to help the backend loop back to itself. If you experience this error, it may be the way the default Auth callback in the server is using the WEBAPP_URL as a base url. The container does not necessarily have access to the same DNS as your local machine, and therefor needs to be configured to resolve to itself. You may be able to correct this by configuring `NEXTAUTH_URL=http://localhost:3000/api/auth`, to help the backend loop back to itself.
``` ```
docker-calcom-1 | @calcom/web:start: [next-auth][error][CLIENT_FETCH_ERROR] docker-calcom-1 | @calcom/web:start: [next-auth][error][CLIENT_FETCH_ERROR]
docker-calcom-1 | @calcom/web:start: https://next-auth.js.org/errors#client_fetch_error request to http://testing.localhost:3000/api/auth/session failed, reason: getaddrinfo ENOTFOUND testing.localhost { docker-calcom-1 | @calcom/web:start: https://next-auth.js.org/errors#client_fetch_error request to http://testing.localhost:3000/api/auth/session failed, reason: getaddrinfo ENOTFOUND testing.localhost {
docker-calcom-1 | @calcom/web:start: error: { docker-calcom-1 | @calcom/web:start: error: {
docker-calcom-1 | @calcom/web:start: message: 'request to http://testing.localhost:3000/api/auth/session failed, reason: getaddrinfo ENOTFOUND testing.localhost', docker-calcom-1 | @calcom/web:start: message: 'request to http://testing.localhost:3000/api/auth/session failed, reason: getaddrinfo ENOTFOUND testing.localhost',

2
calcom

Submodule calcom updated: ddc5838c7b...0910f65b87

View File

@@ -1,4 +1,5 @@
# Use postgres/example user/password credentials # Use postgres/example user/password credentials
version: '3.8'
volumes: volumes:
database-data: database-data:
@@ -26,15 +27,11 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
NEXT_PUBLIC_WEBAPP_URL: ${NEXT_PUBLIC_WEBAPP_URL} NEXT_PUBLIC_WEBAPP_URL: ${NEXT_PUBLIC_WEBAPP_URL}
NEXT_PUBLIC_API_V2_URL: ${NEXT_PUBLIC_API_V2_URL}
NEXT_PUBLIC_LICENSE_CONSENT: ${NEXT_PUBLIC_LICENSE_CONSENT} NEXT_PUBLIC_LICENSE_CONSENT: ${NEXT_PUBLIC_LICENSE_CONSENT}
NEXT_PUBLIC_WEBSITE_TERMS_URL: ${EXT_PUBLIC_WEBSITE_TERMS_URL}
NEXT_PUBLIC_WEBSITE_PRIVACY_POLICY_URL: ${NEXT_PUBLIC_WEBSITE_PRIVACY_POLICY_URL}
CALCOM_TELEMETRY_DISABLED: ${CALCOM_TELEMETRY_DISABLED} CALCOM_TELEMETRY_DISABLED: ${CALCOM_TELEMETRY_DISABLED}
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET} NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
CALENDSO_ENCRYPTION_KEY: ${CALENDSO_ENCRYPTION_KEY} CALENDSO_ENCRYPTION_KEY: ${CALENDSO_ENCRYPTION_KEY}
DATABASE_URL: ${DATABASE_URL} DATABASE_URL: ${DATABASE_URL}
DATABASE_DIRECT_URL: ${DATABASE_URL}
network: stack network: stack
restart: always restart: always
networks: networks:
@@ -44,7 +41,6 @@ services:
env_file: .env env_file: .env
environment: environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB} - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
- DATABASE_DIRECT_URL=${DATABASE_URL}
depends_on: depends_on:
- database - database
@@ -59,7 +55,6 @@ services:
env_file: .env env_file: .env
environment: environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB} - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
- DATABASE_DIRECT_URL=${DATABASE_URL}
depends_on: depends_on:
- database - database
command: command:

View File

@@ -23,4 +23,4 @@ services:
databases: databases:
- name: cal-postgres - name: cal-postgres
plan: basic-1gb plan: starter

View File

@@ -10,6 +10,7 @@ fi
# Only peform action if $FROM and $TO are different. # Only peform action if $FROM and $TO are different.
echo "Replacing all statically built instances of $FROM with $TO." echo "Replacing all statically built instances of $FROM with $TO."
for file in $(egrep -r -l "${FROM}" apps/web/.next/ apps/web/public/); do find apps/web/.next/ apps/web/public -type f |
sed -i -e "s|$FROM|$TO|g" "$file" while read file; do
sed -i "s|$FROM|$TO|g" "$file"
done done