From fc33f077824cb623f07f2b7a7b50bebfc36caff0 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Tue, 31 Aug 2021 19:16:32 +0530 Subject: [PATCH] feat: remove hardcoding for db and redis host vars and switch to configMap (#33) * feat: remove redis/postgres hardcoding and switch to ConfigMap * fix: helm lint failures * fix: configmap issue * fix: helm test suite * doc: update readme * feat: add separate values.yaml for github ci * Update README * Update NOTES.txt * add REDIS_TLS env var to handle TLS requirement for external redis * increment version to 0.6.3 --- charts/chatwoot/Chart.yaml | 2 +- charts/chatwoot/README.md | 56 ++-- charts/chatwoot/templates/NOTES.txt | 5 + charts/chatwoot/templates/_env_rails.tpl | 258 ------------------ charts/chatwoot/templates/_helpers.tpl | 128 +++++++++ charts/chatwoot/templates/env-configmap.yaml | 11 +- charts/chatwoot/templates/migrations-job.yaml | 9 +- .../templates/tests/test-connection.yaml | 9 +- charts/chatwoot/templates/web-deployment.yaml | 6 +- .../chatwoot/templates/worker-deployment.yaml | 6 +- charts/chatwoot/values.ci.yaml | 8 + charts/chatwoot/values.yaml | 9 +- 12 files changed, 199 insertions(+), 308 deletions(-) delete mode 100644 charts/chatwoot/templates/_env_rails.tpl create mode 100644 charts/chatwoot/values.ci.yaml diff --git a/charts/chatwoot/Chart.yaml b/charts/chatwoot/Chart.yaml index 13ac4fb..ad5f115 100644 --- a/charts/chatwoot/Chart.yaml +++ b/charts/chatwoot/Chart.yaml @@ -31,7 +31,7 @@ sources: - http://www.chatwoot.com # This is the chart version. -version: 0.6.1 +version: 0.6.3 # This is the application version. appVersion: "v1.19.0" diff --git a/charts/chatwoot/README.md b/charts/chatwoot/README.md index 0519200..49834a2 100644 --- a/charts/chatwoot/README.md +++ b/charts/chatwoot/README.md @@ -60,7 +60,7 @@ The command removes all the Kubernetes components associated with the chart and | `env.ACTIVE_STORAGE_SERVICE` | Storage service. `local` for disk. `amazon` for s3. | `"local"` | | `env.ASSET_CDN_HOST` | Set if CDN is used for asset delivery. | `""` | | `env.INSTALLATION_ENV` | Sets chatwoot installation method. | `"helm"` | -| `env.ENABLE_ACCOUNT_SIGNUP` | `true` : default option, allows sign ups, `false` : disables all the end points related to sign ups, `api_only`: disables the UI for signup but you can create sign ups via the account apis. | `"false"` | +| `env.ENABLE_ACCOUNT_SIGNUP` | `true` : default option, allows sign ups, `false` : disables all the end points related to sign ups, `api_only`: disables the UI for signup but you can create sign ups via the account apis. | `"false"` | | `env.FORCE_SSL` | Force all access to the app over SSL, default is set to false. | `"false"` | | `env.FRONTEND_URL` | Replace with the URL you are planning to use for your app. | `"http://0.0.0.0:3000/"` | | `env.IOS_APP_ID` | Change this variable only if you are using a custom build for mobile app. | `"6C953F3RX2.com.chatwoot.app"` | @@ -81,35 +81,38 @@ The command removes all the Kubernetes components associated with the chart and ### Email setup for conversation continuity (Incoming emails) -| Name | Type | Default Value | -| ----------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------- | -| `env.MAILER_INBOUND_EMAIL_DOMAIN` | This is the domain set for the reply emails when conversation continuity is enabled. | `""` | -| `env.RAILS_INBOUND_EMAIL_SERVICE` | Set this to appropriate ingress channel with regards to incoming emails. Possible values are `relay`, `mailgun`, `mandrill`, `postmark` and `sendgrid`. | `""` | -| `env.RAILS_INBOUND_EMAIL_PASSWORD` | Password for the email service. | `""` | -| `env.MAILGUN_INGRESS_SIGNING_KEY` | Set if using mailgun for incoming conversations. | `""` | -| `env.MANDRILL_INGRESS_API_KEY` | Set if using mandrill for incoming conversations. | `""` | +| Name | Type | Default Value | +| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| `env.MAILER_INBOUND_EMAIL_DOMAIN` | This is the domain set for the reply emails when conversation continuity is enabled. | `""` | +| `env.RAILS_INBOUND_EMAIL_SERVICE` | Set this to appropriate ingress channel with regards to incoming emails. Possible values are `relay`, `mailgun`, `mandrill`, `postmark` and `sendgrid`. | `""` | +| `env.RAILS_INBOUND_EMAIL_PASSWORD` | Password for the email service. | `""` | +| `env.MAILGUN_INGRESS_SIGNING_KEY` | Set if using mailgun for incoming conversations. | `""` | +| `env.MANDRILL_INGRESS_API_KEY` | Set if using mandrill for incoming conversations. | `""` | ### Postgres variables | Name | Type | Default Value | | ----------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------ | | `postgresql.enabled` | Set to `false` if using external postgres and modify the below variables. | `true` | -| `env.POSTGRES_DB` | Chatwoot database name | `"chatwoot_production"` | -| `env.POSTGRES_HOST` | Database url. Edit if using external postgres. | `"chatwoot-chatwoot-postgresql"` | -| `env.POSTGRES_PASSWORD` | Database password. Edit if using external postgres. | `"postgres"` | -| `env.POSTGRES_PORT` | Database port | `5432` | -| `env.POSTGRES_USERNAME` | Database username. | `"postgres"` | +| `postgresql.postgresqlDatabase` | Chatwoot database name | `chatwoot_production` | +| `postgresql.postgresqlHost` | Postgres host. Edit if using external postgres. | `""` | +| `postgresql.postgresqlPassword` | Postgres password. Edit if using external postgres. | `postgres` | +| `postgresql.postgresqlPort` | Postgres port | `5432` | +| `postgresql.postgresqlUsername` | Postgres username. | `postgres` | ### Redis variables -| Name | Type | Default Value | -| ----------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------- | -| `redis.enabled` | Set to `false` if using external redis and modify the below variables. | `true` | -| `env.REDIS_HOST` | Redis host name | `"chatwoot-chatwoot-redis-master"` | -| `env.REDIS_PASSWORD` | Redis password | `"redis"` | -| `env.REDIS_SENTINELS` | Redis Sentinel can be used by passing list of sentinel host and ports. For example, `sentinel_host1:port1`, `sentinel_host2:port2` | `""` | -| `env.REDIS_SENTINEL_MASTER_NAME` | Redis sentinel master name is required when using sentinel. | `""` | -| `env.REDIS_URL` | REDIS url | `"redis://:redis@chatwoot-chatwoot-redis-master:6379"` | +| Name | Type | Default Value | +| ----------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------- | +| `redis.auth.password` | Password used for internal redis cluster | `redis` | +| `redis.enabled` | Set to `false` if using external redis and modify the below variables. | `true` | +| `redis.host` | Redis host name | `""` | +| `redis.port` | Redis port | `""` | +| `redis.password` | Redis password | `""` | +| `env.REDIS_TLS` | Set to `true` if TLS(`rediss://`) is required | `false` | +| `env.REDIS_SENTINELS` | Redis Sentinel can be used by passing list of sentinel host and ports. | `""` | +| `env.REDIS_SENTINEL_MASTER_NAME` | Redis sentinel master name is required when using sentinel. | `""` | + ### Logging variables @@ -165,12 +168,6 @@ The command removes all the Kubernetes components associated with the chart and | nodeSelector | object | `{}` | | | podAnnotations | object | `{}` | | | podSecurityContext | object | `{}` | | -| postgresql.enabled | bool | `true` | | -| postgresql.nameOverride | string | `"chatwoot-postgresql"` | | -| postgresql.postgresqlDatabase | string | `"chatwoot_production"` | | -| postgresql.postgresqlPassword | string | `"postgres"` | | -| postgresql.postgresqlUsername | string | `"postgres"` | | -| redis.auth.password | string | `"redis"` | | | redis.master.persistence.enabled | bool | `true` | | | redis.nameOverride | string | `"chatwoot-redis"` | | | resources | object | `{}` | | @@ -209,17 +206,18 @@ $ helm install my-release -f values.yaml chatwoot/chatwoot > **Tip** You can use the default `values.yaml` file. ## Postgres + PostgreSQL is installed along with the chart if you choose the default setup. To use an external Postgres DB, please set `postgresql.enabled` to `false` and set the variables under the Postgres section above. ## Redis -Redis is installed along with the chart if you choose the default setup. To use an external Redis DB, please set `redis.enabled` to `false` and set the variables under the Redis section above +Redis is installed along with the chart if you choose the default setup. To use an external Redis DB, please set `redis.enabled` to `false` and set the variables under the Redis section above. ## Upgrading -## From 0.5.x to 0.6.x +## To 0.6.x Existing labels were causing issues with `helm upgrade`. `0.6.x` introduces breaking changes related to selector labels used for deployements. Please delete your helm release and recreate. Deleting your helm release will diff --git a/charts/chatwoot/templates/NOTES.txt b/charts/chatwoot/templates/NOTES.txt index eafe3f5..79135bf 100644 --- a/charts/chatwoot/templates/NOTES.txt +++ b/charts/chatwoot/templates/NOTES.txt @@ -7,4 +7,9 @@ To learn more about the release, try: $ helm status {{ .Release.Name }} $ helm get all {{ .Release.Name }} +NOTE: It may take a few minutes for the LoadBalancer IP to be available. +You can watch the status by running +'kubectl get svc -w {{ template "chatwoot.fullname" . }}' +export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "chatwoot.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') +echo http://$SERVICE_IP:{{ .Values.services.targetPort }} diff --git a/charts/chatwoot/templates/_env_rails.tpl b/charts/chatwoot/templates/_env_rails.tpl deleted file mode 100644 index 7b06869..0000000 --- a/charts/chatwoot/templates/_env_rails.tpl +++ /dev/null @@ -1,258 +0,0 @@ -{{- define "chatwoot.environ" }} - - - name: ACTIVE_STORAGE_SERVICE - valueFrom: - configMapKeyRef: - key: ACTIVE_STORAGE_SERVICE - name: env - - name: ASSET_CDN_HOST - valueFrom: - configMapKeyRef: - key: ASSET_CDN_HOST - name: env - - name: AWS_ACCESS_KEY_ID - valueFrom: - configMapKeyRef: - key: AWS_ACCESS_KEY_ID - name: env - - name: AWS_REGION - valueFrom: - configMapKeyRef: - key: AWS_REGION - name: env - - name: AWS_SECRET_ACCESS_KEY - valueFrom: - configMapKeyRef: - key: AWS_SECRET_ACCESS_KEY - name: env - - name: DISABLE_DATABASE_ENVIRONMENT_CHECK - value: "0" - - name: ENABLE_ACCOUNT_SIGNUP - valueFrom: - configMapKeyRef: - key: ENABLE_ACCOUNT_SIGNUP - name: env - - name: FB_APP_ID - valueFrom: - configMapKeyRef: - key: FB_APP_ID - name: env - - name: FB_APP_SECRET - valueFrom: - configMapKeyRef: - key: FB_APP_SECRET - name: env - - name: FB_VERIFY_TOKEN - valueFrom: - configMapKeyRef: - key: FB_VERIFY_TOKEN - name: env - - name: FORCE_SSL - valueFrom: - configMapKeyRef: - key: FORCE_SSL - name: env - - name: FRONTEND_URL - valueFrom: - configMapKeyRef: - key: FRONTEND_URL - name: env - - name: INSTALLATION_ENV - valueFrom: - configMapKeyRef: - key: INSTALLATION_ENV - name: env - - name: IOS_APP_ID - valueFrom: - configMapKeyRef: - key: IOS_APP_ID - name: env - - name: LOG_LEVEL - valueFrom: - configMapKeyRef: - key: LOG_LEVEL - name: env - - name: LOG_SIZE - valueFrom: - configMapKeyRef: - key: LOG_SIZE - name: env - - name: MAILER_INBOUND_EMAIL_DOMAIN - valueFrom: - configMapKeyRef: - key: MAILER_INBOUND_EMAIL_DOMAIN - name: env - - name: MAILER_SENDER_EMAIL - valueFrom: - configMapKeyRef: - key: MAILER_SENDER_EMAIL - name: env - - name: MAILGUN_INGRESS_SIGNING_KEY - valueFrom: - configMapKeyRef: - key: MAILGUN_INGRESS_SIGNING_KEY - name: env - - name: MANDRILL_INGRESS_API_KEY - valueFrom: - configMapKeyRef: - key: MANDRILL_INGRESS_API_KEY - name: env - - name: NODE_ENV - value: production - - name: POSTGRES_HOST - valueFrom: - configMapKeyRef: - key: POSTGRES_HOST - name: env - - name: POSTGRES_PORT - valueFrom: - configMapKeyRef: - key: POSTGRES_PORT - name: env - - name: POSTGRES_PASSWORD - valueFrom: - configMapKeyRef: - key: POSTGRES_PASSWORD - name: env - - name: POSTGRES_DB - valueFrom: - configMapKeyRef: - key: POSTGRES_DB - name: env - - name: POSTGRES_USERNAME - valueFrom: - configMapKeyRef: - key: POSTGRES_USERNAME - name: env - - name: RAILS_ENV - valueFrom: - configMapKeyRef: - key: RAILS_ENV - name: env - - name: RAILS_INBOUND_EMAIL_PASSWORD - valueFrom: - configMapKeyRef: - key: RAILS_INBOUND_EMAIL_PASSWORD - name: env - - name: RAILS_INBOUND_EMAIL_SERVICE - valueFrom: - configMapKeyRef: - key: RAILS_INBOUND_EMAIL_SERVICE - name: env - - name: RAILS_LOG_TO_STDOUT - valueFrom: - configMapKeyRef: - key: RAILS_LOG_TO_STDOUT - name: env - - name: RAILS_MAX_THREADS - valueFrom: - configMapKeyRef: - key: RAILS_MAX_THREADS - name: env - - name: REDIS_PASSWORD - valueFrom: - configMapKeyRef: - key: REDIS_PASSWORD - name: env - - name: REDIS_SENTINELS - valueFrom: - configMapKeyRef: - key: REDIS_SENTINELS - name: env - - name: REDIS_SENTINEL_MASTER_NAME - valueFrom: - configMapKeyRef: - key: REDIS_SENTINEL_MASTER_NAME - name: env - - name: REDIS_URL - valueFrom: - configMapKeyRef: - key: REDIS_URL - name: env - - name: S3_BUCKET_NAME - valueFrom: - configMapKeyRef: - key: S3_BUCKET_NAME - name: env - - name: SECRET_KEY_BASE - valueFrom: - configMapKeyRef: - key: SECRET_KEY_BASE - name: env - - name: SENTRY_DSN - valueFrom: - configMapKeyRef: - key: SENTRY_DSN - name: env - - name: SLACK_CLIENT_ID - valueFrom: - configMapKeyRef: - key: SLACK_CLIENT_ID - name: env - - name: SLACK_CLIENT_SECRET - valueFrom: - configMapKeyRef: - key: SLACK_CLIENT_SECRET - name: env - - name: SMTP_ADDRESS - valueFrom: - configMapKeyRef: - key: SMTP_ADDRESS - name: env - - name: SMTP_AUTHENTICATION - valueFrom: - configMapKeyRef: - key: SMTP_AUTHENTICATION - name: env - - name: SMTP_ENABLE_STARTTLS_AUTO - valueFrom: - configMapKeyRef: - key: SMTP_ENABLE_STARTTLS_AUTO - name: env - - name: SMTP_OPENSSL_VERIFY_MODE - valueFrom: - configMapKeyRef: - key: SMTP_OPENSSL_VERIFY_MODE - name: env - - name: SMTP_PASSWORD - valueFrom: - configMapKeyRef: - key: SMTP_PASSWORD - name: env - - name: SMTP_PORT - valueFrom: - configMapKeyRef: - key: SMTP_PORT - name: env - - name: SMTP_USERNAME - valueFrom: - configMapKeyRef: - key: SMTP_USERNAME - name: env - - name: TWITTER_APP_ID - valueFrom: - configMapKeyRef: - key: TWITTER_APP_ID - name: env - - name: TWITTER_CONSUMER_KEY - valueFrom: - configMapKeyRef: - key: TWITTER_CONSUMER_KEY - name: env - - name: TWITTER_CONSUMER_SECRET - valueFrom: - configMapKeyRef: - key: TWITTER_CONSUMER_SECRET - name: env - - name: TWITTER_ENVIRONMENT - valueFrom: - configMapKeyRef: - key: TWITTER_ENVIRONMENT - name: env - - name: USE_INBOX_AVATAR_FOR_BOT - valueFrom: - configMapKeyRef: - key: USE_INBOX_AVATAR_FOR_BOT - name: env - -{{- end }} diff --git a/charts/chatwoot/templates/_helpers.tpl b/charts/chatwoot/templates/_helpers.tpl index 3ad0038..14b2aff 100644 --- a/charts/chatwoot/templates/_helpers.tpl +++ b/charts/chatwoot/templates/_helpers.tpl @@ -60,3 +60,131 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + + +{{- define "chatwoot.postgresql.fullname" -}} +{{- if .Values.postgresql.fullnameOverride -}} +{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.postgresql.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name "chatwoot-postgresql" | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "chatwoot.redis.fullname" -}} +{{- if .Values.redis.fullnameOverride -}} +{{- .Values.redis.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.redis.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name "chatwoot-redis" | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Set postgres host +*/}} +{{- define "chatwoot.postgresql.host" -}} +{{- if .Values.postgresql.enabled -}} +{{- template "chatwoot.postgresql.fullname" . -}} +{{- else -}} +{{- .Values.postgresql.postgresqlHost | quote -}} +{{- end -}} +{{- end -}} + +{{/* +Set postgres secret +*/}} +{{- define "chatwoot.postgresql.secret" -}} +{{- if .Values.postgresql.enabled -}} +{{- template "chatwoot.postgresql.fullname" . -}} +{{- else -}} +{{- template "chatwoot.fullname" . -}} +{{- end -}} +{{- end -}} + +{{/* +Set postgres secretKey +*/}} +{{- define "chatwoot.postgresql.secretKey" -}} +{{- if .Values.postgresql.enabled -}} +"postgresql-password" +{{- else -}} +{{- default "postgresql-password" .Values.postgresql.existingSecretKey | quote -}} +{{- end -}} +{{- end -}} + +{{/* +Set postgres port +*/}} +{{- define "chatwoot.postgresql.port" -}} +{{- if .Values.postgresql.enabled -}} + "5432" +{{- else -}} +{{- default "5432" .Values.postgresql.postgresqlPort | quote -}} +{{- end -}} +{{- end -}} + +{{/* +Set redis host +*/}} +{{- define "chatwoot.redis.host" -}} +{{- if .Values.redis.enabled -}} +{{- template "chatwoot.redis.fullname" . -}}-master +{{- else -}} +{{- .Values.redis.host | quote -}} +{{- end -}} +{{- end -}} + +{{/* +Set redis secret +*/}} +{{- define "chatwoot.redis.secret" -}} +{{- if .Values.redis.enabled -}} +{{- template "chatwoot.redis.fullname" . -}} +{{- else -}} +{{- template "chatwoot.fullname" . -}} +{{- end -}} +{{- end -}} + +{{/* +Set redis secretKey +*/}} +{{- define "chatwoot.redis.secretKey" -}} +{{- if .Values.redis.enabled -}} +"redis-password" +{{- else -}} +{{- default "redis-password" .Values.redis.existingSecretKey | quote -}} +{{- end -}} +{{- end -}} + +{{/* +Set redis port +*/}} +{{- define "chatwoot.redis.port" -}} +{{- if .Values.redis.enabled -}} + 6379 +{{- else -}} +{{- default 6379 .Values.redis.port -}} +{{- end -}} +{{- end -}} + +{{/* +Set redis URL +*/}} +{{- define "chatwoot.redis.url" -}} +{{- if .Values.redis.enabled -}} + "redis://:{{ .Values.redis.auth.password }}@{{ template "chatwoot.redis.host" . }}:{{ template "chatwoot.redis.port" . }}" +{{- else if .Values.env.REDIS_TLS -}} + "rediss://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.port }}" +{{- else -}} + "redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.port }}" +{{- end -}} +{{- end -}} diff --git a/charts/chatwoot/templates/env-configmap.yaml b/charts/chatwoot/templates/env-configmap.yaml index e7e4b09..ba7d0df 100644 --- a/charts/chatwoot/templates/env-configmap.yaml +++ b/charts/chatwoot/templates/env-configmap.yaml @@ -7,8 +7,17 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" - name: env + name: {{ template "chatwoot.fullname" . }}-env data: + POSTGRES_HOST: "{{ template "chatwoot.postgresql.host" . }}" + POSTGRES_PORT: {{ template "chatwoot.postgresql.port" . }} + POSTGRES_USERNAME: {{ default "postgres" .Values.postgresql.postgresqlUsername | quote }} + POSTGRES_PASSWORD: {{ default "postgres" .Values.postgresql.postgresqlPassword | quote }} + POSTGRES_DB: {{ default "chatwoot_production" .Values.postgresql.postgresqlDatabase | quote }} + REDIS_HOST: "{{ template "chatwoot.redis.host" . }}" + REDIS_PORT: "{{ template "chatwoot.redis.port" . }}" + REDIS_PASSWORD: {{ default "redis" .Values.redis.auth.password | quote }} + REDIS_URL: {{template "chatwoot.redis.url" . }} {{- range $key, $value := .Values.env}} {{ $key }}: {{ $value | quote }} {{- end }} diff --git a/charts/chatwoot/templates/migrations-job.yaml b/charts/chatwoot/templates/migrations-job.yaml index ed427d1..c220ec1 100644 --- a/charts/chatwoot/templates/migrations-job.yaml +++ b/charts/chatwoot/templates/migrations-job.yaml @@ -20,10 +20,10 @@ spec: initContainers: - name: init-postgres image: busybox:1.28 - command: ["sh", "-c", "until nslookup {{ .Values.env.POSTGRES_HOST }}; do echo waiting for {{ .Values.env.POSTGRES_HOST }}; sleep 2; done;"] + command: ["sh", "-c", "until nslookup {{ template "chatwoot.postgresql.host" . }} ; do echo waiting for {{ template "chatwoot.postgresql.host" . }}; sleep 2; done;"] - name: init-redis image: busybox:1.28 - command: ["sh", "-c", "until nslookup {{ .Values.env.REDIS_HOST }}; do echo waiting for {{ .Values.env.REDIS_HOST }}; sleep 2; done;"] + command: ["sh", "-c", "until nslookup {{ template "chatwoot.redis.host" . }} ; do echo waiting for {{ template "chatwoot.redis.host" . }} ; sleep 2; done;"] containers: - name: "db-migrate-job" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" @@ -32,6 +32,7 @@ spec: - exec - rails - db:chatwoot_prepare - env: - {{- include "chatwoot.environ" . }} + envFrom: + - configMapRef: + name: {{ template "chatwoot.fullname" . }}-env imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/charts/chatwoot/templates/tests/test-connection.yaml b/charts/chatwoot/templates/tests/test-connection.yaml index 6637c6d..0df61e5 100644 --- a/charts/chatwoot/templates/tests/test-connection.yaml +++ b/charts/chatwoot/templates/tests/test-connection.yaml @@ -3,13 +3,18 @@ kind: Pod metadata: name: "{{ include "chatwoot.fullname" . }}-test-connection" labels: - {{- include "chatwoot.labels" . | nindent 4 }} + app: {{ template "chatwoot.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" annotations: "helm.sh/hook": test + "helm.sh/hook-delete-policy": hook-succeeded spec: containers: - name: wget image: busybox + imagePullPolicy: IfNotPresent command: ['wget'] - args: ['{{ include "chatwoot.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "chatwoot.fullname" . }}:{{ .Values.services.targetPort }}'] restartPolicy: Never diff --git a/charts/chatwoot/templates/web-deployment.yaml b/charts/chatwoot/templates/web-deployment.yaml index c194a28..e3c9bb8 100644 --- a/charts/chatwoot/templates/web-deployment.yaml +++ b/charts/chatwoot/templates/web-deployment.yaml @@ -34,11 +34,11 @@ spec: - {{ .Values.services.internlPort | quote}} - -b - 0.0.0.0 - command: - docker/entrypoints/rails.sh - env: - {{- include "chatwoot.environ" . }} + envFrom: + - configMapRef: + name: {{ template "chatwoot.fullname" . }}-env image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" name: {{ .Chart.Name }}-web ports: diff --git a/charts/chatwoot/templates/worker-deployment.yaml b/charts/chatwoot/templates/worker-deployment.yaml index 49d9f01..08dc58d 100644 --- a/charts/chatwoot/templates/worker-deployment.yaml +++ b/charts/chatwoot/templates/worker-deployment.yaml @@ -31,8 +31,9 @@ spec: - sidekiq - -C - config/sidekiq.yml - env: - {{- include "chatwoot.environ" . }} + envFrom: + - configMapRef: + name: {{ template "chatwoot.fullname" . }}-env image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" name: {{ .Chart.Name }}-workers {{- with .Values.resources }} @@ -42,3 +43,4 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} status: {} + diff --git a/charts/chatwoot/values.ci.yaml b/charts/chatwoot/values.ci.yaml new file mode 100644 index 0000000..8baf000 --- /dev/null +++ b/charts/chatwoot/values.ci.yaml @@ -0,0 +1,8 @@ +web: + replica: 1 +worker: + replica: 1 + +redis: + replica: + replicaCount: 1 diff --git a/charts/chatwoot/values.yaml b/charts/chatwoot/values.yaml index 71a030e..b1005c1 100644 --- a/charts/chatwoot/values.yaml +++ b/charts/chatwoot/values.yaml @@ -164,21 +164,14 @@ env: MAILER_SENDER_EMAIL: "" MAILGUN_INGRESS_SIGNING_KEY: "" MANDRILL_INGRESS_API_KEY: "" - POSTGRES_HOST: chatwoot-chatwoot-postgresql - POSTGRES_PORT: 5432 - POSTGRES_PASSWORD: "postgres" - POSTGRES_USERNAME: "postgres" - POSTGRES_DB: chatwoot_production RAILS_ENV: production RAILS_INBOUND_EMAIL_PASSWORD: "" RAILS_INBOUND_EMAIL_SERVICE: "" RAILS_LOG_TO_STDOUT: "true" RAILS_MAX_THREADS: "5" - REDIS_PASSWORD: "redis" REDIS_SENTINEL_MASTER_NAME: "" REDIS_SENTINELS: "" - REDIS_HOST: "chatwoot-chatwoot-redis-master" - REDIS_URL: redis://:redis@chatwoot-chatwoot-redis-master:6379 + REDIS_TLS: false S3_BUCKET_NAME: "" SECRET_KEY_BASE: wsedrfghjhygtfrdecfvbhnygtfvbtyftctdrxresxcygvujhb SENTRY_DSN: ""