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
cee2906a
Commit
cee2906a
authored
Feb 23, 2022
by
Sam
Browse files
update init scripts, use postgis image, vars
parent
ab6a713e
Changes
6
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
cee2906a
...
...
@@ -20,11 +20,11 @@ PASSWORDHERE
**.db.secret**
contains the postgres connection credentials for
the remote database (for replication), in format:
```
CKAN_
DB_HOST=xxxxxx.wsl.ch
CKAN_
DB_
NAME=envidat
CKAN_
DB_USER=xxenvidat
CKAN_
DB_PASS=xxxxxx
CKAN
_DOI_
DB_
NAME=envidat_doi
DB_HOST=xxxxxx.wsl.ch
DB_
CKAN_NAME=envidat
DB_USER=xxenvidat
DB_PASS=xxxxxx
DB
_DOI_NAME=envidat_doi
```
**.solr.secret**
contains the credentials for setting and
...
...
docker-compose.yml
View file @
cee2906a
...
...
@@ -61,10 +61,13 @@ services:
-
db_env_secret
volumes
:
-
pg_data:/var/lib/postgresql/data
-
/etc/hosts:/etc/hosts:ro
networks
:
-
ckan-internal
healthcheck
:
test
:
[
"
CMD"
,
"
pg_isready"
,
"
-U"
,
"
dbenvidat"
]
test
:
[
"
CMD"
,
"
pg_isready"
,
"
-U"
,
"
postgres"
]
ports
:
-
9432:5432
solr
:
container_name
:
ckan_solr
...
...
postgresql/Dockerfile
View file @
cee2906a
ARG
EXTERNAL_REG
FROM
${EXTERNAL_REG}/postgis/postgis:1
2
-3.
1
FROM
${EXTERNAL_REG}/postgis/postgis:1
4
-3.
2
ARG
MAINTAINER
LABEL
maintainer="${MAINTAINER}"
...
...
postgresql/docker-entrypoint-initdb.d/05_init_db.sh
View file @
cee2906a
...
...
@@ -2,7 +2,7 @@
set
-e
psql
-v
ON_ERROR_STOP
=
1
--username
postgres
--dbname
postgres
<<-
EOSQL
CREATE ROLE
$
CKAN_
DB_USER
WITH
CREATE ROLE
$DB_USER
WITH
NOSUPERUSER
NOCREATEDB
NOCREATEROLE
...
...
@@ -10,7 +10,7 @@ psql -v ON_ERROR_STOP=1 --username postgres --dbname postgres <<-EOSQL
LOGIN
NOREPLICATION
NOBYPASSRLS
PASSWORD '
$
CKAN_
DB_PASS
';
CREATE DATABASE
$CKAN_
DB_
NAME
WITH OWNER=
$
CKAN_
DB_USER
;
CREATE DATABASE
$
CKAN
_DOI_
DB_
NAME
WITH OWNER=
$
CKAN_
DB_USER
;
PASSWORD '
$DB_PASS
';
CREATE DATABASE
$
DB_
CKAN_NAME
WITH OWNER=
$DB_USER
;
CREATE DATABASE
$
DB
_DOI_NAME
WITH OWNER=
$DB_USER
;
EOSQL
\ No newline at end of file
postgresql/docker-entrypoint-initdb.d/20_restore_db.sh
View file @
cee2906a
#!/bin/bash
set
-e
PGPASSWORD
=
"
$CKAN_DB_PASS
"
pg_dump
-C
--format
c
\
--host
"
$CKAN_DB_HOST
"
--username
"
$CKAN_DB_USER
"
\
"
$
CKAN_
DB_
NAME
"
|
\
pg_restore
--exit-on-error
\
--username
postgres
--dbname
"
$CKAN_DB_NAME
"
echo
"Backup and restoring
$DB_CKAN_NAME
via pipe to new host."
PGPASSWORD
=
"
$DB_PASS
"
pg_dump
--verbose
--format
c
\
--host
"
$DB_HOST
"
--username
"
$DB_USER
"
"
$DB_
CKAN_NAME
"
\
|
pg_restore
--verbose
--exit-on-error
\
--username
postgres
--dbname
postgres
PGPASSWORD
=
"
$CKAN_DB_PASS
"
pg_dump
-C
--format
c
\
--host
"
$CKAN_DB_HOST
"
--username
"
$CKAN_DB_USER
"
\
"
$CKAN_DOI_DB
_NAME
"
|
\
pg_restore
--exit-on-error
\
--username
postgres
--dbname
"
$CKAN_DOI_DB_NAME
"
echo
"Backup and restoring
$DB_DOI_NAME
via pipe to new host."
PGPASSWORD
=
"
$DB_PASS
"
pg_dump
--verbose
--format
c
\
--host
"
$DB_HOST
"
--username
"
$DB_USER
"
"
$DB_DOI
_NAME
"
\
|
pg_restore
--verbose
--exit-on-error
\
--username
postgres
--dbname
postgres
postgresql/docker-entrypoint-initdb.d/30_add_postgis.sh
View file @
cee2906a
#!/bin/bash
set
-e
psql
-v
ON_ERROR_STOP
=
1
--username
postgres
--dbname
"
$CKAN_DB_NAME
"
<<-
EOSQL
psql
-v
ON_ERROR_STOP
=
1
--username
postgres
--dbname
postgres
<<-
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
";
ALTER VIEW geometry_columns OWNER TO "
$DB_USER
";
ALTER TABLE spatial_ref_sys OWNER TO "
$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