fix(linkding): create initial user (#2417)

* fix(linkding): create initial user

* try again

* 1 init

* again

* try with lifecycly

* better logic

* move xwiki to stable
This commit is contained in:
Stavros Kois
2022-04-03 21:23:55 +03:00
committed by GitHub
parent 2b42ecba6d
commit 5bd7aeac83
11 changed files with 54 additions and 1 deletions
+26
View File
@@ -82,6 +82,32 @@ questions:
- value: "OnDelete"
description: "(Legacy) OnDelete: ignore .spec.template changes"
# Include{controllerExpert}
- variable: secret
group: "Container Configuration"
label: "Image Secrets"
schema:
additional_attrs: true
type: dict
attrs:
- variable: DJANGO_SUPERUSER_USERNAME
label: "Superuser Username (Initial install only)"
schema:
type: string
default: ""
required: true
- variable: DJANGO_SUPERUSER_EMAIL
label: "Superuser Email (Initial install only)"
schema:
type: string
default: ""
required: true
- variable: DJANGO_SUPERUSER_PASSWORD
label: "Superuser Password (Initial install only)"
schema:
type: string
default: ""
private: true
required: true
- variable: env
group: "Container Configuration"
label: "Image Environment"
+27
View File
@@ -11,6 +11,11 @@ podSecurityContext:
runAsUser: 0
runAsGroup: 0
secret:
DJANGO_SUPERUSER_USERNAME: "superuser"
DJANGO_SUPERUSER_EMAIL: "super@example.com"
DJANGO_SUPERUSER_PASSWORD: "somesecret"
env:
LD_SERVER_PORT: "{{ .Values.service.main.ports.main.port }}"
# User Defined
@@ -28,3 +33,25 @@ persistence:
data:
enabled: true
mountPath: "/etc/linkding/data"
lifecycle:
postStart:
exec:
command:
- "/bin/bash"
- "-c"
- |
if [ -f /etc/linkding/data/.superuser_exists ]; then
echo "Superuser has been created before. Skipping...";
else
echo "Creating superuser...";
export status=99;
until [ $status -eq 0 ];
do
python manage.py createsuperuser --username=${DJANGO_SUPERUSER_USERNAME} --email=${DJANGO_SUPERUSER_EMAIL} --noinput;
status=$?;
sleep 3;
done;
echo "This file is to ensure that init script won't try to create a superuser again and fail because it already exsits" > /etc/linkding/data/.superuser_exists;
echo "Superuser Created!";
fi;
@@ -23,7 +23,7 @@ name: xwiki
sources:
- https://hub.docker.com/_/xwiki
- https://github.com/xwiki/xwiki-docker
version: 0.0.6
version: 1.0.0
annotations:
truecharts.org/catagories: |
- productivity