From 80d05add03ae39bc7416bcaf8e70dec7d69525ed Mon Sep 17 00:00:00 2001 From: Quinn Casey Date: Mon, 28 Feb 2022 08:07:57 -0800 Subject: [PATCH] Ask for database folder is using postgres --- install-paperless-ngx.sh | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/install-paperless-ngx.sh b/install-paperless-ngx.sh index 70027db31..c9de960fe 100755 --- a/install-paperless-ngx.sh +++ b/install-paperless-ngx.sh @@ -189,7 +189,7 @@ MEDIA_FOLDER=$ask_result echo "" echo "The data folder is where paperless stores other data, such as your" -if [[ "$DATABASE_BACKEND" == "sqlite" ]] +if [[ "$DATABASE_BACKEND" == "sqlite" ]] ; then echo -n "SQLite database, the " fi echo "search index and other data." @@ -202,6 +202,19 @@ echo "" ask_docker_folder "Data folder" "" DATA_FOLDER=$ask_result +if [[ "$DATABASE_BACKEND" == "postgres" ]] ; then + echo "" + echo "The database folder, where postgres stores its data." + echo "Leave empty to have this managed by docker." + echo "" + echo "CAUTION: If specified, you must specify an absolute path starting with /" + echo "or a relative path starting with ./ here." + echo "" + + ask_docker_folder "Database folder" "" + POSTGRES_FOLDER=$ask_result +fi + echo "" echo "3. Login credentials" echo "====================" @@ -253,6 +266,13 @@ if [[ -z $DATA_FOLDER ]] ; then else echo "Data folder: $DATA_FOLDER" fi +if [[ "$DATABASE_BACKEND" == "postgres" ]] ; then + if [[ -z $POSTGRES_FOLDER ]] ; then + echo "Database (postgres) folder: Managed by docker" + else + echo "Database (postgres) folder: $POSTGRES_FOLDER" + fi +fi echo "" echo "Port: $PORT" echo "Database: $DATABASE_BACKEND" @@ -315,8 +335,12 @@ if [[ -n $DATA_FOLDER ]] ; then sed -i "s#- data:/usr/src/paperless/data#- $DATA_FOLDER:/usr/src/paperless/data#g" docker-compose.yml fi -docker-compose pull +if [[ -n $POSTGRES_FOLDER ]] ; then + sed -i "s#- pgdata:/var/lib/postgresql/data#- $POSTGRES_FOLDER:/var/lib/postgresql/data#g" docker-compose.yml +fi -docker-compose run --rm -e DJANGO_SUPERUSER_PASSWORD="$PASSWORD" webserver createsuperuser --noinput --username "$USERNAME" --email "$EMAIL" +# docker-compose pull -docker-compose up -d +# docker-compose run --rm -e DJANGO_SUPERUSER_PASSWORD="$PASSWORD" webserver createsuperuser --noinput --username "$USERNAME" --email "$EMAIL" + +# docker-compose up -d