-
-
Notifications
You must be signed in to change notification settings - Fork 137
Description
Issue Summary
Alerta container fails to start (when restarted/redeployed) due to error:
# Create user-defined admin API key.
ERROR: duplicate key value violates unique constraint "keys_key_key"
DETAIL: Key (key)=(*********secret*********) already exists.
Environment
-
OS: container image alerta/alerta-web:8.7.0
-
Deployment: Helm Chart deployment to Kubernetes
-
For self-hosted, WSGI environment: nginx/uwsgi
-
Database: Postgres, separate data persistent instance, outside of Alerta POD
-
Server config:
Auth enabled? Yes
Auth provider? Basic
Customer views? Yes -
web UI version: 8.7.0
-
CLI version: 8.7.0
To Reproduce
Steps to reproduce the behavior:
- Set values or statically defined matching ENV vars (lookup deployment.yaml)
- .Values.alertaAdminUsers
- .Values.alertaAdminKey
-
Deploy helm chart
-
restart Alerta POD/Container only. Do not restart Postgres.
Expected behavior
Code should accept the desired idempotent result whereby same admin user is being assigned same key.
Container should be able to recover on restart.
Additional context
Issue is at the
https://github.com/alerta/docker-alerta/blob/master/docker-entrypoint.sh
# Create user-defined API key, if required
if [ -n "${ADMIN_KEY}" ]; then
echo "# Create user-defined admin API key."
alertad key --username "${ADMIN_USER}" --key "${ADMIN_KEY}" --duration "${MAXAGE}"
fi
the exact syntax of the error seems to originate from psql when trying to insert a record manually
ERROR: duplicate key value violates unique constraint "keys_key_key"