Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
if docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \
-f docker/docker-compose.yml -f docker/docker-compose-rest.yml \
-f "$CONFIG_PATH/docker-compose-rest.yml" -f "$CONFIG_PATH/docker-compose.yml" \
config 2>/dev/null | grep -qE 'published: "(5432|8080|8983|4000|9876)"'; then
config 2>/dev/null | grep -qE 'published: "(5432|8080|8983|4000|9876|2641|8010)"'; then
echo " WARNING: overlay still inherits vanilla fixed ports."
echo " Add 'ports: !override' to $CONFIG_PATH/docker-compose.yml and docker-compose-rest.yml,"
echo " otherwise the deploy will fail with 'port is already allocated'."
Expand Down Expand Up @@ -194,6 +194,15 @@ jobs:
./start.sh dspace-$INSTANCE
cd ../..
docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f $CONFIG_PATH/docker-compose-rest.yml -f $CONFIG_PATH/docker-compose.yml up -d --no-build --remove-orphans
# Volumes made by the older root image hold root-owned files, and DSpace now runs as `dspace`.
# Restart, because the webapp has already started without write access to its logs.
# Empty on an image without the dspace user. A failed `docker exec` fails the step, so it never reads as clean.
DIRS="/dspace/assetstore /dspace/sitemaps /dspace/log /dspace/handle-server"
NOT_OWNED=$(docker exec -u root dspace$INSTANCE sh -c "id dspace >/dev/null 2>&1 || exit 0; find $DIRS ! -user dspace -print -quit")
if [ -n "$NOT_OWNED" ]; then
docker exec -u root dspace$INSTANCE chown -R dspace:dspace $DIRS
docker restart dspace$INSTANCE
fi

import-8603:
runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1
Expand Down Expand Up @@ -286,13 +295,16 @@ jobs:
run: |
export DNAME=dspace${INSTANCE}

# No `chown -R dspace:dspace` (unlike v7): the v9 runtime image has no `dspace`
# user, the webapp runs as root, and that chown fails with "invalid user".
# `docker cp` writes the files as root, but DSpace runs as `dspace`.
echo "Preparing assetstore"
if [ -z "$ASSETSTORE_PATH" ]; then
echo "Assetstore path is empty. Not copying assetstore."
else
docker cp "$ASSETSTORE_PATH" $DNAME:/dspace/
# An image without the dspace user runs as root and needs no chown.
if docker exec $DNAME id dspace >/dev/null 2>&1; then
docker exec -u root $DNAME chown -R dspace:dspace /dspace/assetstore
fi
fi

- name: create administrator
Expand Down
13 changes: 13 additions & 0 deletions docker/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,24 @@ services:
db__P__url: ${db__P__url:-jdbc:postgresql://dspacedb:5432/dspace}
# solr.server: Ensure we are using the 'dspacesolr' image for Solr
solr__P__server: ${solr__P__server:-http://dspacesolr:8983/solr}
# S3 assetstore, same variables as the 'dspace' service in docker-compose-rest.yml
assetstore__P__index__P__primary: ${S3_STORAGE:-0}
assetstore__P__s3__P__enabled: ${S3_ENABLED:-false}
assetstore__P__s3__P__useRelativePath: ${S3_RELATIVE_PATH:-false}
assetstore__P__s3__P__bucketName: ${S3_BUCKET:-bucket-for-dspace}
assetstore__P__s3__P__subfolder: ${S3_SUBFOLDER:-}
assetstore__P__s3__P__awsAccessKey: ${S3_ACCESS:-}
assetstore__P__s3__P__awsSecretKey: ${S3_SECRET:-}
assetstore__P__s3__P__awsRegionName: ${S3_REGION_NAME:-}
assetstore__P__s3__P__endpoint: ${S3_ENDPOINT:-}
networks:
- dspacenet
volumes:
# Keep DSpace assetstore directory between reboots
- assetstore:/dspace/assetstore
# Keep the logs of CLI commands
- dspace_cli_logs:/dspace/log

volumes:
assetstore:
dspace_cli_logs:
31 changes: 30 additions & 1 deletion docker/docker-compose-rest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ services:
# from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above.
proxies__P__trusted__P__ipranges: ${proxies__P__trusted__P__ipranges:-172.23.0}
LOGGING_CONFIG: ${LOGGING_CONFIG:-/dspace/config/log4j2-container.xml}
# S3 assetstore, off by default. Same variables as in the 7.x compose file.
# NOTE: these environment variables override the same settings in local.cfg.
assetstore__P__index__P__primary: ${S3_STORAGE:-0}
assetstore__P__s3__P__enabled: ${S3_ENABLED:-false}
assetstore__P__s3__P__useRelativePath: ${S3_RELATIVE_PATH:-false}
assetstore__P__s3__P__bucketName: ${S3_BUCKET:-bucket-for-dspace}
assetstore__P__s3__P__subfolder: ${S3_SUBFOLDER:-}
assetstore__P__s3__P__awsAccessKey: ${S3_ACCESS:-}
assetstore__P__s3__P__awsSecretKey: ${S3_SECRET:-}
assetstore__P__s3__P__awsRegionName: ${S3_REGION_NAME:-}
assetstore__P__s3__P__endpoint: ${S3_ENDPOINT:-}
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-dspace-9_x-test}"
depends_on:
- dspacedb
Expand All @@ -60,19 +71,33 @@ services:
ports:
- published: 8080
target: 8080
# Handle server: TCP and UDP port 2641, HTTP port 8010
- published: 2641
target: 2641
protocol: tcp
- published: 2641
target: 2641
protocol: udp
- published: 8010
target: 8010
volumes:
# Keep DSpace logs and the Handle server config between reboots
- dspace_logs:/dspace/log
- handle_server:/dspace/handle-server
# Keep DSpace assetstore directory between reboots
- assetstore:/dspace/assetstore
# Ensure that the database is ready BEFORE starting tomcat
# 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep
# 2. Then, run database migration to init database tables
# 3. Finally, start DSpace
# 3. Start the Handle server, but only after `make-handle-config` has created its config
# 4. Finally, start DSpace
entrypoint:
- /bin/bash
- '-c'
- |
while (!</dev/tcp/dspacedb/5432) > /dev/null 2>&1; do sleep 1; done;
/dspace/bin/dspace database migrate
if [ -f /dspace/handle-server/config.dct ]; then /dspace/bin/start-handle-server; fi
java -jar /dspace/webapps/server-boot.jar
# DSpace database container
dspacedb:
Expand Down Expand Up @@ -109,6 +134,7 @@ services:
volumes:
# Keep Solr data directory between reboots
- solr_data:/var/solr/data
- solr_logs:/var/solr/logs
# NOTE: We are not running Solr as "root", but we need root permissions to copy our cores to the mounted
# /var/solr/data directory. Then we start Solr as the "solr" user.
user: root
Expand Down Expand Up @@ -142,3 +168,6 @@ volumes:
assetstore:
pgdata:
solr_data:
solr_logs:
dspace_logs:
handle_server:
Loading