Merge pull request #104 from calcom/rework

This commit is contained in:
Peer Richelsen 2022-04-27 08:49:52 +02:00 committed by GitHub
commit f78d40d2e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 114 additions and 87 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
.git
.github
.env.example

View file

@ -8,8 +8,18 @@
NEXT_PUBLIC_LICENSE_CONSENT= NEXT_PUBLIC_LICENSE_CONSENT=
LICENSE= LICENSE=
BASE_URL=http://localhost:3000 # BASE_URL and NEXT_PUBLIC_APP_URL are both deprecated. Both are replaced with one variable, NEXT_PUBLIC_WEBAPP_URL
NEXT_PUBLIC_APP_URL=http://localhost:3000 # BASE_URL=http://localhost:3000
# NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
# It is highly recommended that the NEXTAUTH_SECRET must be overridden and very unique
# Use `openssl rand -base64 32` to generate a key
NEXTAUTH_SECRET=secret
# Deprecation note: JWT_SECRET is no longer used
# JWT_SECRET=secret
POSTGRES_USER=unicorn_user POSTGRES_USER=unicorn_user
POSTGRES_PASSWORD=magical_password POSTGRES_PASSWORD=magical_password
@ -42,7 +52,4 @@ EMAIL_SERVER_PASSWORD=email_password
# Encryption key that will be used to encrypt CalDAV credentials, choose a random string, for example with `dd if=/dev/urandom bs=1K count=1 | md5sum` # Encryption key that will be used to encrypt CalDAV credentials, choose a random string, for example with `dd if=/dev/urandom bs=1K count=1 | md5sum`
CALENDSO_ENCRYPTION_KEY= CALENDSO_ENCRYPTION_KEY=
# It is highly recommended that the JWT secret must be overridden and very unique
JWT_SECRET=secret
NODE_ENV=production NODE_ENV=production

View file

@ -33,9 +33,12 @@ 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:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - name: checkout
with: uses: actions/checkout@v2
submodules: true
- name: Git submodule update
run: |
git submodule update --init
- name: Docker Login - name: Docker Login
# You may pin to the exact commit or the version. # You may pin to the exact commit or the version.

4
.gitmodules vendored
View file

@ -1,4 +1,4 @@
[submodule "calendso"] [submodule "calcom"]
path = calendso path = calcom
url = https://github.com/calcom/cal.com.git url = https://github.com/calcom/cal.com.git
branch = main branch = main

View file

@ -3,40 +3,40 @@ FROM node:14 as deps
WORKDIR /calcom WORKDIR /calcom
# Copy rootand all workspace package.json files # Copy rootand all workspace package.json files
COPY calendso/package.json calendso/yarn.lock calendso/turbo.json ./ COPY calcom/package.json calcom/yarn.lock calcom/turbo.json ./
COPY calendso/apps/web/package.json calendso/apps/web/yarn.lock ./apps/web/ COPY calcom/apps/web/package.json calcom/apps/web/yarn.lock ./apps/web/
COPY calendso/packages/ui/package.json ./packages/ui/package.json COPY calcom/packages/ui/package.json ./packages/ui/package.json
COPY calendso/packages/types/package.json ./packages/types/package.json COPY calcom/packages/types/package.json ./packages/types/package.json
COPY calendso/packages/core/package.json ./packages/core/package.json COPY calcom/packages/core/package.json ./packages/core/package.json
COPY calendso/packages/config/package.json ./packages/config/package.json COPY calcom/packages/config/package.json ./packages/config/package.json
COPY calendso/packages/ee/package.json ./packages/ee/package.json COPY calcom/packages/ee/package.json ./packages/ee/package.json
COPY calendso/packages/tsconfig/package.json ./packages/tsconfig/package.json COPY calcom/packages/tsconfig/package.json ./packages/tsconfig/package.json
COPY calendso/packages/prisma/package.json ./packages/prisma/package.json COPY calcom/packages/prisma/package.json ./packages/prisma/package.json
COPY calendso/packages/app-store/googlevideo/package.json ./packages/app-store/googlevideo/package.json COPY calcom/packages/app-store/googlevideo/package.json ./packages/app-store/googlevideo/package.json
COPY calendso/packages/app-store/caldavcalendar/package.json ./packages/app-store/caldavcalendar/package.json COPY calcom/packages/app-store/caldavcalendar/package.json ./packages/app-store/caldavcalendar/package.json
COPY calendso/packages/app-store/zoomvideo/package.json ./packages/app-store/zoomvideo/package.json COPY calcom/packages/app-store/zoomvideo/package.json ./packages/app-store/zoomvideo/package.json
COPY calendso/packages/app-store/huddle01video/package.json ./packages/app-store/huddle01video/package.json COPY calcom/packages/app-store/huddle01video/package.json ./packages/app-store/huddle01video/package.json
COPY calendso/packages/app-store/jitsivideo/package.json ./packages/app-store/jitsivideo/package.json COPY calcom/packages/app-store/jitsivideo/package.json ./packages/app-store/jitsivideo/package.json
COPY calendso/packages/app-store/stripepayment/package.json ./packages/app-store/stripepayment/package.json COPY calcom/packages/app-store/stripepayment/package.json ./packages/app-store/stripepayment/package.json
COPY calendso/packages/app-store/office365video/package.json ./packages/app-store/office365video/package.json COPY calcom/packages/app-store/office365video/package.json ./packages/app-store/office365video/package.json
COPY calendso/packages/app-store/office365calendar/package.json ./packages/app-store/office365calendar/package.json COPY calcom/packages/app-store/office365calendar/package.json ./packages/app-store/office365calendar/package.json
COPY calendso/packages/app-store/slackmessaging/package.json ./packages/app-store/slackmessaging/package.json COPY calcom/packages/app-store/slackmessaging/package.json ./packages/app-store/slackmessaging/package.json
COPY calendso/packages/app-store/tandemvideo/package.json ./packages/app-store/tandemvideo/package.json COPY calcom/packages/app-store/tandemvideo/package.json ./packages/app-store/tandemvideo/package.json
COPY calendso/packages/app-store/wipemycalother/package.json ./packages/app-store/wipemycalother/package.json COPY calcom/packages/app-store/wipemycalother/package.json ./packages/app-store/wipemycalother/package.json
COPY calendso/packages/app-store/package.json ./packages/app-store/package.json COPY calcom/packages/app-store/package.json ./packages/app-store/package.json
COPY calendso/packages/app-store/_example/package.json ./packages/app-store/_example/package.json COPY calcom/packages/app-store/_example/package.json ./packages/app-store/_example/package.json
COPY calendso/packages/app-store/googlecalendar/package.json ./packages/app-store/googlecalendar/package.json COPY calcom/packages/app-store/googlecalendar/package.json ./packages/app-store/googlecalendar/package.json
COPY calendso/packages/app-store/dailyvideo/package.json ./packages/app-store/dailyvideo/package.json COPY calcom/packages/app-store/dailyvideo/package.json ./packages/app-store/dailyvideo/package.json
COPY calendso/packages/app-store/applecalendar/package.json ./packages/app-store/applecalendar/package.json COPY calcom/packages/app-store/applecalendar/package.json ./packages/app-store/applecalendar/package.json
COPY calendso/packages/app-store/hubspotothercalendar/package.json ./packages/app-store/hubspotothercalendar/package.json COPY calcom/packages/app-store/hubspotothercalendar/package.json ./packages/app-store/hubspotothercalendar/package.json
COPY calendso/packages/lib/package.json ./packages/lib/package.json COPY calcom/packages/lib/package.json ./packages/lib/package.json
COPY calendso/packages/embeds/embed-snippet/package.json ./packages/embeds/embed-snippet/package.json COPY calcom/packages/embeds/embed-snippet/package.json ./packages/embeds/embed-snippet/package.json
COPY calendso/packages/embeds/embed-react/package.json ./packages/embeds/embed-react/package.json COPY calcom/packages/embeds/embed-react/package.json ./packages/embeds/embed-react/package.json
COPY calendso/packages/embeds/embed-core/package.json ./packages/embeds/embed-core/package.json COPY calcom/packages/embeds/embed-core/package.json ./packages/embeds/embed-core/package.json
COPY calendso/packages/stripe/package.json ./packages/stripe/package.json COPY calcom/packages/stripe/package.json ./packages/stripe/package.json
# Prisma schema is required by a post-install script # Prisma schema is required by a post-install script
COPY calendso/packages/prisma/schema.prisma ./packages/prisma/schema.prisma COPY calcom/packages/prisma/schema.prisma ./packages/prisma/schema.prisma
# Install dependencies # Install dependencies
RUN yarn install --frozen-lockfile RUN yarn install --frozen-lockfile
@ -44,20 +44,24 @@ RUN yarn install --frozen-lockfile
FROM node:14 as builder FROM node:14 as builder
WORKDIR /calcom WORKDIR /calcom
ARG BASE_URL ARG NEXT_PUBLIC_WEBAPP_URL
ARG NEXT_PUBLIC_APP_URL
ARG NEXT_PUBLIC_LICENSE_CONSENT ARG NEXT_PUBLIC_LICENSE_CONSENT
ARG NEXT_PUBLIC_TELEMETRY_KEY ARG NEXT_PUBLIC_TELEMETRY_KEY
ENV BASE_URL=$BASE_URL \ # DEPRECATED
ARG BASE_URL
ARG NEXT_PUBLIC_APP_URL
ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \
BASE_URL=$BASE_URL \
NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL \ NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL \
NEXT_PUBLIC_LICENSE_CONSENT=$NEXT_PUBLIC_LICENSE_CONSENT \ NEXT_PUBLIC_LICENSE_CONSENT=$NEXT_PUBLIC_LICENSE_CONSENT \
NEXT_PUBLIC_TELEMETRY_KEY=$NEXT_PUBLIC_TELEMETRY_KEY NEXT_PUBLIC_TELEMETRY_KEY=$NEXT_PUBLIC_TELEMETRY_KEY
COPY calendso/package.json calendso/yarn.lock calendso/turbo.json ./ COPY calcom/package.json calcom/yarn.lock calcom/turbo.json ./
COPY calendso/apps/web ./apps/web COPY calcom/apps/web ./apps/web
COPY calendso/packages ./packages COPY calcom/packages ./packages
COPY --from=deps /calcom/node_modules ./node_modules COPY --from=deps /calcom/node_modules ./node_modules
RUN yarn build && yarn install --ignore-scripts --prefer-offline RUN yarn build
FROM node:14 as runner FROM node:14 as runner
WORKDIR /calcom WORKDIR /calcom
@ -67,16 +71,17 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
npm install --global prisma npm install --global prisma
COPY calendso/package.json calendso/yarn.lock calendso/turbo.json ./ COPY calcom/package.json calcom/yarn.lock calcom/turbo.json ./
COPY --from=builder /calcom/node_modules ./node_modules COPY --from=deps /calcom/node_modules ./node_modules
COPY --from=builder /calcom/packages ./packages COPY --from=builder /calcom/packages ./packages
COPY --from=builder /calcom/apps/web/node_modules ./apps/web/node_modules COPY --from=deps /calcom/apps/web/node_modules ./apps/web/node_modules
COPY --from=builder /calcom/apps/web/scripts ./apps/web/scripts COPY --from=builder /calcom/apps/web/scripts ./apps/web/scripts
COPY --from=builder /calcom/apps/web/next.config.js ./apps/web/next.config.js COPY --from=builder /calcom/apps/web/next.config.js ./apps/web/next.config.js
COPY --from=builder /calcom/apps/web/next-i18next.config.js ./apps/web/next-i18next.config.js COPY --from=builder /calcom/apps/web/next-i18next.config.js ./apps/web/next-i18next.config.js
COPY --from=builder /calcom/apps/web/public ./apps/web/public COPY --from=builder /calcom/apps/web/public ./apps/web/public
COPY --from=builder /calcom/apps/web/.next ./apps/web/.next COPY --from=builder /calcom/apps/web/.next ./apps/web/.next
COPY --from=builder /calcom/apps/web/package.json ./apps/web/package.json COPY --from=builder /calcom/apps/web/package.json ./apps/web/package.json
COPY --from=builder calcom/packages/prisma/schema.prisma ./prisma/schema.prisma
COPY scripts scripts COPY scripts scripts
EXPOSE 3000 EXPOSE 3000

View file

@ -1,22 +1,24 @@
<!-- PROJECT LOGO --> <!-- PROJECT LOGO -->
<div align="right"> <div align="right">
<a href="https://github.com/calendso/calendso"> <a href="https://github.com/calcom/cal.com">
<img src="https://cal.com/logo.svg" alt="Logo" width="160" height="65"> <img src="https://cal.com/logo.svg" alt="Logo" width="160" height="65">
</a><br/> </a><br/>
<a href="https://cal.com">Website</a> <a href="https://cal.com">Website</a>
· ·
<a href="https://github.com/calendso/calendso-docker/issues">Community Support</a> <a href="https://github.com/calcom/docker/issues">Community Support</a>
</div> </div>
# Docker # Docker
NOTE: DockerHub organization has not yet been renamed.
This image can be found on DockerHub at [https://hub.docker.com/r/calendso/calendso](https://hub.docker.com/r/calendso/calendso) This image can be found on DockerHub at [https://hub.docker.com/r/calendso/calendso](https://hub.docker.com/r/calendso/calendso)
The Docker configuration for Calendso is an effort powered by people within the community. Cal.com, Inc. does not provide official support for Docker, but we will accept fixes and documentation. Use at your own risk. The Docker configuration for Cal.com is an effort powered by people within the community. Cal.com, Inc. does not yet provide official support for Docker, but we will accept fixes and documentation at this time. Use at your own risk.
## Important Notes ## Important Notes
This Docker Image is managed by the Calendso Community. Support for this image can be found via the repository, located at [https://github.com/calendso/docker](https://github.com/calcom/docker) This Docker Image is managed by the Cal.com Community. Support for this image can be found via the repository, located at [https://github.com/calcom/docker](https://github.com/calcom/docker)
Currently, this image is intended for local development/evaluation use only, as there are specific requirements for providing environmental variables at build-time in order to specify a non-localhost BASE_URL. (this is due to the nature of the static site compilation, which embeds the variable values). The ability to update these variables at runtime is in-progress and will be available in the future. Currently, this image is intended for local development/evaluation use only, as there are specific requirements for providing environmental variables at build-time in order to specify a non-localhost BASE_URL. (this is due to the nature of the static site compilation, which embeds the variable values). The ability to update these variables at runtime is in-progress and will be available in the future.
@ -24,60 +26,68 @@ For Production, for the time being, please checkout the repository and build/pus
## Requirements ## Requirements
Make sure you have `docker` & `docker-compose` installed on the server / system. Make sure you have `docker` & `docker compose` installed on the server / system.
Note: `docker compose` without the hyphen is now the primary method of using docker-compose, per the Docker documentation.
## Getting Started ## Getting Started
1. Clone calendso-docker 1. Clone calcom-docker
```bash ```bash
git clone --recursive https://github.com/calendso/docker.git calendso-docker git clone --recursive https://github.com/calcom/docker.git calcom-docker
``` ```
2. Change into the directory 2. Change into the directory
```bash ```bash
cd calendso-docker cd calcom-docker
``` ```
3. Rename `.env.example` to `.env` and update `.env` if needed. 3. Update the calcom submodule
4. Build and start calendso
```bash ```bash
docker-compose up --build git submodule update --remote --init
``` ```
5. Start prisma studio 4. Rename `.env.example` to `.env` and then update `.env`
5. Build and start Cal.com via docker compose
```bash ```bash
docker-compose exec calendso npx prisma studio docker compose up --build
``` ```
6. Open a browser to [http://localhost:5555](http://localhost:5555) to look at or modify the database content. 6. (First Run) Open a browser to [http://localhost:5555](http://localhost:5555) to look at or modify the database content.
7. Click on the `User` model to add a new user record. a. Click on the `User` model to add a new user record.
8. 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. b. 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.
9. Open a browser to [http://localhost:3000](http://localhost:3000) and login with your just created, first user. 7. Open a browser to [http://localhost:3000](http://localhost:3000) and login with your just created, first user.
## Configuration
### Build-time variables
These variables must be provided at the time of the docker build, and can be provided by updating the .env file. Changing these is not required for evaluation, but may be required for running in production. Currently, if you require changes to these variables, you must follow the instructions to build and publish your own image.
* NEXT_PUBLIC_WEBAPP_URL
* NEXT_PUBLIC_LICENSE_CONSENT
* NEXT_PUBLIC_TELEMETRY_KEY
### Important Run-time variables
* NEXTAUTH_SECRET
## Git Submodules ## Git Submodules
This repository uses a git submodule. This repository uses a git submodule.
If you cloned the repository without using `--recursive`, then you can initialize and clone the submodule with the following steps. To update the calcom submodule, use the following command:
1. Init the submodule
```bash ```bash
git submodule init git submodule update --remote --init
```
2. Update the submodule
```bash
git submodule update --remote
``` ```
For more advanced usage, please refer to the git documentation: [https://git-scm.com/book/en/v2/Git-Tools-Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) For more advanced usage, please refer to the git documentation: [https://git-scm.com/book/en/v2/Git-Tools-Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules)

1
calcom Submodule

@ -0,0 +1 @@
Subproject commit a0057911c1e2b7753e98b80bce7157764ee39a29

@ -1 +0,0 @@
Subproject commit c22b6ca6703cb3b300ccff57c55b6c744ac3e49d

View file

@ -18,13 +18,12 @@ services:
networks: networks:
- stack - stack
calendso: calcom:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
- BASE_URL=${BASE_URL} - NEXT_PUBLIC_WEBAPP_URL=${NEXT_PUBLIC_WEBAPP_URL}
- NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL}
- NEXT_PUBLIC_LICENSE_CONSENT=${NEXT_PUBLIC_LICENSE_CONSENT} - NEXT_PUBLIC_LICENSE_CONSENT=${NEXT_PUBLIC_LICENSE_CONSENT}
- NEXT_PUBLIC_TELEMETRY_KEY=${NEXT_PUBLIC_TELEMETRY_KEY} - NEXT_PUBLIC_TELEMETRY_KEY=${NEXT_PUBLIC_TELEMETRY_KEY}
restart: always restart: always

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -x set -x
/calcom/scripts/wait-for-it.sh ${DATABASE_HOST} -- echo "database is up" scripts/wait-for-it.sh ${DATABASE_HOST} -- echo "database is up"
npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma
yarn start yarn start