Skip to content

Commit

Permalink
restructure init to allow for plugins as mods
Browse files Browse the repository at this point in the history
  • Loading branch information
aptalca committed Aug 27, 2024
1 parent 99c8208 commit d175a8d
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."}
Expand Down
18 changes: 0 additions & 18 deletions root/etc/s6-overlay/s6-rc.d/init-netbox-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,3 @@ fi
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
22 changes: 22 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/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
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-netbox-prepare/run
Empty file.
Empty file.

0 comments on commit d175a8d

Please sign in to comment.