WSL/SLF GitLab Repository
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
EnviDat
ckan-container
Commits
5e9db930
Commit
5e9db930
authored
Jan 05, 2022
by
Sam
Browse files
update init scripts for db
parent
970c6242
Changes
4
Hide whitespace changes
Inline
Side-by-side
postgresql/docker-entrypoint-initdb.d/00_init_secrets.sh
0 → 100644
View file @
5e9db930
#!/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
postgresql/docker-entrypoint-initdb.d/0
0
_init_db.sh
→
postgresql/docker-entrypoint-initdb.d/0
5
_init_db.sh
View file @
5e9db930
File moved
postgresql/docker-entrypoint-initdb.d/20_restore_db.sh
View file @
5e9db930
#!/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
"
postgresql/docker-entrypoint-initdb.d/30_add_postgis.sh
0 → 100644
View file @
5e9db930
#!/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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment