WSL/SLF GitLab Repository

Commit 5e9db930 authored by Sam's avatar Sam
Browse files

update init scripts for db

parent 970c6242
#!/bin/bash
set -eo pipefail
if [[ -f "/run/secrets/db_env_secret" ]]; then
echo "db_env_secret secret found, sourcing..."
source /run/secrets/db_env_secret
else
echo "db_env_secret secret not found."
fi
\ No newline at end of file
#!/bin/bash
set -e
file1="/docker-entrypoint-initdb.d/ckan.dump"
file2="/docker-entrypoint-initdb.d/doi.dump"
echo "Restoring CKAN DB using $file1"
pg_restore -U postgres --dbname="$CKAN_DB_NAME" --verbose --single-transaction < "$file1" || exit 1
echo "Restoring DOI DB using $file2"
pg_restore -U postgres --dbname="$CKAN_DOI_DB_NAME" --verbose --single-transaction < "$file2" || exit 1
PGPASSWORD="$CKAN_DB_PASS" pg_dump -C -h "$CKAN_DB_HOST" -U "$CKAN_DB_USER" "$CKAN_DB_NAME" | psql -U "$CKAN_DB_USER" "$CKAN_DB_NAME"
PGPASSWORD="$CKAN_DB_PASS" pg_dump -C -h "$CKAN_DB_HOST" -U "$CKAN_DB_USER" "$CKAN_DOI_DB_NAME" | psql -U "$CKAN_DB_USER" "$CKAN_DOI_DB_NAME"
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username postgres --dbname "$CKAN_DB_NAME" <<-EOSQL
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
ALTER VIEW geometry_columns OWNER TO "$CKAN_DB_USER";
ALTER TABLE spatial_ref_sys OWNER TO "$CKAN_DB_USER";
EOSQL
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment