mirror of
https://github.com/linuxserver/docker-netbox.git
synced 2026-02-20 08:40:10 +08:00
Merge pull request #61 from linuxserver/init-restructure
restructure init to allow for plugins as mods
This commit is contained in:
commit
3f0a28386c
@ -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.
|
||||
|
||||
@ -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."}
|
||||
|
||||
@ -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
|
||||
|
||||
34
root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/run
Executable file
34
root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/run
Executable 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
|
||||
1
root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/type
Normal file
@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/up
Normal file
@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/run
|
||||
Loading…
x
Reference in New Issue
Block a user