Skip to content

Commit 209bf7e

Browse files
authored
Merge pull request #533 from galaxyproject/fix-upgrades
Fix the upgrade process
2 parents e6acd2d + ca1f516 commit 209bf7e

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

galaxy/templates/deployment-web.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ spec:
4242
- name: {{ .Chart.Name }}-wait-db
4343
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
4444
imagePullPolicy: {{ .Values.image.pullPolicy }}
45-
args: ['sh', '-c', '{{ include "galaxy.init-container-wait-command" . }} sleep {{ .Values.webHandlers.startupDelay }};']
45+
args: ['sh', '-c', '{{ include "galaxy.init-container-wait-command" . }} sleep {{ .Values.webHandlers.startupDelay }}; echo "Cleaning cache..."; rm -rf /galaxy/server/database/cache/*; echo "Cache cleaned.";']
4646
volumeMounts:
47+
- name: galaxy-data
48+
mountPath: {{ .Values.persistence.mountPath }}
4749
- name: galaxy-data
4850
mountPath: /galaxy/server/config/mutable/
4951
subPath: config

galaxy/templates/jobs-init.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,32 @@ spec:
3232
securityContext:
3333
runAsUser: 0
3434
runAsGroup: 0
35-
command: ['sh', '-c', 'echo [`date`][wait-postgres] - wait-postgres init container starting. Running as `id`.; echo [`date`][wait-postgres] - Chown mount path: {{ .Values.securityContext.fsGroup }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}; chown {{ .Values.securityContext.fsGroup }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}; echo [`date`][wait-postgres] - Begin waiting for postgres.; until nc -z -w3 {{ template "galaxy-postgresql.servicename" . }} 5432; do echo [`date`][wait-postgres] - Waiting for galaxy-postgres service...; sleep 2; done; echo [`date`][wait-postgres] - Postgres connection OK.;']
35+
env:
36+
{{ include "galaxy.podEnvVars" . }}
37+
command:
38+
- sh
39+
- -c
40+
- |
41+
set -e
42+
echo "[`date`][wait-postgres] - wait-postgres init container starting. Running as `id`."
43+
echo "[`date`][wait-postgres] - Chown mount path: {{ .Values.securityContext.fsGroup }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}"
44+
chown {{ .Values.securityContext.fsGroup }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
45+
echo "[`date`][wait-postgres] - Waiting for database to accept connections..."
46+
/galaxy/server/.venv/bin/python3 - <<'PYEOF'
47+
import os, sys, time, psycopg2
48+
dsn = os.environ['GALAXY_CONFIG_OVERRIDE_DATABASE_CONNECTION']
49+
for _ in range(60):
50+
try:
51+
with psycopg2.connect(dsn, connect_timeout=2) as c:
52+
c.cursor().execute('SELECT 1')
53+
sys.exit(0)
54+
except Exception as e:
55+
print('[`date`][wait-postgres] Waiting for database...', e)
56+
time.sleep(2)
57+
print('[`date`][wait-postgres] Timed out waiting for database.')
58+
sys.exit(1)
59+
PYEOF
60+
echo "[`date`][wait-postgres] - Database ready."
3661
volumeMounts:
3762
- name: galaxy-data
3863
mountPath: {{ .Values.persistence.mountPath }}

0 commit comments

Comments
 (0)