-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f17f0b8
Showing
6 changed files
with
86 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- mode: gitignore; -*- | ||
*~ | ||
\#*\# | ||
.\#* |
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,2 @@ | ||
Copyright © 2022, Consortium of Universities for the Advancement of Hydrologic Science, Inc. (CUAHSI) | ||
All Rights Reserved |
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,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2022, Critical Zone Collaborative Network Hub (CZNet Hub) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,10 @@ | ||
# hs_postgis | ||
A datbase for Hydroshare based on official images. | ||
|
||
1. Open port 5432 on the host's firewall to the subnets making connections. | ||
1. `docker-compose up -d` | ||
1. Place a SQL dump to load into the database in /var/scratch/pg.deploy.sql on the host. | ||
1. `./loaddb.sh` | ||
1. The default postgres user password is configured in two places in the Hydroshare codebase: | ||
1. hydroshare/hydroshare/local_settings.py | ||
1. hydroshare/config/hydroshare-config.yaml |
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,17 @@ | ||
version: "3" | ||
|
||
services: | ||
postgis: | ||
image: postgis/postgis:15-3.3 | ||
environment: | ||
POSTGRES_PASSWORD: 'postgres' | ||
container_name: postgis | ||
restart: unless-stopped | ||
volumes: | ||
- "postgis_data_vol:/var/lib/postgresql/data" | ||
- "/var/scratch:/var/scratch" | ||
ports: | ||
- "5432:5432" | ||
|
||
volumes: | ||
postgis_data_vol: |
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,24 @@ | ||
#!/bin/bash | ||
|
||
echo "Start: $(date)" | ||
echo "Revoking connections..." | ||
docker exec postgis psql -U postgres -d template1 -w -c 'REVOKE CONNECT ON DATABASE postgres FROM public;' | ||
echo "Terminating backends..." | ||
docker exec postgis psql -U postgres -d template1 -w -c "SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'postgres' AND pid <> pg_backend_pid();" | ||
echo "Dropping postgis extension..." | ||
docker exec postgis psql -U postgres -d template1 -w -c 'DROP EXTENSION postgis;' | ||
echo "Dropping hstore extension..." | ||
docker exec postgis psql -U postgres -d template1 -w -c 'DROP EXTENSION hstore;' | ||
echo "Dropping postgres database..." | ||
docker exec postgis dropdb -U postgres postgres | ||
echo "Creating postgis extension..." | ||
docker exec postgis psql -U postgres -d template1 -w -c 'CREATE EXTENSION postgis;' | ||
echo "Creating hstore extennsion..." | ||
docker exec postgis psql -U postgres -d template1 -w -c 'CREATE EXTENSION hstore;' | ||
echo "Creating postgres database..." | ||
docker exec postgis createdb -U postgres postgres --encoding UNICODE --template=template1 | ||
echo "Setting message level..." | ||
docker exec postgis psql -U postgres -d postgres -w -c 'SET client_min_messages TO WARNING;' | ||
echo "Loading database. It is normal to see an error that the postgres role already exists..." | ||
docker exec postgis psql -U postgres -d postgres -q -f /var/scratch/pg.deploy.sql | ||
echo "End: $(date)" |