-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README.md - postgres install instructions
- Loading branch information
Showing
1 changed file
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] | ||
``` | ||
|
||
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 [email protected] | ||
``` | ||
|
||
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 '<pwd>'; | ||
``` | ||
|
||
Restore tfcweb database from previous backup: | ||
``` | ||
sudo -u postgres psql tfcweb <tfcweb_backup_2023-07-21.sql | ||
``` | ||
|
||
Check tables exist ok: | ||
``` | ||
sudo -u postgres psql | ||
\c tfcweb | ||
\dt | ||
``` | ||
|
||
The Django system is using the `tfcweb` database which can be viewed in `psql` via: | ||
``` | ||
|