-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added postgis 10.x, importer, pgdumper for geo/nogeo dbs
- Loading branch information
Showing
7 changed files
with
119 additions
and
12 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
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
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 @@ | ||
FROM mdillon/postgis:10 | ||
MAINTAINER GeoNode development team | ||
|
||
COPY ./initdb-geonode.sh /docker-entrypoint-initdb.d/geonode.sh |
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,45 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
function create_geonode_user_and_database() { | ||
local db=$1 | ||
echo " Creating user and database '$db'" | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL | ||
CREATE USER $db; | ||
ALTER USER $db with encrypted password '$GEONODE_DATABASE_PASSWORD'; | ||
CREATE DATABASE $db; | ||
GRANT ALL PRIVILEGES ON DATABASE $db TO $db; | ||
EOSQL | ||
} | ||
|
||
function create_geonode_user_and_geodatabase() { | ||
local geodb=$1 | ||
echo " Creating user and database '$geodb'" | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL | ||
CREATE USER $geodb; | ||
ALTER USER $geodb with encrypted password '$GEONODE_GEODATABASE_PASSWORD'; | ||
CREATE DATABASE $geodb; | ||
GRANT ALL PRIVILEGES ON DATABASE $geodb TO $geodb; | ||
EOSQL | ||
} | ||
|
||
function update_geodatabase_with_postgis() { | ||
local geonode_data=$1 | ||
echo " Updating geodatabase '$geonode_data' with extension" | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$geonode_data" <<-EOSQL | ||
CREATE EXTENSION postgis; | ||
EOSQL | ||
} | ||
|
||
if [ -n "$GEONODE_DATABASE" ]; then | ||
echo "Geonode database creation requested: $GEONODE_DATABASE" | ||
create_geonode_user_and_database $GEONODE_DATABASE | ||
echo "Geonode database created" | ||
fi | ||
|
||
if [ -n "$GEONODE_GEODATABASE" ]; then | ||
echo "Geonode geodatabase creation requested: $GEONODE_GEODATABASE" | ||
create_geonode_user_and_geodatabase $GEONODE_GEODATABASE | ||
update_geodatabase_with_postgis $GEONODE_GEODATABASE | ||
echo "Geonode geodatabase created" | ||
fi |