Skip to content

Commit

Permalink
Update osmcha deployment to the new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jan 30, 2025
1 parent 22aa86b commit fa6fabc
Showing 1 changed file with 19 additions and 52 deletions.
71 changes: 19 additions & 52 deletions osm-seed/templates/osmcha-app/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,23 @@ spec:
run: {{ .Release.Name }}-osmcha-app
spec:
initContainers:
- name: web-builder
image: "{{ .Values.osmchaWeb.image.name }}:{{ .Values.osmchaWeb.image.tag }}"
envFrom:
- configMapRef:
name: {{ .Release.Name }}-osmcha-common-env
volumeMounts:
- name: nginx-assets
mountPath: /assets
- name: migrations
- name: osmcha-init
image: "{{ .Values.osmchaApi.image.name }}:{{ .Values.osmchaApi.image.tag }}"
command:
- /bin/sh
- -c
- |
set -x
flag=true
while "$flag" = true; do
pg_isready -h $POSTGRES_HOST -p 5432 >/dev/null 2>&2 || continue
flag=false
python manage.py migrate
python manage.py collectstatic --noinput
mkdir -p /staticfiles/static
cp -r /app/staticfiles/* /staticfiles/static/
done
- /bin/sh
- -c
- python manage.py migrate
- python manage.py collectstatic --noinput
envFrom:
- configMapRef:
name: {{ .Release.Name }}-osmcha-common-env
volumeMounts:
- name: staticfiles
mountPath: /staticfiles
# securityContext:
# runAsUser: 0
mountPath: /app/staticfiles
containers:
- name: api
# securityContext:
# runAsUser: 0
- name: osmcha-api
image: "{{ .Values.osmchaApi.image.name }}:{{ .Values.osmchaApi.image.tag }}"
command:
- /bin/sh
- -c
- |
set -x
echo "start app...."
gunicorn --workers 4 --bind 0.0.0.0:5000 --log-file - --access-logfile - config.wsgi
args: ["gunicorn", "config.wsgi", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--timeout", "120", "--workers", "4", "--threads", "16"]
ports:
- containerPort: 5000
livenessProbe:
Expand All @@ -75,12 +48,13 @@ spec:
port: 5000
initialDelaySeconds: 60
timeoutSeconds: 30
envFrom:
- configMapRef:
name: {{ .Release.Name }}-osmcha-common-env

volumeMounts:
- name: staticfiles
mountPath: /staticfiles
envFrom:
- configMapRef:
name: {{ .Release.Name }}-osmcha-common-env
{{- if .Values.osmchaApi.resources.enabled }}
resources:
requests:
Expand All @@ -91,31 +65,24 @@ spec:
cpu: {{ .Values.osmchaApi.resources.limits.cpu }}
{{- end }}

- name: nginx
image: "nginx:latest"
- name: frontend-nginx
image: "{{ .Values.osmchaWeb.image.name }}:{{ .Values.osmchaWeb.image.tag }}"
ports:
- containerPort: 80
env:
- name: BACKEND_URL
value: http://localhost:5000
volumeMounts:
- name: osmcha-frontend-nginx-config
mountPath: /etc/nginx
readOnly: true
- name: staticfiles
mountPath: /staticfiles
- name: nginx-assets
mountPath: /assets
mountPath: /srv/www/static/django
readOnly: true
- name: redis
image: "redis:latest"
ports:
- containerPort: 6379
volumes:
- name: staticfiles
emptyDir: {}
- name: nginx-assets
emptyDir: {}
- name: osmcha-frontend-nginx-config
configMap:
name: {{ .Release.Name }}-osmcha-nginx-config
defaultMode: 0777
{{- if .Values.osmchaApi.nodeSelector.enabled }}
nodeSelector:
{{ .Values.osmchaApi.nodeSelector.label_key }} : {{ .Values.osmchaApi.nodeSelector.label_value }}
Expand Down

0 comments on commit fa6fabc

Please sign in to comment.