Skip to content

Commit

Permalink
Merge pull request #58 from mage-ai/xiaoyou/add-postgres-dep
Browse files Browse the repository at this point in the history
[xy] Add postgres as optional dependency and bump version to 0.2.5
  • Loading branch information
wangxiaoyou1993 authored Jul 10, 2024
2 parents 7b3ff06 + 859b6f3 commit 189d6d9
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 9 deletions.
7 changes: 5 additions & 2 deletions charts/mageai/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 15.5.15
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.1.1
digest: sha256:79d2d6d43f93313876bfd130ef9b5908377fde03b01819759daff0a82c7afdc7
generated: "2023-10-01T14:08:47.871298+05:30"
digest: sha256:2fc0455e060a345ff3dea9d7ab4bc31983d71523a84df20dedb7bacaf5ade8bd
generated: "2024-07-10T11:59:53.185421-07:00"
8 changes: 6 additions & 2 deletions charts/mageai/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ apiVersion: v2
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.9.70"
appVersion: "0.9.72"

description: A Helm chart for Mage AI

Expand All @@ -50,6 +50,10 @@ maintainers:

name: mageai
dependencies:
- name: postgresql
version: 15.5.15
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: redis
version: 18.1.1
repository: https://charts.bitnami.com/bitnami
Expand All @@ -72,4 +76,4 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.4
version: 0.2.5
13 changes: 12 additions & 1 deletion charts/mageai/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ spec:
serviceAccountName: {{ include "mageai.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if or .Values.redis.enabled .Values.redis.customRedisURL }}
{{- if or .Values.redis.enabled .Values.redis.customRedisURL .Values.postgresql.enabled }}
initContainers:
{{- if or .Values.redis.enabled .Values.redis.customRedisURL }}
- name: wait-for-redis
image: alpine
env:
Expand All @@ -39,6 +40,12 @@ spec:
value: {{ .Values.redis.customRedisURL }}
{{- end }}
command: ["sh", "-c", "until nc -z -v $(echo $REDIS_URL | cut -d'/' -f3 | cut -d':' -f1) $(echo $REDIS_URL | cut -d'/' -f3 | cut -d':' -f2); do sleep 1; done"]
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: wait-for-postgres
image: busybox
command: ['sh', '-c', 'until nc -z {{ .Values.postgresql.fullnameOverride }} 5432; do echo waiting for postgres; sleep 2; done;']
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -106,6 +113,10 @@ spec:
- name: REDIS_URL
value: {{ .Values.redis.customRedisURL }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: MAGE_DATABASE_CONNECTION_URL
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Values.postgresql.fullnameOverride }}:5432/{{ .Values.postgresql.auth.database }}
{{- end }}
volumeMounts:
{{- if .Values.volumes }}
- name: mage-fs
Expand Down
15 changes: 13 additions & 2 deletions charts/mageai/templates/scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@ spec:
serviceAccountName: {{ include "mageai.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if or .Values.redis.enabled .Values.redis.customRedisURL }}
{{- if or .Values.redis.enabled .Values.redis.customRedisURL .Values.postgresql.enabled }}
initContainers:
{{- if or .Values.redis.enabled .Values.redis.customRedisURL }}
- name: wait-for-redis
image: alpine
env:
{{- if .Values.redis.enabled }}
- name: REDIS_URL
value: redis://{{ .Release.Name }}-redis-headless:6379/0
value: redis://{{.Release.Name}}-redis-headless:6379/0
{{- else if .Values.redis.customRedisURL }}
- name: REDIS_URL
value: {{ .Values.redis.customRedisURL }}
{{- end }}
command: ["sh", "-c", "until nc -z -v $(echo $REDIS_URL | cut -d'/' -f3 | cut -d':' -f1) $(echo $REDIS_URL | cut -d'/' -f3 | cut -d':' -f2); do sleep 1; done"]
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: wait-for-postgres
image: busybox
command: ['sh', '-c', 'until nc -z {{ .Values.postgresql.fullnameOverride }} 5432; do echo waiting for postgres; sleep 2; done;']
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -77,6 +84,10 @@ spec:
{{- else if .Values.redis.customRedisURL }}
- name: REDIS_URL
value: {{ .Values.redis.customRedisURL }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: MAGE_DATABASE_CONNECTION_URL
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Values.postgresql.fullnameOverride }}:5432/{{ .Values.postgresql.auth.database }}
{{- end }}
- name: INSTANCE_TYPE
value: scheduler
Expand Down
15 changes: 13 additions & 2 deletions charts/mageai/templates/webservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@ spec:
serviceAccountName: {{ include "mageai.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if or .Values.redis.enabled .Values.redis.customRedisURL }}
{{- if or .Values.redis.enabled .Values.redis.customRedisURL .Values.postgresql.enabled }}
initContainers:
{{- if or .Values.redis.enabled .Values.redis.customRedisURL }}
- name: wait-for-redis
image: alpine
env:
{{- if .Values.redis.enabled }}
- name: REDIS_URL
value: redis://{{ .Release.Name }}-redis-headless:6379/0
value: redis://{{.Release.Name}}-redis-headless:6379/0
{{- else if .Values.redis.customRedisURL }}
- name: REDIS_URL
value: {{ .Values.redis.customRedisURL }}
{{- end }}
command: ["sh", "-c", "until nc -z -v $(echo $REDIS_URL | cut -d'/' -f3 | cut -d':' -f1) $(echo $REDIS_URL | cut -d'/' -f3 | cut -d':' -f2); do sleep 1; done"]
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: wait-for-postgres
image: busybox
command: ['sh', '-c', 'until nc -z {{ .Values.postgresql.fullnameOverride }} 5432; do echo waiting for postgres; sleep 2; done;']
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -105,6 +112,10 @@ spec:
{{- else if .Values.redis.customRedisURL }}
- name: REDIS_URL
value: {{ .Values.redis.customRedisURL }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: MAGE_DATABASE_CONNECTION_URL
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Values.postgresql.fullnameOverride }}:5432/{{ .Values.postgresql.auth.database }}
{{- end }}
- name: INSTANCE_TYPE
value: web_server
Expand Down
9 changes: 9 additions & 0 deletions charts/mageai/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ webServer:
# maxReplicas: 10
# targetCPUUtilizationPercentage: 50

# Enable Postgres as the DB
postgresql:
enabled: false
fullnameOverride: "postgresql-service"
auth:
username: your_username
password: your_password
database: your_database

# Enable redis if you want more replica
redis:
enabled: false
Expand Down

0 comments on commit 189d6d9

Please sign in to comment.