diff --git a/backend/app.py b/backend/app.py index 129e935366b5440be7f24d2ba3e9c51c2b3e9e14..3115dcbcca51344a0d746201ab5acf6bb8188c29 100644 --- a/backend/app.py +++ b/backend/app.py @@ -110,7 +110,11 @@ else: logging.info("Running initialization code (dev mode).") init_routines() else: - logging.info("Not running initialization code (dev mode).") + logging.info("Not running initialization code (dev or cli mode).") + # This should not perform any actual migration, just load the + # flask_migrate extension so we can use `flask db` commands from the + # cli. + flask_migrate.Migrate(app, db) app.register_blueprint(api_v1) app.register_blueprint(web) diff --git a/deployment/helmchart/templates/job-initialize-user.yaml b/deployment/helmchart/templates/job-initialize-user.yaml index a1d6d1d95edeebb0c1a9762ed94daf6c2cb66b96..90ea48a7e1cbdc8c746f3fd4e58f50dca3ee3c5f 100644 --- a/deployment/helmchart/templates/job-initialize-user.yaml +++ b/deployment/helmchart/templates/job-initialize-user.yaml @@ -8,7 +8,7 @@ metadata: {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} annotations: - "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook": post-install "helm.sh/hook-weight": "-5" "helm.sh/hook-delete-policy": before-hook-creation {{- if .Values.commonAnnotations }} @@ -46,9 +46,7 @@ spec: value: http://kratos-public:80 command: ["/bin/bash", "-c"] args: - - flask db upgrade; - {{- if .Release.IsInstall }} - flask cli user create $SETUP_EMAIL; + - flask cli user create $SETUP_EMAIL; flask cli user setpassword $SETUP_EMAIL $SETUP_PASSWORD; flask cli app create dashboard Dashboard; flask cli user setrole $SETUP_EMAIL dashboard admin; @@ -57,5 +55,3 @@ spec: flask cli user setrole $SETUP_EMAIL wekan admin; flask cli user setrole $SETUP_EMAIL zulip admin; flask cli user setrole $SETUP_EMAIL hedgedoc admin; - {{- end }} -