diff --git a/hosting/kubernetes/budibase/templates/_helpers.tpl b/hosting/kubernetes/budibase/templates/_helpers.tpl index 67485ac2a0..3b0853e19f 100644 --- a/hosting/kubernetes/budibase/templates/_helpers.tpl +++ b/hosting/kubernetes/budibase/templates/_helpers.tpl @@ -26,6 +26,13 @@ CouchDB secret identifier {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Internal DNS +*/}} +{{- define "budibase.serviceDns" -}} +{{- printf "%s.%s.%s" .Release.Namespace "svc" .Values.services.dns -}} +{{- end -}} + {{/* Create chart name and version as used by the chart label. */}} diff --git a/hosting/kubernetes/budibase/templates/app-service-deployment.yaml b/hosting/kubernetes/budibase/templates/app-service-deployment.yaml index 9f23089fd8..16b7bdddec 100644 --- a/hosting/kubernetes/budibase/templates/app-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/app-service-deployment.yaml @@ -29,7 +29,8 @@ spec: - name: BUDIBASE_ENVIRONMENT value: {{ .Values.globals.budibaseEnv }} - name: COUCH_DB_URL - value: {{ .Values.services.couchdb.url | quote }} + # Or inject value directly + value: couchdb-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.couchdb.port }} - name: ENABLE_ANALYTICS value: {{ .Values.globals.enableAnalytics | quote }} - name: INTERNAL_API_KEY @@ -55,19 +56,21 @@ spec: name: {{ template "budibase.fullname" . }} key: objectStoreSecret - name: MINIO_URL - value: {{ .Values.services.object_store.url }} + # Or inject value directly + value: minio-service.{{ include "budibase.serviceDns" . }}{{ .Values.services.objectStore.port }} - name: PORT value: {{ .Values.services.apps.port | quote }} - name: REDIS_PASSWORD value: {{ .Values.services.redis.password }} - name: REDIS_URL - value: "{{ .Values.services.redis.host }}:{{ .Values.services.redis.port }}" + # Or inject value directly + value: redis-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.redis.port }} - name: SELF_HOSTED value: {{ .Values.globals.selfHosted | quote }} - name: SENTRY_DSN value: {{ .Values.globals.sentryDSN }} - name: WORKER_URL - value: "{{ .Values.services.worker.host }}:{{ .Values.services.worker.port }}" + value: worker-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.worker.port }} image: budibase/apps imagePullPolicy: Always name: bbapps diff --git a/hosting/kubernetes/budibase/templates/minio-data-persistentvolumeclaim.yaml b/hosting/kubernetes/budibase/templates/minio-data-persistentvolumeclaim.yaml index a016824d03..d122ad0a3e 100644 --- a/hosting/kubernetes/budibase/templates/minio-data-persistentvolumeclaim.yaml +++ b/hosting/kubernetes/budibase/templates/minio-data-persistentvolumeclaim.yaml @@ -1,4 +1,4 @@ -{{- if .Values.services.object_store.minio }} +{{- if .Values.services.objectStore.minio }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -11,6 +11,6 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ .Values.services.object_store.storage }} + storage: {{ .Values.services.objectStore.storage }} status: {} {{- end }} \ No newline at end of file diff --git a/hosting/kubernetes/budibase/templates/minio-service-deployment.yaml b/hosting/kubernetes/budibase/templates/minio-service-deployment.yaml index 405044c92d..a23d0c1d89 100644 --- a/hosting/kubernetes/budibase/templates/minio-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/minio-service-deployment.yaml @@ -1,4 +1,4 @@ -{{- if .Values.services.object_store.minio }} +{{- if .Values.services.objectStore.minio }} apiVersion: apps/v1 kind: Deployment metadata: @@ -31,19 +31,17 @@ spec: - /data env: - name: MINIO_BROWSER - value: {{ .Values.services.object_store.browser | quote }} + value: {{ .Values.services.objectStore.browser | quote }} - name: MINIO_ACCESS_KEY valueFrom: secretKeyRef: name: {{ template "budibase.fullname" . }} key: objectStoreAccess - # value: {{ .Values.services.object_store.accessKey }} - name: MINIO_SECRET_KEY valueFrom: secretKeyRef: name: {{ template "budibase.fullname" . }} key: objectStoreSecret - # value: {{ .Values.services.object_store.secretKey }} image: minio/minio imagePullPolicy: "" livenessProbe: @@ -57,7 +55,7 @@ spec: timeoutSeconds: 20 name: minio-service ports: - - containerPort: {{ .Values.services.object_store.port }} + - containerPort: {{ .Values.services.objectStore.port }} resources: {} volumeMounts: - mountPath: /data diff --git a/hosting/kubernetes/budibase/templates/minio-service-service.yaml b/hosting/kubernetes/budibase/templates/minio-service-service.yaml index 61040e4f44..cfdb22002b 100644 --- a/hosting/kubernetes/budibase/templates/minio-service-service.yaml +++ b/hosting/kubernetes/budibase/templates/minio-service-service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.services.object_store.minio }} +{{- if .Values.services.objectStore.minio }} apiVersion: v1 kind: Service metadata: @@ -11,9 +11,9 @@ metadata: name: minio-service spec: ports: - - name: {{ .Values.services.object_store.port | quote }} - port: {{ .Values.services.object_store.port }} - targetPort: {{ .Values.services.object_store.port }} + - name: {{ .Values.services.objectStore.port | quote }} + port: {{ .Values.services.objectStore.port }} + targetPort: {{ .Values.services.objectStore.port }} selector: io.kompose.service: minio-service status: diff --git a/hosting/kubernetes/budibase/templates/secrets.yaml b/hosting/kubernetes/budibase/templates/secrets.yaml index 09ee77511e..1c0a914ed3 100644 --- a/hosting/kubernetes/budibase/templates/secrets.yaml +++ b/hosting/kubernetes/budibase/templates/secrets.yaml @@ -12,6 +12,6 @@ type: Opaque data: internalApiKey: {{ template "budibase.defaultsecret" .Values.globals.internalApiKey }} jwtSecret: {{ template "budibase.defaultsecret" .Values.globals.jwtSecret }} - objectStoreAccess: {{ template "budibase.defaultsecret" .Values.services.object_store.accessKey }} - objectStoreSecret: {{ template "budibase.defaultsecret" .Values.services.object_store.secretKey }} + objectStoreAccess: {{ template "budibase.defaultsecret" .Values.services.objectStore.accessKey }} + objectStoreSecret: {{ template "budibase.defaultsecret" .Values.services.objectStore.secretKey }} {{- end -}} diff --git a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml index 79cc078f90..1596b74bec 100644 --- a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml @@ -40,7 +40,7 @@ spec: name: {{ template "couchdb.fullname" . }} key: adminPassword - name: COUCH_DB_URL - value: {{ .Values.services.couchdb.url | quote }} + value: http://couchdb-service.{{ include "budibase.serviceDns" . }}:{{ .Values.services.couchdb.port }} - name: INTERNAL_API_KEY valueFrom: secretKeyRef: @@ -62,13 +62,13 @@ spec: name: {{ template "budibase.fullname" . }} key: objectStoreSecret - name: MINIO_URL - value: {{ .Values.services.object_store.url }} + value: minio-service.{{ include "budibase.serviceDns" . }}{{ .Values.services.objectStore.port }} - name: PORT value: {{ .Values.services.worker.port | quote }} - name: REDIS_PASSWORD value: {{ .Values.services.redis.password | quote }} - name: REDIS_URL - value: "{{ .Values.services.redis.host }}:{{ .Values.services.redis.port }}" + value: redis-service.{{ include "budibase.serviceDns" . }}{{ .Values.services.redis.port }} - name: SELF_HOSTED value: {{ .Values.globals.selfHosted | quote }} image: budibase/worker diff --git a/hosting/kubernetes/budibase/values.yaml b/hosting/kubernetes/budibase/values.yaml index fd3ab24e62..a71ad09b59 100644 --- a/hosting/kubernetes/budibase/values.yaml +++ b/hosting/kubernetes/budibase/values.yaml @@ -88,14 +88,16 @@ globals: sentryDSN: "" logLevel: info selfHosted: 1 - # creates an internal API key, JWT secrets and redis password for you - createSecrets: true + createSecrets: true # creates an internal API key, JWT secrets and redis password for you + # if createSecrets is set to false, you can hard-code your secrets here internalApiKey: "" jwtSecret: "" services: + dns: cluster.local + proxy: port: 10000 replicaCount: 1 @@ -114,28 +116,27 @@ services: couchdb: replicaCount: 3 - host: budibase-prod-svc-couchdb - url: budibase-prod-svc-couchdb # only change if pointing to existing couch server + url: "" # only change if pointing to existing couch server user: "" # only change if pointing to existing couch server password: "" # only change if pointing to existing couch server port: 5678 storage: 100Mi redis: - # disable if using external redis - enabled: true + enabled: true # disable if using external redis port: 6379 replicaCount: 1 + host: "" # only change if pointing to existing redis cluster and enabled: false password: "budibase" # recommended to override if using built-in redis storage: 100Mi - object_store: - minio: false + objectStore: + minio: true browser: true - accessKey: "" # AWS_ACCESS_KEY or existing minio access key - secretKey: "" # AWS_SECRET_ACCESS_KEY or existing minio secret - url: minio-service.budibase.svc.cluster.local:9000 port: 9000 replicaCount: 1 + accessKey: "" # AWS_ACCESS_KEY if using S3 or existing minio access key + secretKey: "" # AWS_SECRET_ACCESS_KEY if using S3 or existing minio secret + url: "" # only change if pointing to existing minio cluster and minio: false storage: 100Mi diff --git a/packages/server/src/db/client.js b/packages/server/src/db/client.js index f79efb3e9e..7523a53c81 100644 --- a/packages/server/src/db/client.js +++ b/packages/server/src/db/client.js @@ -11,7 +11,11 @@ PouchDB.plugin(find) PouchDB.adapter("writableStream", replicationStream.adapters.writableStream) let POUCH_DB_DEFAULTS = { - prefix: COUCH_DB_URL + prefix: COUCH_DB_URL, + auth: { + username: env.COUCH_DB_USER, + password: env.COUCH_DB_PASSWORD, + } } if (env.isTest()) {