Skip to content

Commit

Permalink
Inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea committed Dec 9, 2024
0 parents commit 33bdd96
Show file tree
Hide file tree
Showing 18 changed files with 618 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/publish-helm-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Helm Chart

on:
push:
branches:
- master
paths:
- 'charts/**'

permissions:
contents: read
pages: write
id-token: write

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.12.3

- name: Create Helm package
run: |
mkdir -p public
helm package ./charts/twentycrm -d ./public
helm repo index ./public/ --url https://amecea.github.io/helm-twentycrm
pwd
ls -la
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# TwentyCRM helm chart


This repository provides a helm chart to deploy TwentyCRM.

## Install

Create a `values.yaml` file and put all your config, see `Configuration` section, then run:

```
helm repo add amecea https://amecea.github.io/helm-twentycrm
helm upgrade -i twenty-crm amecea/twentycrm -f values.yaml
```

## Configuration

For a complete list of configuration fields please check [values.yaml](./values.yaml) file.


| Field Name | Description | Default Value |
|----------------------------------|-------------------------------------------------------------------------------------------|-------------------------|
| `image` | Docker image for the application. | `twentycrm/twenty:latest` |
| `env` | List of environment variables for configuring the application. | `[]` |
| `secrets.accessToken` | Access token for authentication. | |
| `secrets.loginToken` | Login token for authentication. | |
| `secrets.refreshToken` | Refresh token for authentication. | |
| `secrets.fileToken` | File token for authentication. | |
| `server.replicas` | Number of server replicas. | `1` |
| `server.storage` | Storage size for the server. | `5Gi` |
| `server.storageClassName` | Storage class name for server persistence. | |
| `server.resources.requests.memory` | Memory resource request for the server. | `128Mi` |
| `server.resources.requests.cpu` | CPU resource request for the server. | `100m` |
| `worker.replicas` | Number of worker replicas. | `1` |
| `worker.resources.requests.memory` | Memory resource request for workers. | `128Mi` |
| `worker.resources.requests.cpu` | CPU resource request for workers. | `100m` |
| `db.image` | Docker image for the PostgreSQL database. | `twentycrm/twenty-postgres:latest` |
| `db.storage` | Storage size for the database. | `5Gi` |
| `db.storageClassName` | Storage class name for database persistence. | |
| `db.adminPassword` | Admin password for the database. | |
| `db.database` | Name of the database. | `twenty` |
| `db.user` | Database user name. | `twenty` |
| `db.password` | Password for the database user. | `twenty` |
| `db.resources.requests.memory` | Memory resource request for the database. | `256Mi` |
| `db.resources.requests.cpu` | CPU resource request for the database. | `100m` |
| `redis.image` | Docker image for Redis. | `redis:latest` |
| `redis.resources.requests.memory` | Memory resource request for Redis. | `128Mi` |
| `redis.resources.requests.cpu` | CPU resource request for Redis. | `20m` |
| `ingress.enabled` | Enable or disable ingress. | `true` |
| `ingress.host` | Hostname for the ingress. | `crm.example.com` |
| `ingress.class` | Ingress class name. | `nginx` |

4 changes: 4 additions & 0 deletions charts/twentycrm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for https://github.com/twentyhq/twenty
name: twentycrm
version: 0.1.0
9 changes: 9 additions & 0 deletions charts/twentycrm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

66 changes: 66 additions & 0 deletions charts/twentycrm/templates/deployment-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-db
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}

spec:
progressDeadlineSeconds: 600
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate

selector:
matchLabels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: db
template:
metadata:
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: db
spec:
securityContext:
fsGroup: 1001
volumes:
- name: twentycrm-db-data
persistentVolumeClaim:
claimName: {{ .Release.Name }}-db-pvc

containers:
- name: twentycrm-db
image: {{ .Values.db.image }}
imagePullPolicy: Always
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-app-secrets
key: PG_ADMIN_PASSWORD

- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-app-secrets
key: PG_DATABASE

- name: BITNAMI_DEBUG
value: "true"
ports:
- containerPort: 5432
name: tcp
protocol: TCP
resources:
{{- toYaml .Values.db.resources | indent 12 | printf "\n%s" }}
volumeMounts:
- mountPath: /bitnami/postgresql
name: twentycrm-db-data
41 changes: 41 additions & 0 deletions charts/twentycrm/templates/deployment-redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-redis
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}

spec:
progressDeadlineSeconds: 600
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate

selector:
matchLabels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: redis
template:
metadata:
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: redis
spec:
containers:
- name: twentycrm-redis
image: {{ .Values.redis.image }}
imagePullPolicy: Always
ports:
- containerPort: 6379
name: tcp
protocol: TCP
resources:
{{- toYaml .Values.redis.resources | indent 12 | printf "\n%s" }}
94 changes: 94 additions & 0 deletions charts/twentycrm/templates/deployment-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-server
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}

spec:
progressDeadlineSeconds: 600
replicas: {{ .Values.server.replicas }}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: server

template:
metadata:
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: server
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
securityContext:
fsGroup: 1001

volumes:
- name: twentycrm-server-data
persistentVolumeClaim:
claimName: {{ .Release.Name }}-server-pvc
initContainers:
# if it's not ready at first start the db setup fail badly
- name: wait-db-ready
image: {{ .Values.db.image }}
command: ["pg_isready", "-d", "$(PG_DATABASE_URL)" ]
envFrom:
- secretRef:
name: {{ .Release.Name }}-app-secrets

containers:
- name: twentycrm-server
image: {{ .Values.image }}
imagePullPolicy: Always
envFrom:
- secretRef:
name: {{ .Release.Name }}-app-secrets
- secretRef:
name: {{ .Release.Name }}-app-tokens

env:
- name: PORT
value: "3000"
- name: SERVER_URL
value: "https://{{ .Values.ingress.host }}"
- name: FRONT_BASE_URL
value: "https://{{ .Values.ingress.host }}"
- name: ENABLE_DB_MIGRATIONS
value: "true"
- name: SIGN_IN_PREFILLED
value: "true"
- name: STORAGE_TYPE
value: "local"
- name: "MESSAGE_QUEUE_TYPE"
value: "pg-boss"

ports:
- containerPort: 3000
name: http-tcp
protocol: TCP
resources:
{{- toYaml .Values.server.resources | indent 12 | printf "\n%s" }}
volumeMounts:
- mountPath: /app/docker-data
name: twentycrm-server-data
- mountPath: /app/.local-storage
name: twentycrm-server-data
#livenessProbe:
# httpGet:
# path: "/healthz"
# port: 3000
#readinessProbe:
# httpGet:
# path: "/healthz"
# port: 3000
62 changes: 62 additions & 0 deletions charts/twentycrm/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-worker
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}

spec:
progressDeadlineSeconds: 600
replicas: {{ .Values.worker.replicas }}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: worker

template:
metadata:
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
role: worker
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
containers:
- name: twentycrm-worker
image: {{ .Values.image }}
imagePullPolicy: Always
envFrom:
- secretRef:
name: {{ .Release.Name }}-app-secrets
- secretRef:
name: {{ .Release.Name }}-app-tokens
env:
- name: SERVER_URL
value: "https://{{ .Values.ingress.host }}"
- name: FRONT_BASE_URL
value: "https://{{ .Values.ingress.host }}"
- name: ENABLE_DB_MIGRATIONS
value: "false"
- name: SIGN_IN_PREFILLED
value: "true"
- name: STORAGE_TYPE
value: "local"
- name: "MESSAGE_QUEUE_TYPE"
value: "pg-boss"

command:
- yarn
- worker:prod
resources:
{{- toYaml .Values.worker.resources | indent 12 | printf "\n%s" }}

Loading

0 comments on commit 33bdd96

Please sign in to comment.