From 9116d62e178434a71cd020996432590a998c427b Mon Sep 17 00:00:00 2001 From: Roland Date: Tue, 25 Jan 2022 16:24:26 -0700 Subject: [PATCH] Upgrade DB after API has been stopped. --- install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index c057c7bb..17d15b3a 100755 --- a/install.sh +++ b/install.sh @@ -75,16 +75,6 @@ yarn --network-timeout 10000 yarn run build yarn global add serve -# Configure PostgreSQL -sudo -u postgres psql -c '\l' | grep wrolpi || ( - sudo -u postgres createuser wrolpi && - sudo -u postgres psql -c "alter user postgres password 'wrolpi'" && - sudo -u postgres psql -c "alter user wrolpi password 'wrolpi'" && - sudo -u postgres createdb -O wrolpi wrolpi -) -# Initialize the WROLPi database. -(cd /opt/wrolpi && /usr/bin/python3 /opt/wrolpi/main.py db upgrade) - # Install the WROLPi nginx config over the default nginx config. cp /opt/wrolpi/nginx.conf /etc/nginx/nginx.conf cp /opt/wrolpi/50x.html /var/www/50x.html @@ -109,6 +99,16 @@ systemctl enable wrolpi-app.service systemctl stop wrolpi-api.service systemctl stop wrolpi-app.service +# Configure Postgresql. Do this after the API is stopped. +sudo -u postgres psql -c '\l' | grep wrolpi || ( + sudo -u postgres createuser wrolpi && + sudo -u postgres psql -c "alter user postgres password 'wrolpi'" && + sudo -u postgres psql -c "alter user wrolpi password 'wrolpi'" && + sudo -u postgres createdb -O wrolpi wrolpi +) +# Init/upgrade the WROLPi database. +(cd /opt/wrolpi && /usr/bin/python3 /opt/wrolpi/main.py db upgrade) + # Configure the hotspot. bash /opt/wrolpi/scripts/hotspot.sh