diff --git a/README.md b/README.md index 351b935eb..de25e508b 100644 --- a/README.md +++ b/README.md @@ -1,148 +1,154 @@ - -
- - Logo -
- Website - · - Community Support -
- -# 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) - -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 - -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. - -For Production, for the time being, please checkout the repository and build/push your own image privately. - -## Requirements - -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. - -## Getting Started - -1. Clone calcom-docker - - ```bash - git clone https://github.com/calcom/docker.git calcom-docker - ``` - -2. Change into the directory - - ```bash - cd calcom-docker - ``` - -3. Update the calcom submodule. - - ```bash - git submodule update --remote --init - ``` - - Note: DO NOT use recursive submodule update, otherwise you will receive a git authentication error. - -4. Rename `.env.example` to `.env` and then update `.env` - -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 - docker compose up -d database - ``` - -6. Build Cal.com via docker compose (DOCKER_BUILDKIT=0 must be provided to allow a network bridge to be used at build time. This requirement will be removed in the future) - - ```bash - DOCKER_BUILDKIT=0 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. - - 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) (or your appropriately configured NEXT_PUBLIC_WEBAPP_URL) 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. 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) - -| Variable | Description | Required | Default | -| --- | --- | --- | --- | -| NEXT_PUBLIC_WEBAPP_URL | Base URL injected into static files | required | `http://localhost:3000` | -| NEXT_PUBLIC_LICENSE_CONSENT | license consent - true/false | | | -| CALCOM_TELEMETRY_DISABLED | Allow cal.com to collect anonymous usage data (set to `1` to disable) | | | -| DATABASE_URL | database url with credentials | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` | -| NEXTAUTH_SECRET | Cookie encryption key | required | `secret` | -| CALENDSO_ENCRYPTION_KEY | Authentication encryption key | required | `secret` | - -### Important Run-time variables - -These variables must also be provided at runtime - -| Variable | Description | Required | Default | -| --- | --- | --- | --- | -| CALCOM_LICENSE_KEY | Enterprise License Key | | | -| NEXTAUTH_SECRET | must match build variable | required | `secret` | -| CALENDSO_ENCRYPTION_KEY | must match build variable | required | `secret` | -| DATABASE_URL | database url with credentials | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` | - -## Git Submodules - -This repository uses a git submodule. - -To update the calcom submodule, use the following command: - -```bash -git submodule update --remote --init -``` - -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) - -## Troubleshooting - -* SSL edge termination: If running behind a load balancer which handles SSL certificates, you will need to add the environmental variable `NODE_TLS_REJECT_UNAUTHORIZED=0` to prevent requests from being rejected. Only do this if you know what you are doing and trust the services/load-balancers directing traffic to your service. -* Failed to commit changes: Invalid 'prisma.user.create()': Certain versions may have trouble creating a user if the field `metadata` is empty. Using an empty json object `{}` as the field value should resolve this issue. Also, the `id` field will autoincrement, so you may also try leaving the value of `id` as empty. + +
+ + Logo +
+ Website + · + Community Support +
+ +# 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) + +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 + +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. + +For Production, for the time being, please checkout the repository and build/push your own image privately. + +## Requirements + +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. + +## Getting Started + +1. Clone calcom-docker + + ```bash + git clone https://github.com/calcom/docker.git calcom-docker + ``` + +2. Change into the directory + + ```bash + cd calcom-docker + ``` + +3. Update the calcom submodule. + + ```bash + git submodule update --remote --init + ``` + + Note: DO NOT use recursive submodule update, otherwise you will receive a git authentication error. + +4. Rename `.env.example` to `.env` and then update `.env` + +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 + docker compose up -d database + ``` + +6. Build Cal.com via docker compose (DOCKER_BUILDKIT=0 must be provided to allow a network bridge to be used at build time. This requirement will be removed in the future) + + ```bash + DOCKER_BUILDKIT=0 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. + + 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) (or your appropriately configured NEXT_PUBLIC_WEBAPP_URL) 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. 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) + +| Variable | Description | Required | Default | +| --- | --- | --- | --- | +| NEXT_PUBLIC_WEBAPP_URL | Base URL injected into static files | required | `http://localhost:3000` | +| NEXT_PUBLIC_LICENSE_CONSENT | license consent - true/false | | | +| CALCOM_TELEMETRY_DISABLED | Allow cal.com to collect anonymous usage data (set to `1` to disable) | | | +| DATABASE_URL | database url with credentials | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` | +| NEXTAUTH_SECRET | Cookie encryption key | required | `secret` | +| CALENDSO_ENCRYPTION_KEY | Authentication encryption key | required | `secret` | + +### Important Run-time variables + +These variables must also be provided at runtime + +| Variable | Description | Required | Default | +| --- | --- | --- | --- | +| CALCOM_LICENSE_KEY | Enterprise License Key | | | +| NEXTAUTH_SECRET | must match build variable | required | `secret` | +| CALENDSO_ENCRYPTION_KEY | must match build variable | required | `secret` | +| DATABASE_URL | database url with credentials | required | `postgresql://unicorn_user:magical_password@database:5432/calendso` | + +## Git Submodules + +This repository uses a git submodule. + +To update the calcom submodule, use the following command: + +```bash +git submodule update --remote --init +``` + +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) + + +## Helm and K8S + +Please read the [Helm Chart README](./chart/calendso-chart/README.md) for more informations + + +## Troubleshooting + +* SSL edge termination: If running behind a load balancer which handles SSL certificates, you will need to add the environmental variable `NODE_TLS_REJECT_UNAUTHORIZED=0` to prevent requests from being rejected. Only do this if you know what you are doing and trust the services/load-balancers directing traffic to your service. +* Failed to commit changes: Invalid 'prisma.user.create()': Certain versions may have trouble creating a user if the field `metadata` is empty. Using an empty json object `{}` as the field value should resolve this issue. Also, the `id` field will autoincrement, so you may also try leaving the value of `id` as empty. diff --git a/chart/calendso-chart/.helmignore b/chart/calendso-chart/.helmignore new file mode 100644 index 000000000..f82e96d46 --- /dev/null +++ b/chart/calendso-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/chart/calendso-chart/Chart.lock b/chart/calendso-chart/Chart.lock new file mode 100644 index 000000000..d0ca52174 --- /dev/null +++ b/chart/calendso-chart/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 10.9.5 +digest: sha256:a555b5ad8fb0f50610f8f2c1dc89debb1d542f23b920b096fcd4ee56597cb011 +generated: "2021-11-15T16:31:07.4187218+01:00" diff --git a/chart/calendso-chart/Chart.yaml b/chart/calendso-chart/Chart.yaml new file mode 100644 index 000000000..d04198eef --- /dev/null +++ b/chart/calendso-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: calendso +description: A Helm chart for Calendso +type: application +version: 0.1.0 +appVersion: "latest" \ No newline at end of file diff --git a/chart/calendso-chart/README.md b/chart/calendso-chart/README.md new file mode 100644 index 000000000..8057dfaf5 --- /dev/null +++ b/chart/calendso-chart/README.md @@ -0,0 +1,132 @@ +## Install calendso on kubernetes + +1. Create a locally calendso image with tag + + ```bash + cd calendso-docker + docker build -t calendso:2.1 . + ``` + +2. Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE + + ```bash + docker tag calendso:2.1 PathRepository/calendso:2.1 + ``` + +3. Pull calendso image from the repository + + ```bash + docker push PathRepository/calendso:2.1 + ``` + => Note: May you need to login before this step ! + +4. Configuration + + The following table lists the configurable parameters of calendso-chart and their default values. + +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| `JWT_SECRET` | Reference to the secret to be used when pulling images | `[]` | +| `image.repository` | Image repository | `quay.io/jetstack/cert-manager-controller` | +| `image.tag` | Image tag | `v0.6.2` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `replicaCount` | Number of cal.com replicas | `1` | +| `DATABASE_URL` | Reference to the url of the database | `[]` | +| `BASE_URL` | Reference to the url of calendso application after its installation | `[]` | +| `GOOGLE_API_CREDENTIALS` | Reference to Google API credentials. You can get this from https://console.cloud.google.com/apis/dashboard | `[]` | +| `MS_GRAPH_CLIENT_ID` | Reference to the application (client) ID from https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps | `[]` | +| `MS_GRAPH_CLIENT_SECRET` | Reference to the application (SecretClient) ID from https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps | `[]` | +| `ZOOM_CLIENT_ID` | Used for ZOOM integration, you can get this from https://marketplace.zoom.us/ | `[]` | +| `ZOOM_CLIENT_SECRET` | Used for ZOOM integration, you can get this from https://marketplace.zoom.us/ | `[]` | +| `NEXT_PUBLIC_TELEMETRY_KEY` | used to allow calendso to collect anonymous usage | `[]` | +| `DAILY_API_KEY` | Used for the Daily integration | `[]` | +| `EMAIL_FROM` | Configures the global From: header whilst sending emails. | `[]` | +| `CRON_API_KEY` | Reference to ApiKey for cronjobs | `[]` | +| `clusterResourceNamespace` | Override the namespace used to store DNS provider credentials etc. for ClusterIssuer resources | Same namespace as cert-manager pod +| `leaderElection.Namespace` | Override the namespace used to store the ConfigMap for leader election | Same namespace as cert-manager pod +| `extraArgs` | Optional flags for cert-manager | `[]` | +| `extraEnv` | Optional environment variables for cert-manager | `[]` | +| `rbac.create` | If `true`, create and use RBAC resources | `true` | +| `serviceAccount.create` | If `true`, create a new service account | `true` | +| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | | +| `resources` | CPU/memory resource requests/limits | | +| `securityContext.enabled` | Enable security context | `false` | +| `securityContext.fsGroup` | Group ID for the container | `1001` | +| `securityContext.runAsUser` | User ID for the container | `1001` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `affinity` | Node affinity for pod assignment | `{}` | +| `tolerations` | Node tolerations for pod assignment | `[]` | +| `ingressShim.defaultIssuerName` | Optional default issuer to use for ingress resources | | +| `ingressShim.defaultIssuerKind` | Optional default issuer kind to use for ingress resources | | +| `ingressShim.defaultACMEChallengeType` | Optional default challenge type to use for ingresses using ACME issuers | | +| `ingressShim.defaultACMEDNS01ChallengeProvider` | Optional default DNS01 challenge provider to use for ingresses using ACME issuers with DNS01 | | +| `podAnnotations` | Annotations to add to the cert-manager pod | `{}` | +| `podDnsPolicy` | Optional cert-manager pod [DNS policy](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pods-dns-policy) | | +| `podDnsConfig` | Optional cert-manager pod [DNS configurations](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pods-dns-config) | | +| `podLabels` | Labels to add to the cert-manager pod | `{}` | +| `priorityClassName`| Priority class name for cert-manager and webhook pods | `""` | +| `http_proxy` | Value of the `HTTP_PROXY` environment variable in the cert-manager pod | | +| `https_proxy` | Value of the `HTTPS_PROXY` environment variable in the cert-manager pod | | +| `no_proxy` | Value of the `NO_PROXY` environment variable in the cert-manager pod | | +| `webhook.enabled` | Toggles whether the validating webhook component should be installed | `true` | +| `webhook.replicaCount` | Number of cert-manager webhook replicas | `1` | +| `webhook.podAnnotations` | Annotations to add to the webhook pods | `{}` | +| `webhook.extraArgs` | Optional flags for cert-manager webhook component | `[]` | +| `webhook.resources` | CPU/memory resource requests/limits for the webhook pods | | +| `webhook.image.repository` | Webhook image repository | `quay.io/jetstack/cert-manager-webhook` | +| `webhook.image.tag` | Webhook image tag | `v0.6.2` | +| `webhook.image.pullPolicy` | Webhook image pull policy | `IfNotPresent` | +| `webhook.caSyncImage.repository` | CA sync image repository | `quay.io/munnerz/apiextensions-ca-helper` | +| `webhook.caSyncImage.tag` | CA sync image tag | `v0.1.0` | +| `webhook.caSyncImage.pullPolicy` | CA sync image pull policy | `IfNotPresent` | + + All these Values built-in object provides access to the values passed into calendso-chart through the Values.yaml file. +Specify each parameter using the --set key=value[,key=value] argument to helm install or modify them in values.yaml as below. + + * Put the repository of calendso image in values.yaml + ``` + image: + repository: #your calendso docker image repo + pullPolicy: IfNotPresent + tag: "" + ``` + + for example here we used calendso:2.1 so the image will be like this + + => image: + repository: PathRepository/calendso + pullPolicy: IfNotPresent + tag: "2.1" + + * Upgrading calendso helm chart + + To install the chart from the Helm repository with the release name yourReleaseName + ```bash + helm upgrade --install -n yourNamespace yourReleaseName path/Calendso-Chart + ``` +5. Access prisma studio + + * Show pod's name + ```bash + kubectl get pods -n yourNamespace + ``` + In two separate console: + + * Start prisma studio + ```bash + kubectl exec -n yourNamespace podsName -- npx prisma studio + ``` + + * Forward port:5555 + ```bash + kubectl port-forward -n yourNamespace podsName 5555:5555 + ``` +6. You can now access prisma studio from your computer + + * Open a browser to http://127.0.0.1:5555 to look at or modify the database content. + + * Click on the User model to add a new user record. + + * Fill out the fields (remembering to encrypt your password with https://bcrypt-generator.com/) and click Save 1 Record to create your first user. + + * Open a browser to a link in the variable Base_Url indicated in .env.example and login with your just created, first user. diff --git a/chart/calendso-chart/calendso-cert.yaml b/chart/calendso-chart/calendso-cert.yaml new file mode 100644 index 000000000..252068300 --- /dev/null +++ b/chart/calendso-chart/calendso-cert.yaml @@ -0,0 +1,40 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: calendso-cert +spec: + # Secret names are always required. + secretName: calendso-cert + duration: 2160h # 90d + renewBefore: 360h # 15d + subject: + organizations: + - + # The use of the common name field has been deprecated since 2000 and is + # discouraged from being used. + commonName: cal.yourhost.com + isCA: false + privateKey: + algorithm: RSA + encoding: PKCS1 + size: 2048 + usages: + - server auth + - client auth + # At least one of a DNS Name, URI, or IP address is required. + dnsNames: + - cal.yourhost.com + # - www.example.com + # uris: + # - spiffe://cluster.local/ns/sandbox/sa/example + # ipAddresses: + # - 15.236.213.243 + # Issuer references are always required. + issuerRef: + name: letsencrypt + # We can reference ClusterIssuers by changing the kind here. + # The default value is Issuer (i.e. a locally namespaced Issuer) + kind: ClusterIssuer + # This is optional since cert-manager will default to this value however + # if you are using an external issuer, change this to that issuer group. + group: cert-manager.io \ No newline at end of file diff --git a/chart/calendso-chart/templates/NOTES.txt b/chart/calendso-chart/templates/NOTES.txt new file mode 100644 index 000000000..373c18755 --- /dev/null +++ b/chart/calendso-chart/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "calendso-chart.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "calendso-chart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "calendso-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "calendso-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/chart/calendso-chart/templates/_helpers.tpl b/chart/calendso-chart/templates/_helpers.tpl new file mode 100644 index 000000000..3b26a47e0 --- /dev/null +++ b/chart/calendso-chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "calendso-chart.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "calendso-chart.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "calendso-chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "calendso-chart.labels" -}} +helm.sh/chart: {{ include "calendso-chart.chart" . }} +{{ include "calendso-chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "calendso-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "calendso-chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "calendso-chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "calendso-chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/chart/calendso-chart/templates/deployment.yaml b/chart/calendso-chart/templates/deployment.yaml new file mode 100644 index 000000000..9c9570c4b --- /dev/null +++ b/chart/calendso-chart/templates/deployment.yaml @@ -0,0 +1,99 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "calendso-chart.fullname" . }} + labels: + {{- include "calendso-chart.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "calendso-chart.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "calendso-chart.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "calendso-chart.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: "NEXT_PUBLIC_LICENSE_CONSENT" + #value: {{ .Values.environment.NEXT_PUBLIC_LICENSE_CONSENT}} + value: 'agree' + - name: "DATABASE_URL" + value: {{ .Values.environment.DATABASE_URL}} + - name: "GOOGLE_API_CREDENTIALS" + value: {{ .Values.environment.GOOGLE_API_CREDENTIALS}} + - name: "BASE_URL" + value: {{ .Values.environment.BASE_URL}} + - name: "NEXT_PUBLIC_APP_URL" + value: {{ .Values.environment.NEXT_PUBLIC_APP_URL}} + - name: "JWT_SECRET" + value: {{ .Values.environment.JWT_SECRET}} + - name: "NEXT_PUBLIC_TELEMETRY_KEY" + value: {{ .Values.environment.NEXT_PUBLIC_TELEMETRY_KEY}} + - name: "MS_GRAPH_CLIENT_ID" + value: {{ .Values.environment.MS_GRAPH_CLIENT_ID}} + - name: "MS_GRAPH_CLIENT_SECRET" + value: {{ .Values.environment.MS_GRAPH_CLIENT_SECRET}} + - name: "ZOOM_CLIENT_ID" + value: {{ .Values.environment.ZOOM_CLIENT_ID}} + - name: "ZOOM_CLIENT_SECRET" + value: {{ .Values.environment.ZOOM_CLIENT_SECRET}} + - name: "DAILY_API_KEY" + value: {{ .Values.environment.DAILY_API_KEY}} + - name: "EMAIL_FROM" + value: {{ .Values.environment.EMAIL_FROM}} + - name: "EMAIL_SERVER_HOST" + value: {{ .Values.environment.EMAIL_SERVER_HOST}} + - name: "EMAIL_SERVER_PORT" + value: {{ .Values.environment.EMAIL_SERVER_PORT}} + - name: "EMAIL_SERVER_USER" + value: {{ .Values.environment.EMAIL_SERVER_USER}} + - name: "EMAIL_SERVER_PASSWORD" + value: {{ .Values.environment.EMAIL_SERVER_PASSWORD}} + - name: "CRON_API_KEY" + value: {{ .Values.environment.CRON_API_KEY}} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/chart/calendso-chart/templates/hpa.yaml b/chart/calendso-chart/templates/hpa.yaml new file mode 100644 index 000000000..8954534b7 --- /dev/null +++ b/chart/calendso-chart/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "calendso-chart.fullname" . }} + labels: + {{- include "calendso-chart.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "calendso-chart.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/chart/calendso-chart/templates/ingress.yaml b/chart/calendso-chart/templates/ingress.yaml new file mode 100644 index 000000000..298fdaaf2 --- /dev/null +++ b/chart/calendso-chart/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "calendso-chart.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "calendso-chart.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/chart/calendso-chart/templates/service.yaml b/chart/calendso-chart/templates/service.yaml new file mode 100644 index 000000000..cc7618201 --- /dev/null +++ b/chart/calendso-chart/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "calendso-chart.fullname" . }} + labels: + {{- include "calendso-chart.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "calendso-chart.selectorLabels" . | nindent 4 }} diff --git a/chart/calendso-chart/templates/serviceaccount.yaml b/chart/calendso-chart/templates/serviceaccount.yaml new file mode 100644 index 000000000..df02f349d --- /dev/null +++ b/chart/calendso-chart/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "calendso-chart.serviceAccountName" . }} + labels: + {{- include "calendso-chart.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/chart/calendso-chart/templates/tests/test-connection.yaml b/chart/calendso-chart/templates/tests/test-connection.yaml new file mode 100644 index 000000000..b29862f53 --- /dev/null +++ b/chart/calendso-chart/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "calendso-chart.fullname" . }}-test-connection" + labels: + {{- include "calendso-chart.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "calendso-chart.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/chart/calendso-chart/values.yaml b/chart/calendso-chart/values.yaml new file mode 100644 index 000000000..61ddb9d6c --- /dev/null +++ b/chart/calendso-chart/values.yaml @@ -0,0 +1,142 @@ +# Default values for calendso-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + + repository: #your calendso docker image repo + pullPolicy: IfNotPresent + tag: "" +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +environment: + NEXT_PUBLIC_LICENSE_CONSENT: "agree" + + DATABASE_URL: 'postgresql://:@:/' + + GOOGLE_API_CREDENTIALS: #your Google api credentials + JWT_SECRET: 'secret' + + # Remove this var if you don't want Cal to collect anonymous usage + NEXT_PUBLIC_TELEMETRY_KEY: js.2pvs2bbpqq1zxna97wcml.oi2jzirnbj1ev4tc57c5r + + # Used for the Office 365 / Outlook.com Calendar integration + MS_GRAPH_CLIENT_ID: + MS_GRAPH_CLIENT_SECRET: + + # Used for the Zoom integration + ZOOM_CLIENT_ID: + ZOOM_CLIENT_SECRET: + + #Used for the Daily integration + DAILY_API_KEY: + + # E-mail settings + + # Cal uses nodemailer (@see https://nodemailer.com/about/) to provide email sending. As such we are trying to + # allow access to the nodemailer transports from the .env file. E-mail templates are accessible within lib/emails/ + + # Configures the global From: header whilst sending emails. + EMAIL_FROM: 'notifications@yourselfhostedcal.com' + + # Configure SMTP settings (@see https://nodemailer.com/smtp/). + # Note: The below configuration for Office 365 has been verified to work. + EMAIL_SERVER_HOST: "smtp.office365.com" + EMAIL_SERVER_PORT: "'587'" + EMAIL_SERVER_USER: "email@adress.com" + # Keep in mind that if you have 2FA enabled, you will need to provision an App Password. + EMAIL_SERVER_PASSWORD: "secret_passwprd" + # ApiKey for cronjobs + CRON_API_KEY: "0cc0e6c35519bba620c9360cfe3e68d0" + + # Stripe Config + # NEXT_PUBLIC_STRIPE_PUBLIC_KEY: # pk_test_... + # STRIPE_PRIVATE_KEY: # sk_test_... + # STRIPE_CLIENT_ID: # ca_... + # STRIPE_WEBHOOK_SECRET: # whsec_... + # PAYMENT_FEE_PERCENTAGE: 0.005 # Take 0.5% commission + # PAYMENT_FEE_FIXED: 10 # Take 10 additional cents commission + + # # Application Key for symmetric encryption and decryption + # # must be 32 bytes for AES256 encryption algorithm + # CALENDSO_ENCRYPTION_KEY: + + # # Intercom Config + # NEXT_PUBLIC_INTERCOM_APP_ID: + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 3000 + +ingress: + enabled: true + className: "" + annotations: + traefik.ingress.kubernetes.io/router.tls: "true" + # kubernetes.io/ingress.class: nginx + kubernetes.io/tls-acme: "true" + hosts: + - host: cal.yourhost.com + paths: + - path: / + pathType: ImplementationSpecific + backend: + serviceName: calendso + servicePort: 3000 + tls: + - secretName: calendso-cert + hosts: + - cal.yourhost.com + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}