mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Special case for creating a super user to make it a little cleaner
This commit is contained in:
parent
b0723c13a3
commit
c0d81430d9
@ -26,7 +26,7 @@
|
||||
# - Run 'docker compose pull'.
|
||||
# - Run 'docker compose up -d'.
|
||||
# - Wait until the webserver has completed startup
|
||||
# - Run 'docker compose exec webserver ./manage.py createsuperuser' to create a user.
|
||||
# - Run 'docker compose exec webserver createsuperuser' to create a user.
|
||||
|
||||
#
|
||||
# For more extensive installation and update instructions, refer to the
|
||||
|
@ -22,7 +22,7 @@
|
||||
# - Run 'docker compose pull'.
|
||||
# - Run 'docker compose up -d'.
|
||||
# - Wait until the webserver has completed startup
|
||||
# - Run 'docker compose exec webserver ./manage.py createsuperuser' to create a user.
|
||||
# - Run 'docker compose exec webserver createsuperuser' to create a user.
|
||||
#
|
||||
# For more extensive installation and update instructions, refer to the
|
||||
# documentation.
|
||||
|
@ -26,7 +26,7 @@
|
||||
# - Run 'docker compose pull'.
|
||||
# - Run 'docker compose up -d'.
|
||||
# - Wait until the webserver has completed startup
|
||||
# - Run 'docker compose exec webserver ./manage.py createsuperuser' to create a user.
|
||||
# - Run 'docker compose exec webserver createsuperuser' to create a user.
|
||||
#
|
||||
# For more extensive installation and update instructions, refer to the
|
||||
# documentation.
|
||||
|
@ -22,7 +22,7 @@
|
||||
# - Run 'docker compose pull'.
|
||||
# - Run 'docker compose up -d'.
|
||||
# - Wait until the webserver has completed startup
|
||||
# - Run 'docker compose exec webserver ./manage.py createsuperuser' to create a user.
|
||||
# - Run 'docker compose exec webserver createsuperuser' to create a user.
|
||||
#
|
||||
# For more extensive installation and update instructions, refer to the
|
||||
# documentation.
|
||||
|
@ -26,7 +26,7 @@
|
||||
# - Run 'docker compose pull'.
|
||||
# - Run 'docker compose up -d'.
|
||||
# - Wait until the webserver has completed startup
|
||||
# - Run 'docker compose exec webserver ./manage.py createsuperuser' to create a user.
|
||||
# - Run 'docker compose exec webserver createsuperuser' to create a user.
|
||||
#
|
||||
# For more extensive installation and update instructions, refer to the
|
||||
# documentation.
|
||||
|
@ -19,7 +19,7 @@
|
||||
# - Run 'docker compose pull'.
|
||||
# - Run 'docker compose up -d'.
|
||||
# - Wait until the webserver has completed startup
|
||||
# - Run 'docker compose exec webserver ./manage.py createsuperuser' to create a user.
|
||||
# - Run 'docker compose exec webserver createsuperuser' to create a user.
|
||||
#
|
||||
# For more extensive installation and update instructions, refer to the
|
||||
# documentation.
|
||||
|
@ -18,9 +18,10 @@ for command in decrypt_documents \
|
||||
document_fuzzy_match \
|
||||
manage_superuser \
|
||||
convert_mariadb_uuid \
|
||||
prune_audit_logs;
|
||||
prune_audit_logs \
|
||||
createsuperuser;
|
||||
do
|
||||
echo "installing $command..."
|
||||
sed "s/management_command/$command/g" management_script.sh >"$PWD/rootfs/usr/local/bin/$command"
|
||||
chmod +x "$PWD/rootfs/usr/local/bin/$command"
|
||||
chmod u=rwx,g=rwx,o=rx "$PWD/rootfs/usr/local/bin/$command"
|
||||
done
|
||||
|
14
docker/rootfs/usr/local/bin/createsuperuser
Executable file
14
docker/rootfs/usr/local/bin/createsuperuser
Executable file
@ -0,0 +1,14 @@
|
||||
#!/command/with-contenv /usr/bin/bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "${PAPERLESS_SRC_DIR}"
|
||||
|
||||
if [[ $(id -u) == 0 ]]; then
|
||||
s6-setuidgid paperless python3 manage.py createsuperuser "$@"
|
||||
elif [[ $(id -un) == "paperless" ]]; then
|
||||
python3 manage.py createsuperuser "$@"
|
||||
else
|
||||
echo "Unknown user."
|
||||
fi
|
@ -143,13 +143,13 @@ account. The script essentially automatically performs the steps described in [D
|
||||
execute the following command:
|
||||
|
||||
```shell-session
|
||||
docker compose exec webserver ./manage.py createsuperuser
|
||||
docker compose exec webserver createsuperuser
|
||||
```
|
||||
|
||||
or using docker exec from within the container:
|
||||
|
||||
```shell-session
|
||||
./manage.py createsuperuser
|
||||
createsuperuser
|
||||
```
|
||||
|
||||
This will guide you through the superuser setup.
|
||||
|
@ -402,6 +402,6 @@ if [ "$DATABASE_BACKEND" == "postgres" ] || [ "$DATABASE_BACKEND" == "mariadb" ]
|
||||
docker compose stop
|
||||
fi
|
||||
|
||||
docker compose run --rm -e DJANGO_SUPERUSER_PASSWORD="$PASSWORD" webserver ./manage.py createsuperuser --noinput --username "$USERNAME" --email "$EMAIL"
|
||||
docker compose run --rm -e DJANGO_SUPERUSER_PASSWORD="$PASSWORD" webserver createsuperuser --noinput --username "$USERNAME" --email "$EMAIL"
|
||||
|
||||
docker compose up --detach
|
||||
|
Loading…
x
Reference in New Issue
Block a user