Upgrade DB after API has been stopped.

This commit is contained in:
Roland 2022-01-25 16:24:26 -07:00
parent 93204a0b2a
commit 9116d62e17
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

View file

@ -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