-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix search wetland sites by site code, fix db restore (#3646)
- Loading branch information
1 parent
2664da1
commit ff02242
Showing
5 changed files
with
57 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
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
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
# Wait for the PostgreSQL server to start | ||
echo "Waiting for PostgreSQL to start..." | ||
while ! pg_isready -h db-restore -p 5432 -U ${POSTGRES_USER}; do | ||
sleep 1 | ||
done | ||
echo "PostgreSQL started." | ||
|
||
# Revoke connections and terminate backends | ||
su - postgres -c "psql gis -f /revoke.sql" | ||
|
||
# Sleep for a short time to ensure that the sessions are terminated | ||
sleep 2 | ||
|
||
# Drop the database | ||
su - postgres -c "psql -c 'DROP DATABASE IF EXISTS gis;'" | ||
|
||
su - postgres -c "createdb -O docker gis" | ||
su - postgres -c 'pg_restore -d gis /backups/latest.dmp' |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
REVOKE CONNECT ON DATABASE gis FROM public; | ||
|
||
SELECT pid, pg_terminate_backend(pid) | ||
FROM pg_stat_activity | ||
WHERE datname = current_database() AND pid <> pg_backend_pid(); |