mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 20:59:56 -05:00
Combining install scripts into a new repair script. Removing create_db script in favor of repair script.
This commit is contained in:
parent
b817534c37
commit
6e0f9a999c
57 changed files with 785 additions and 724 deletions
29
scripts/initialize_map_db.sh
Executable file
29
scripts/initialize_map_db.sh
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
# Creates the gis (map) database and _renderd database user if they don't exist.
|
||||
# WARNING: This will overwrite the map database data.
|
||||
|
||||
source /opt/wrolpi/wrolpi/scripts/lib.sh
|
||||
|
||||
yes_or_no "Are you sure you want to initialize the map database? Data from imported maps will be lost." || exit 0
|
||||
|
||||
set -x
|
||||
|
||||
systemctl stop renderd
|
||||
|
||||
# Create gis (map) database.
|
||||
sudo -u postgres psql -c '\l' | grep gis || (
|
||||
sudo -u postgres createuser _renderd
|
||||
sudo -u postgres psql -c "alter user _renderd password 'wrolpi'"
|
||||
sudo -u postgres createdb -E UTF8 -O _renderd gis
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION postgis"
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION hstore"
|
||||
echo "Created gis database"
|
||||
)
|
||||
# Restore initial dump.
|
||||
zcat /opt/wrolpi-blobs/gis-map.dump.gz | sudo -u postgres pg_restore --no-owner --role=_renderd -d gis
|
||||
sudo -u postgres psql -d gis -c 'ALTER TABLE geography_columns OWNER TO _renderd'
|
||||
sudo -u postgres psql -d gis -c 'ALTER TABLE geometry_columns OWNER TO _renderd'
|
||||
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO _renderd"
|
||||
|
||||
# Clear map tile cache files.
|
||||
yes | /bin/bash /opt/wrolpi/scripts/clear_map_cache.sh
|
||||
Loading…
Add table
Add a link
Reference in a new issue