Merge pull request #114 from calcom/feature/docker-compose-build
Update build and instructions to support updated database flow
This commit is contained in:
81
.github/workflows/docker-build-test.yml
vendored
Normal file
81
.github/workflows/docker-build-test.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
|
name: Test actions image build
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
# Allow running workflow manually from the Actions tab
|
||||||
|
workflow_dispatch: ~
|
||||||
|
|
||||||
|
# Leaving in example for releases. Initially we simply push to 'latest'
|
||||||
|
# on:
|
||||||
|
# release:
|
||||||
|
# types: [ created ]
|
||||||
|
|
||||||
|
# # Allows you to run this workflow manually from the Actions tab
|
||||||
|
# workflow_dispatch:
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
# This workflow contains a single job called "build"
|
||||||
|
build:
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Git submodule update
|
||||||
|
run: |
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
- name: Docker Login
|
||||||
|
# You may pin to the exact commit or the version.
|
||||||
|
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
uses: docker/login-action@v1.10.0
|
||||||
|
with:
|
||||||
|
# Username used to log against the Docker registry
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
# Password or personal access token used to log against the Docker registry
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
# Log out from the Docker registry at the end of a job
|
||||||
|
logout: true # optional, default is true
|
||||||
|
|
||||||
|
- name: Set up Docker builder
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1.6.0
|
||||||
|
|
||||||
|
- name: Start database
|
||||||
|
run: |
|
||||||
|
cp .env.example .env
|
||||||
|
|
||||||
|
- name: Start database
|
||||||
|
run: |
|
||||||
|
docker compose up -d database
|
||||||
|
|
||||||
|
- name: Build and push image
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: false
|
||||||
|
# The test image is /docker and is private. final image will be /calendso and public
|
||||||
|
tags: docker.io/${{ secrets.DOCKER_HUB_USERNAME }}/calendso:canary
|
||||||
|
network: stack
|
||||||
|
build-args: |
|
||||||
|
BASE_URL=http://localhost:3000
|
||||||
|
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
||||||
|
DATABASE_URL=${DATABASE_URL}
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
run: |
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
46
README.md
46
README.md
@@ -26,7 +26,7 @@ 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. Both are installed by most docker utilities, including Docker Desktop and Rancher Desktop.
|
||||||
|
|
||||||
Note: `docker compose` without the hyphen is now the primary method of using docker-compose, per the Docker documentation.
|
Note: `docker compose` without the hyphen is now the primary method of using docker-compose, per the Docker documentation.
|
||||||
|
|
||||||
@@ -54,19 +54,53 @@ Note: `docker compose` without the hyphen is now the primary method of using doc
|
|||||||
|
|
||||||
4. Rename `.env.example` to `.env` and then update `.env`
|
4. Rename `.env.example` to `.env` and then update `.env`
|
||||||
|
|
||||||
5. Build and start Cal.com via docker compose
|
5. Build the Cal.com docker image:
|
||||||
|
|
||||||
|
Note: Due to application configuration requirements, an available database is currently required during the build process.
|
||||||
|
|
||||||
|
a) If hosting elsewhere, configure the `DATABASE_URL` in the .env file, and skip the next step
|
||||||
|
|
||||||
|
b) If a local or temporary database is required, start a local database via docker compose.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose up --build
|
docker compose up -d database
|
||||||
```
|
```
|
||||||
|
|
||||||
6. (First Run) Open a browser to [http://localhost:5555](http://localhost:5555) to look at or modify the database content.
|
6. Build Cal.com via docker compose
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose build calcom
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
To run Cal.com web app and Prisma Studio against a remote database, ensure that DATABASE_URL is configured for an available database and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d calcom studio
|
||||||
|
```
|
||||||
|
|
||||||
|
To run only the Cal.com web app, ensure that DATABASE_URL is configured for an available database and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d calcom
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note: to run in attached mode for debugging, remove `-d` from your desired run command.**
|
||||||
|
|
||||||
|
8. (First Run) Open a browser to [http://localhost:5555](http://localhost:5555) to look at or modify the database content.
|
||||||
|
|
||||||
a. Click on the `User` model to add a new user record.
|
a. Click on the `User` model to add a new user record.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
7. Open a browser to [http://localhost:3000](http://localhost:3000) and login with your just created, first user.
|
9. Open a browser to [http://localhost:3000](http://localhost:3000) (or your appropriately configured NEXT_PUBLIC_WEBAPP_URL) and login with your just created, first user.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
@@ -77,10 +111,12 @@ These variables must be provided at the time of the docker build, and can be pro
|
|||||||
* NEXT_PUBLIC_WEBAPP_URL
|
* NEXT_PUBLIC_WEBAPP_URL
|
||||||
* NEXT_PUBLIC_LICENSE_CONSENT
|
* NEXT_PUBLIC_LICENSE_CONSENT
|
||||||
* NEXT_PUBLIC_TELEMETRY_KEY
|
* NEXT_PUBLIC_TELEMETRY_KEY
|
||||||
|
* DATABASE_URL
|
||||||
|
|
||||||
### Important Run-time variables
|
### Important Run-time variables
|
||||||
|
|
||||||
* NEXTAUTH_SECRET
|
* NEXTAUTH_SECRET
|
||||||
|
* DATABASE_URL
|
||||||
|
|
||||||
## Git Submodules
|
## Git Submodules
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ volumes:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
stack:
|
stack:
|
||||||
|
name: stack
|
||||||
external: false
|
external: false
|
||||||
|
|
||||||
services:
|
services:
|
||||||
@@ -26,6 +27,8 @@ services:
|
|||||||
- NEXT_PUBLIC_WEBAPP_URL=${NEXT_PUBLIC_WEBAPP_URL}
|
- NEXT_PUBLIC_WEBAPP_URL=${NEXT_PUBLIC_WEBAPP_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}
|
||||||
|
- DATABASE_URL=${DATABASE_URL}
|
||||||
|
network: stack
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- stack
|
- stack
|
||||||
|
|||||||
Reference in New Issue
Block a user