mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge pull request #2533 from terrywbrady/ds4349m
[DS-4349] 7x: Migrate Postgres Dockerfiles into code base
This commit is contained in:
@@ -4,4 +4,5 @@
|
||||
*/target/
|
||||
dspace/modules/*/target/
|
||||
Dockerfile.*
|
||||
dspace/src/main/docker
|
||||
dspace/modules/src/main/docker-compose
|
||||
|
24
dspace/src/main/docker/README.md
Normal file
24
dspace/src/main/docker/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Docker images supporting DSpace
|
||||
|
||||
## dspace-postgres-pgcrypto/Dockerfile
|
||||
|
||||
_dspace/dspace-postgres-pgcrypto:latest_
|
||||
|
||||
This is a postgres docker image containing the pgcrypto extension used in DSpace 6 and DSpace 7.
|
||||
|
||||
## dspace-postgres-pgcrypto-curl/Dockerfile
|
||||
|
||||
_dspace/dspace-postgres-pgcrypto:loadsql_
|
||||
|
||||
This is a postgres docker image containing the pgcrypto extension used in DSpace 6 and DSpace 7.
|
||||
This image also contains curl. The image is pre-configured to load a postgres database dump on initialization.
|
||||
|
||||
## solr
|
||||
|
||||
_dspace/dspace-solr_
|
||||
|
||||
This is a standalone solr image containing DSpace solr schemas used in DSpace 7.
|
||||
|
||||
## local.cfg and test/ folder
|
||||
|
||||
These resources are bundled into the _dspace/dspace_ image at build time.
|
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# The contents of this file are subject to the license and copyright
|
||||
# detailed in the LICENSE and NOTICE files at the root of the source
|
||||
# tree and available online at
|
||||
#
|
||||
# http://www.dspace.org/license/
|
||||
#
|
||||
|
||||
# This will be deployed as dspace/dspace-postgres-pgcrpyto:loadsql
|
||||
FROM postgres
|
||||
|
||||
ENV POSTGRES_DB dspace
|
||||
ENV POSTGRES_USER dspace
|
||||
ENV POSTGRES_PASSWORD dspace
|
||||
|
||||
# Load a SQL dump. Set LOADSQL to a URL for the sql dump file.
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
|
||||
COPY install-pgcrypto.sh /docker-entrypoint-initdb.d/
|
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# The contents of this file are subject to the license and copyright
|
||||
# detailed in the LICENSE and NOTICE files at the root of the source
|
||||
# tree and available online at
|
||||
#
|
||||
# http://www.dspace.org/license/
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
CHECKFILE=/pgdata/ingest.hasrun.flag
|
||||
|
||||
if [ ! -f $CHECKFILE -a ! -z ${LOADSQL} ]
|
||||
then
|
||||
curl ${LOADSQL} -L -s --output /tmp/dspace.sql
|
||||
psql -U $POSTGRES_USER < /tmp/dspace.sql
|
||||
|
||||
touch $CHECKFILE
|
||||
exit
|
||||
fi
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
||||
-- Create a new schema in this database named "extensions" (or whatever you want to name it)
|
||||
CREATE SCHEMA extensions;
|
||||
-- Enable this extension in this new schema
|
||||
CREATE EXTENSION pgcrypto SCHEMA extensions;
|
||||
-- Update your database's "search_path" to also search the new "extensions" schema.
|
||||
-- You are just appending it on the end of the existing comma-separated list.
|
||||
ALTER DATABASE dspace SET search_path TO "\$user",public,extensions;
|
||||
-- Grant rights to call functions in the extensions schema to your dspace user
|
||||
GRANT USAGE ON SCHEMA extensions TO $POSTGRES_USER;
|
||||
EOSQL
|
18
dspace/src/main/docker/dspace-postgres-pgcrypto/Dockerfile
Normal file
18
dspace/src/main/docker/dspace-postgres-pgcrypto/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# The contents of this file are subject to the license and copyright
|
||||
# detailed in the LICENSE and NOTICE files at the root of the source
|
||||
# tree and available online at
|
||||
#
|
||||
# http://www.dspace.org/license/
|
||||
#
|
||||
|
||||
# This will be deployed as dspace/dspace-postgres-pgcrpyto:latest
|
||||
FROM postgres
|
||||
|
||||
ENV POSTGRES_DB dspace
|
||||
ENV POSTGRES_USER dspace
|
||||
ENV POSTGRES_PASSWORD dspace
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
COPY install-pgcrypto.sh /docker-entrypoint-initdb.d/
|
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# The contents of this file are subject to the license and copyright
|
||||
# detailed in the LICENSE and NOTICE files at the root of the source
|
||||
# tree and available online at
|
||||
#
|
||||
# http://www.dspace.org/license/
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
||||
-- Create a new schema in this database named "extensions" (or whatever you want to name it)
|
||||
CREATE SCHEMA extensions;
|
||||
-- Enable this extension in this new schema
|
||||
CREATE EXTENSION pgcrypto SCHEMA extensions;
|
||||
-- Update your database's "search_path" to also search the new "extensions" schema.
|
||||
-- You are just appending it on the end of the existing comma-separated list.
|
||||
ALTER DATABASE dspace SET search_path TO "\$user",public,extensions;
|
||||
-- Grant rights to call functions in the extensions schema to your dspace user
|
||||
GRANT USAGE ON SCHEMA extensions TO $POSTGRES_USER;
|
||||
EOSQL
|
Reference in New Issue
Block a user