Merge pull request #61 from linuxserver/init-restructure

restructure init to allow for plugins as mods
This commit is contained in:
aptalca 2024-08-27 11:16:08 -04:00 committed by GitHub
commit 3f0a28386c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 38 additions and 27 deletions

View File

@ -333,6 +333,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **26.08.24:** - Restructure init to allow for plugins as mods.
* **16.07.24:** - Add required packages for LDAP support.
* **01.06.24:** - Rebase to Alpine 3.20.
* **23.12.23:** - Rebase to Alpine 3.19.

View File

@ -57,6 +57,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "26.08.24:", desc: "Restructure init to allow for plugins as mods."}
- { date: "16.07.24:", desc: "Add required packages for LDAP support."}
- { date: "01.06.24:", desc: "Rebase to Alpine 3.20."}
- { date: "23.12.23:", desc: "Rebase to Alpine 3.19."}

View File

@ -52,33 +52,6 @@ ln -sf /config/ldap_config.py /app/netbox/netbox/netbox/ldap_config.py
mv /defaults/uwsgi.ini /app/netbox/netbox/uwsgi.ini > /dev/null 2>&1
# build docs
if [[ ! -e "/app/netbox/netbox/project-static/docs/index.html" ]]; then
cd /app/netbox || exit 1
echo "Building local documentation"
mkdocs build -q
cd /app/netbox/netbox || exit 1
fi
# permissions
lsiown -R abc:abc \
/app/netbox/netbox/static \
/config
s6-setuidgid abc python3 ./manage.py migrate
if [[ -n "$SUPERUSER_EMAIL" ]] && [[ -n "$SUPERUSER_PASSWORD" ]]; then
cat << EOF | s6-setuidgid abc python3 /app/netbox/netbox/manage.py shell
from users.models import Token, User;
username = 'admin';
password = '$SUPERUSER_PASSWORD';
email = '$SUPERUSER_EMAIL';
if not User.objects.filter(username='admin'):
User.objects.create_superuser(username, email, password);
print('Superuser created.');
else:
print('Superuser creation skipped. Already exists.');
EOF
fi

View File

@ -0,0 +1,34 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
cd /app/netbox/netbox || exit 1
s6-setuidgid abc python3 ./manage.py migrate
if [[ -n "$SUPERUSER_EMAIL" ]] && [[ -n "$SUPERUSER_PASSWORD" ]]; then
cat << EOF | s6-setuidgid abc python3 /app/netbox/netbox/manage.py shell
from users.models import Token, User;
username = 'admin';
password = '$SUPERUSER_PASSWORD';
email = '$SUPERUSER_EMAIL';
if not User.objects.filter(username='admin'):
User.objects.create_superuser(username, email, password);
print('Superuser created.');
else:
print('Superuser creation skipped. Already exists.');
EOF
fi
# build docs
if [[ ! -e "/app/netbox/netbox/project-static/docs/index.html" ]]; then
cd /app/netbox || exit 1
echo "Building local documentation"
mkdocs build -q
cd /app/netbox/netbox || exit 1
fi
# permissions
lsiown -R abc:abc \
/app/netbox/netbox/static

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/run