diff --git a/README.md b/README.md index c30c4da6..03f2beb2 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,57 @@ python3 -m pip install -r requirements.txt ``` ### Configure the database: -Install and configure postgreSQL database. +Install and configure postgreSQL database: + +Check running postgresql with: +``` +sudo systemctl status postgresql@14-main.service +``` + +Backup an existing database with: +``` +sudo -u postgres pg_dump -c tfcweb >tfcweb_backup_2023-07-21.sql +``` + +Check if installed postgresql packages with: +``` +dpkg -l | grep postgres +``` + +If necessary remove existing postgresql packages with: +``` +sudo apt --purge remove postgresql-* +sudo rm -r /var/lib/postgresql +``` + +Install postgresql packages: +``` +sudo apt install postgresql-14 postgresql-common postgresql-client-14 postgresql-client-common postgresql-14-postgis-3 postgresql-14-postgis-3-scripts +``` + +Check with +``` +sudo systemctl status postgresql@14-main.service +``` + +Create tfcweb database, tfc_prod user, collect password from tfc_web secrets.py: +``` +sudo -u postgres psql +create database tfcweb; +create role tfc_prod LOGIN PASSWORD ''; +``` + +Restore tfcweb database from previous backup: +``` +sudo -u postgres psql tfcweb