From 995f155527e4284b36ef5961d03b9bd4f793e6c5 Mon Sep 17 00:00:00 2001 From: Juraj Roka <95219754+jr-rk@users.noreply.github.com> Date: Mon, 9 Nov 2026 15:24:25 +0100 Subject: [PATCH 1/6] ci(deploy): deploy dtq-dev-767-base to instance 8633 on dev-6 Port the instance deploy setup from dtq-dev-9-base (#1383 and follow-ups) to dtq-dev-767-base, retargeted from 8603 to 8633. - deploy.yml: replace the stale dev-5 jobs (instances 5/8) with probe, deploy-8633 and import-8633 on dspace-${DEV_MACHINE}-dep-1. Adds DEV_MACHINE, DUMP_PATH, ASSETSTORE_PATH and PROBE_ONLY inputs. - start.sh: honour INSTANCE_OVERLAY so the per-instance overlay's `ports: !override` replaces the fixed host ports; set COMPOSE_PROJECT_NAME for the CLI container. - docker.yml: deploy after a push via this branch's deploy.yml to 8633 instead of dtq-dev's deploy.yml to instance 5. - Replace import-weekly.yml (erase + import of instance 8) with the non-destructive redeploy-weekly.yml. - playwright-tests.yml: point HOME_URL at dev-6.pc:8633. Differences from 9-base: IMPORT defaults to false on manual runs and DUMP_PATH has no default, since 8633 should start empty. The v7-specific `chown dspace:dspace` on the assetstore and `-o dataquest` on create-administrator are kept. --- .github/workflows/deploy.yml | 378 ++++++++++++++++--------- .github/workflows/docker.yml | 6 +- .github/workflows/import-weekly.yml | 15 - .github/workflows/playwright-tests.yml | 2 +- .github/workflows/redeploy-weekly.yml | 23 ++ build-scripts/run/start.sh | 18 +- 6 files changed, 294 insertions(+), 148 deletions(-) delete mode 100644 .github/workflows/import-weekly.yml create mode 100644 .github/workflows/redeploy-weekly.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c6a83067feb..3d0a31e557b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,81 +4,171 @@ name: Deploy DSpace on: workflow_call: inputs: + DEV_MACHINE: + required: false + type: string + default: 'dev-6' INSTANCE: required: false type: string - default: '5' + default: '8633' IMPORT: required: false - default: true + default: false type: boolean ERASE_DB: required: false default: false type: boolean + DUMP_PATH: + required: false + type: string + default: '' + ASSETSTORE_PATH: + required: false + type: string + default: '/opt/dspace-envs/8633/assetstore' workflow_dispatch: inputs: INSTANCE: required: true - default: '5' + default: '8633' type: choice options: - - '*' - - '5' - - '8' + - '8633' + # Unlike dtq-dev-9-base this defaults to false: a plain "Run workflow" must not + # load a dump into 8633, which is meant to start empty. IMPORT: required: true - default: true + default: false type: boolean ERASE_DB: required: false default: false type: boolean + DEV_MACHINE: + required: false + type: string + default: 'dev-6' + DUMP_PATH: + description: 'Absolute path of the SQL dump ON THE DEV MACHINE (used only when IMPORT is checked)' + required: false + type: string + default: '' + ASSETSTORE_PATH: + description: 'Absolute path of the assetstore directory ON THE DEV MACHINE' + required: false + type: string + default: '/opt/dspace-envs/8633/assetstore' + PROBE_ONLY: + description: 'Only report the state of the target machine; deploy and import nothing' + required: false + default: false + type: boolean jobs: - deploy-5: - if: inputs.INSTANCE == '*' || inputs.INSTANCE == '5' - runs-on: dspace-dep-1 + # Read-only report of the machine we are about to touch. Runs first so that a + # misconfigured target is visible in the log even when the deploy then fails. + probe: + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 timeout-minutes: 10 env: - INSTANCE: '5' - ENVFILE: /opt/dspace-envs/.env.dspace.dev-5 - ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} - USER_PASSWORD: ${{ secrets.DSPACE_USER_PASSWORD }} + INSTANCE: ${{inputs.INSTANCE}} + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} + ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - uses: ./.github/actions/erase-db - if: inputs.ERASE_DB - with: - INSTANCE: ${{ env.INSTANCE }} - NAME: dspace-${{ env.INSTANCE }} - - - name: deploy to dev-5 - working-directory: build-scripts/run/ + - name: config dir + dump run: | - ./start.sh dspace-$INSTANCE - cd ../.. - # use customized docker-compose file for the `85` port because the server is exposed with the namespace `repository` - # `/repository/server` - docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/5/docker-compose-rest.yml -f /opt/dspace-envs/5/docker-compose.yml -f /opt/dspace-envs/5/extra.yml up -d --no-build + echo "===== $CONFIG_PATH" + ls -la "$CONFIG_PATH/" || echo "MISSING: $CONFIG_PATH" + echo "===== $CONFIG_PATH/dump" + ls -la "$CONFIG_PATH/dump/" || echo "MISSING: $CONFIG_PATH/dump" + echo "===== dump referenced by DUMP_PATH input" + ls -la "${{ inputs.DUMP_PATH }}" || echo "MISSING dump: ${{ inputs.DUMP_PATH }}" + echo "===== port-ish keys from .env (values shown; these are ports, not secrets)" + grep -E '^(PG_PORT|SOLR_PORT|DSPACE_PORT|DSPACE_FE_PORT|DSPACE_REST_PORT|DSPACE_DOCKER_REST_PORT|DSPACE_VER|DSPACE_HOST)=' "$ENVFILE" || echo "no port keys found" + + - name: who owns the host ports + run: | + echo "===== all dspace-ish containers and their published ports" + docker ps -a --format '{{.Names}}\t{{.Status}}\t{{.Ports}}' | grep -Ei 'dspace|postgres|solr' || echo "none" + echo "===== anything publishing host port 5432" + docker ps --format '{{.Names}}\t{{.Ports}}' | grep -E '(^|[^0-9])5432->' || echo "nothing publishes 5432" + echo "===== host listeners on 5432" + (ss -lntp 2>/dev/null || netstat -lntp 2>/dev/null) | grep -E ':5432' || echo "no listener on 5432 (or no permission to see it)" + + - name: resolved compose ports for this instance + run: | + echo "===== resolved ports for this instance (this is what deploy uses)" + 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>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -40 \ + || echo "compose config failed" + # The overlay must REPLACE the fixed ports the base compose files publish, not add to + # them: compose merges `ports` lists across -f files. If a fixed port survives the + # merge above, the overlay is missing `ports: !override` and this instance will + # fight whichever one already owns it on the host. + echo "===== base compose files alone, for comparison (the fixed ports the overlay must replace)" + docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -30 \ + || echo "compose config failed" + echo "===== verdict" + 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 + echo " WARNING: overlay still inherits the base 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'." + else + echo " OK: only instance-scoped ports are published" + fi + + - name: postgres inside the instance db container + run: | + docker exec dspacedb$INSTANCE sh -c 'echo "PGPORT=$PGPORT"; pg_isready -U dspace; psql -U dspace -d postgres -tAc "SHOW port;" 2>/dev/null' || echo "could not probe dspacedb$INSTANCE" - deploy-8: - if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8' - runs-on: dspace-dep-1 - timeout-minutes: 120 + # Does the instance actually hold the expected data and serve it? A green import + # job only proves the commands exited 0. + - name: data + service health + run: | + # DSpace keeps Flyway's history in "schema_version", not Flyway's default + # "flyway_schema_history" -- see DatabaseUtils.FLYWAY_TABLE. + echo "===== last applied migrations (schema_version)" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select version, script, success from schema_version order by installed_rank desc limit 5;" \ + 2>&1 || echo "could not read schema_version" + echo "===== anything database repair marked deleted" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select installed_rank||' | '||version||' | type='||type||' | success='||success||' | '||script from schema_version where type='DELETE' order by installed_rank desc limit 12;" \ + 2>&1 || echo "could not read schema_version" + echo "===== row counts" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select 'item='||(select count(*) from item) || ' bitstream='||(select count(*) from bitstream) || ' collection='||(select count(*) from collection) || ' community='||(select count(*) from community) || ' eperson='||(select count(*) from eperson);" \ + 2>&1 || echo "could not count rows" + echo "===== dspace version" + docker exec dspace$INSTANCE /bin/bash -c "cd /dspace/bin && ./dspace version" 2>&1 | head -5 || echo "dspace version failed" + echo "===== REST API on the instance" + curl -s -o /dev/null -w " repository/server/api -> HTTP %{http_code}\n" "http://localhost:${DSPACE_DOCKER_REST_PORT:-6633}/repository/server/api" || true + curl -s "http://localhost:${DSPACE_DOCKER_REST_PORT:-6633}/repository/server/api/core/items?size=1" 2>/dev/null | head -c 300 || true + echo "" + + deploy-8633: + if: (inputs.INSTANCE == '*' || inputs.INSTANCE == '8633') && !inputs.PROBE_ONLY + needs: probe + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 + timeout-minutes: 60 env: - INSTANCE: '8' - # 2024/02: this .env replaces ENTRYPOINT to angular - # !!!!WARNING!!!! - # disable TSL checks = allowing to cooperate with https backend with invalid - # certificate - ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5 - ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} - USER_PASSWORD: ${{ secrets.DSPACE_USER_PASSWORD }} + INSTANCE: '8633' + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} + ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ./.github/actions/erase-db if: inputs.ERASE_DB @@ -86,110 +176,142 @@ jobs: INSTANCE: ${{ env.INSTANCE }} NAME: dspace-${{ env.INSTANCE }} - - name: deploy dspace-import on dev-5 + - name: Set start.sh as executable + run: chmod +x build-scripts/run/start.sh + + - name: deploy to ${{inputs.DEV_MACHINE}} working-directory: build-scripts/run/ + env: + ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + USER_PASSWORD: ${{ secrets.DSPACE_USER_PASSWORD }} + INSTANCE_OVERLAY: ${{ env.CONFIG_PATH }} run: | ./start.sh dspace-$INSTANCE cd ../.. - # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above - # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull - docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build + 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 - # this must be here and not in the start.sh, because extra.yml replaces dspace container - ## !!!!! please remove this section if you do not want handle server !!!!!!! - echo "=====" - echo "installing handle server" - docker exec dspace${INSTANCE} /dspace/bin/make-handle-config - echo "made handle config:" - docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct - docker exec dspace${INSTANCE} /dspace/bin/start-handle-server - echo "started handle server" - # this seems to be the easiest solution for now - docker restart dockerized-nginx-with-shibboleth-nginx-1 - /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' - - - import-5: - runs-on: dspace-dep-1 + import-8633: + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 if: inputs.IMPORT - needs: deploy-5 + timeout-minutes: 900 + needs: deploy-8633 env: - INSTANCE: '5' - ENVFILE: /opt/dspace-envs/.env.dspace.dev-5 + INSTANCE: ${{inputs.INSTANCE}} + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} + DUMP_PATH: ${{inputs.DUMP_PATH}} + ASSETSTORE_PATH: ${{inputs.ASSETSTORE_PATH}} + ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} steps: - - uses: ./.github/actions/import-db - with: - INSTANCE: ${{ env.INSTANCE }} - DATADIR: /opt/dspace-data/clarin-dspace-oxford/ - ASSETSTORE: /opt/dspace-data/clarin-dspace-oxford/assetstore/ - LOGDIR: /log/ - ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + - uses: actions/checkout@v6 - - name: dspace basic command + - name: import dump run: | - export DNAME=dspace$INSTANCE - docker logs -n 50 $DNAME - - echo "dspace version:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace version" - - echo "dspace cleanup:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace cleanup -v" + export DNAME=dspace${INSTANCE} + export DDBNAME=dspacedb${INSTANCE} - echo "dspace reindex solr:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b" + if [ ! -f "$DUMP_PATH" ]; then + echo "::error::Dump not found on ${{inputs.DEV_MACHINE}}: '$DUMP_PATH' (set the DUMP_PATH input)" + exit 1 + fi + echo "Importing dump: $DUMP_PATH ($(du -h "$DUMP_PATH" | cut -f1))" - echo "dspace reindex OAI-PMH:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace oai import -c" + # Stop the app so it cannot hold connections to the database we are about to drop. + docker stop $DNAME || true - echo "dspace checker:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l" - - import-8: - runs-on: dspace-dep-1 - if: inputs.IMPORT - needs: deploy-8 - env: - INSTANCE: '8' - ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5 - steps: - - uses: ./.github/actions/import-db - with: - INSTANCE: ${{ env.INSTANCE }} - DATADIR: /opt/dspace-data/clarin-dspace/ - ASSETSTORE: /opt/dspace-data/clarin-dspace/assetstore/ - LOGDIR: /log/ - ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + echo "=====" + docker cp "$DUMP_PATH" $DDBNAME:/tmp/dump.sql + + # Recreate the database from scratch and load the dump. + docker exec $DDBNAME /bin/bash -c " + dropdb -U dspace dspace || true && + createdb -U dspace --owner=dspace --encoding=UNICODE dspace && + psql -U dspace -d dspace -f /tmp/dump.sql + " + echo "=====" + docker exec $DDBNAME /bin/bash -c "rm -f /tmp/dump.sql" || true - - name: dspace basic command + - name: run database migration run: | - export DNAME=dspace$INSTANCE - docker logs -n 50 $DNAME - - echo "dspace version:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace version" - - echo "dspace cleanup:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace cleanup -v" + export DNAME=dspace${INSTANCE} + export ENVFILE=$CONFIG_PATH/.env + export OVERLAY=$CONFIG_PATH + + # --------------------------------------------------------------- + # Why a one-off `docker compose run` instead of `docker exec $DNAME migrate`: + # The dspace entrypoint auto-runs `dspace database migrate` (WITHOUT `ignored`) + # and then starts the REST webapp. On a freshly imported dump the + # "Ignored" XMLWorkflow migrations are NOT applied, so the webapp boots against + # an un-migrated DB, crashes, and (with the restart policy) the container + # restarts. That restart SIGKILLs any `docker exec` running inside it -> the + # migration dies with exit 137. So we stop the app and run the migration as a + # one-off compose container (overridden entrypoint = migrate only, no webapp, + # no restart policy), using the same compose files/env as the deploy step. + # --------------------------------------------------------------- + + echo "Stopping app container so its restart loop can't kill the migration..." + docker stop $DNAME || true + + # `database repair` before `migrate`: if the dump's schema_version lists migrations + # that this tree does not carry, Flyway validation refuses to migrate at all + # ("Detected applied migration not resolved locally"). repair marks those entries + # as deleted; it only rewrites the bookkeeping table, never user tables. + echo "Running one-off DB repair + migration via docker compose..." + docker compose --env-file $ENVFILE -p dspace-${INSTANCE} \ + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + -f $OVERLAY/docker-compose-rest.yml -f $OVERLAY/docker-compose.yml \ + run --rm --no-deps --entrypoint /bin/bash dspace \ + -c "while (!/dev/null 2>&1; do sleep 1; done; cd /dspace/bin && ./dspace database repair && ./dspace database migrate ignored" + + echo "Migration done. Starting app container (entrypoint migrate is now a no-op)..." + docker start $DNAME + + echo "Waiting for DSpace to be ready..." + sleep 10 + + - name: restart dspace container + run: | + export DNAME=dspace${INSTANCE} + echo "Restarting DSpace container..." + docker restart $DNAME + sleep 60 - echo "dspace reindex solr:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b" + - name: copy assetstore + run: | + export DNAME=dspace${INSTANCE} + + echo "Preparing assetstore" + if [ -z "$ASSETSTORE_PATH" ]; then + echo "Assetstore path is empty. Not copying assetstore." + else + docker cp "$ASSETSTORE_PATH" $DNAME:/dspace/ + # The v7 image runs the webapp as the `dspace` user (see start.sh); v9 dropped this. + docker exec -u root $DNAME chown -R dspace:dspace /dspace/assetstore + fi + + - name: create administrator + run: | + export DNAME=dspace${INSTANCE} + echo "Creating DSpace administrator..." + docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace create-administrator -e dspace.admin.dev@dataquest.sk -f admin -l user -p \"${ADMIN_PASSWORD}\" -c en -o dataquest" - echo "dspace reindex OAI-PMH:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace oai import -c" + - name: rebuild discovery index and run oai import + run: | + export DNAME=dspace${INSTANCE} + echo "Rebuilding discovery index..." + docker exec $DNAME /bin/bash -c "/dspace/bin/dspace index-discovery -b" - echo "dspace checker:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l" + echo "Running OAI import..." + docker exec $DNAME /bin/bash -c "/dspace/bin/dspace oai import -c" - playwright-after-deploy8: - needs: deploy-8 + playwright-after-deploy8633: + needs: deploy-8633 if: '!inputs.IMPORT' uses: ./.github/workflows/playwright-tests.yml secrets: inherit - rest-tests-after-deploy8: + rest-tests-after-deploy8633: runs-on: ubuntu-latest - needs: playwright-after-deploy8 + needs: playwright-after-deploy8633 if: '!inputs.IMPORT' timeout-minutes: 120 env: @@ -203,23 +325,23 @@ jobs: --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ - -f URL="http://dev-5.pc:88/repository/server/api" 2>&1) + -f URL="http://dev-6.pc:8633/repository/server/api" 2>&1) RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status - - playwright-after-import8: - needs: import-8 + playwright-after-import8633: + needs: import-8633 if: inputs.IMPORT uses: ./.github/workflows/playwright-tests.yml secrets: inherit - rest-tests-after-import8: + rest-tests-after-import8633: runs-on: ubuntu-latest - needs: playwright-after-import8 + needs: playwright-after-import8633 + if: inputs.IMPORT timeout-minutes: 120 env: GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} @@ -232,7 +354,7 @@ jobs: --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ - -f URL="http://dev-5.pc:88/repository/server/api" 2>&1) + -f URL="http://dev-6.pc:8633/repository/server/api" 2>&1) RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fceb3297045..bce949e9494 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -65,9 +65,11 @@ jobs: deploy: needs: dspace-angular - uses: dataquest-dev/dspace-angular/.github/workflows/deploy.yml@dtq-dev if: ${{ github.event_name != 'pull_request' }} + uses: ./.github/workflows/deploy.yml with: - INSTANCE: '5' + INSTANCE: '8633' IMPORT: false + ERASE_DB: false + DEV_MACHINE: 'dev-6' secrets: inherit diff --git a/.github/workflows/import-weekly.yml b/.github/workflows/import-weekly.yml deleted file mode 100644 index 53e32a9f46e..00000000000 --- a/.github/workflows/import-weekly.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Import Weekly - -on: - schedule: - - cron: '0 0 * * 0' # every Sunday at midnight UTC - workflow_dispatch: - -jobs: - deploy: - uses: ./.github/workflows/deploy.yml - with: - INSTANCE: '8' - IMPORT: true - ERASE_DB: true - secrets: inherit diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index c65a48b4d2d..f9efbefea2e 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -19,7 +19,7 @@ jobs: - name: test working-directory: dspace-ui-tests/scripts env: - HOME_URL: https://dev-5.pc:8443/repository/ + HOME_URL: http://dev-6.pc:8633/repository/ NAME: DEFAULT PASSWORD_ADMIN: ${{ secrets.DSPACE_ADMIN_PASSWORD }} run: | diff --git a/.github/workflows/redeploy-weekly.yml b/.github/workflows/redeploy-weekly.yml new file mode 100644 index 00000000000..042eb76dc49 --- /dev/null +++ b/.github/workflows/redeploy-weekly.yml @@ -0,0 +1,23 @@ +name: Redeploy Weekly + +# Replaces the old "Import Weekly": instance 8633 is not re-imported on a schedule. +# This only redeploys, which is non-destructive -- start.sh pulls the images first, so the +# instance picks up the latest dtq-dev-767-base build. The database and assetstore are left +# alone (IMPORT and ERASE_DB both false). +# +# To load a dump, run "Deploy DSpace" manually with IMPORT checked. +on: + schedule: + - cron: '0 0 * * 0' # every Sunday at midnight UTC + workflow_dispatch: + +jobs: + redeploy: + uses: ./.github/workflows/deploy.yml + with: + # Must match a job in deploy.yml, otherwise every job is skipped and this run + # still reports success. + INSTANCE: '8633' + IMPORT: false + ERASE_DB: false + secrets: inherit diff --git a/build-scripts/run/start.sh b/build-scripts/run/start.sh index 07a57418779..67b066f4557 100755 --- a/build-scripts/run/start.sh +++ b/build-scripts/run/start.sh @@ -10,14 +10,25 @@ echo "Using envfile: [$ENVFILE] for project: [$PROJECT]" source $ENVFILE +# The base compose files publish fixed host ports (5432/8080/8983/4000), which are global to +# the machine, so this `up` would fight whichever instance already owns them. When +# INSTANCE_OVERLAY points at /opt/dspace-envs/, bring the containers up through that +# overlay too: its `ports: !override` replaces the fixed ports with instance-scoped ones. +COMPOSE_FILES="-f docker/docker-compose.yml -f docker/docker-compose-rest.yml" +if [[ -n "$INSTANCE_OVERLAY" ]]; then + COMPOSE_FILES="$COMPOSE_FILES -f $INSTANCE_OVERLAY/docker-compose-rest.yml -f $INSTANCE_OVERLAY/docker-compose.yml" + echo "Using instance overlay: [$INSTANCE_OVERLAY]" +fi +echo "Compose files: [$COMPOSE_FILES]" + # docker-compose does not pull those that have `build` section?! echo "=====" docker pull $DSPACE_UI_IMAGE pushd ../.. echo "=====" -docker compose --env-file $ENVFILE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml pull -docker compose --env-file $ENVFILE -p $PROJECT -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d --no-build +docker compose --env-file $ENVFILE $COMPOSE_FILES pull +docker compose --env-file $ENVFILE -p $PROJECT $COMPOSE_FILES up -d --no-build --remove-orphans popd # Create admin user @@ -27,6 +38,9 @@ echo "=====" #docker compose --env-file $ENVFILE -p $PROJECT -f docker/matomo-w-db.yml pull #docker compose --env-file $ENVFILE -p $PROJECT -f docker/matomo-w-db.yml up -d --no-build +# Ensure CLI container uses the same project network +export COMPOSE_PROJECT_NAME=$PROJECT + # docker-compose-rest.yml must be last, since it specifies network in more detail. If it is not last, there is "root must be a mapping" error. if [[ -z "$ADMIN_PASSWORD" ]]; then echo "ERROR: ADMIN_PASSWORD is required but not set." >&2 From 2d0848c3280452ba3b4e3f94aac027959c665e30 Mon Sep 17 00:00:00 2001 From: Juraj Roka <95219754+jr-rk@users.noreply.github.com> Date: Mon, 9 Nov 2026 15:25:24 +0100 Subject: [PATCH 2/6] ci(deploy): target dev-20 instead of dev-6 for instance 8633 --- .github/workflows/deploy.yml | 8 ++++---- .github/workflows/docker.yml | 2 +- .github/workflows/playwright-tests.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3d0a31e557b..9149dbf6bca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,7 +7,7 @@ on: DEV_MACHINE: required: false type: string - default: 'dev-6' + default: 'dev-20' INSTANCE: required: false type: string @@ -50,7 +50,7 @@ on: DEV_MACHINE: required: false type: string - default: 'dev-6' + default: 'dev-20' DUMP_PATH: description: 'Absolute path of the SQL dump ON THE DEV MACHINE (used only when IMPORT is checked)' required: false @@ -325,7 +325,7 @@ jobs: --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ - -f URL="http://dev-6.pc:8633/repository/server/api" 2>&1) + -f URL="http://dev-20.pc:8633/repository/server/api" 2>&1) RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') @@ -354,7 +354,7 @@ jobs: --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ - -f URL="http://dev-6.pc:8633/repository/server/api" 2>&1) + -f URL="http://dev-20.pc:8633/repository/server/api" 2>&1) RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bce949e9494..b74d10c5b4c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -71,5 +71,5 @@ jobs: INSTANCE: '8633' IMPORT: false ERASE_DB: false - DEV_MACHINE: 'dev-6' + DEV_MACHINE: 'dev-20' secrets: inherit diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index f9efbefea2e..06e40ab812f 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -19,7 +19,7 @@ jobs: - name: test working-directory: dspace-ui-tests/scripts env: - HOME_URL: http://dev-6.pc:8633/repository/ + HOME_URL: http://dev-20.pc:8633/repository/ NAME: DEFAULT PASSWORD_ADMIN: ${{ secrets.DSPACE_ADMIN_PASSWORD }} run: | From b631394fdc918ff8831808f2b141f6a76849c112 Mon Sep 17 00:00:00 2001 From: Juraj Roka <95219754+jr-rk@users.noreply.github.com> Date: Mon, 9 Nov 2026 17:29:21 +0100 Subject: [PATCH 3/6] ci(deploy): align deploy.yml with dtq-dev-9-base template Restore deploy.yml verbatim from dtq-dev-9-base (f6cf600b81) with only 8603->8633, 6603->6633, dev-6->dev-20 substituted, plus the two v7 specifics: chown of the assetstore and `-o dataquest` on create-administrator. Restore template wording in start.sh comment. --- .github/workflows/deploy.yml | 46 +++++++++++++++++++++--------------- build-scripts/run/start.sh | 2 +- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9149dbf6bca..b84dc7e851c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,7 @@ on: DUMP_PATH: required: false type: string - default: '' + default: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16.sql' ASSETSTORE_PATH: required: false type: string @@ -37,11 +37,9 @@ on: type: choice options: - '8633' - # Unlike dtq-dev-9-base this defaults to false: a plain "Run workflow" must not - # load a dump into 8633, which is meant to start empty. IMPORT: required: true - default: false + default: true type: boolean ERASE_DB: required: false @@ -55,7 +53,7 @@ on: description: 'Absolute path of the SQL dump ON THE DEV MACHINE (used only when IMPORT is checked)' required: false type: string - default: '' + default: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16.sql' ASSETSTORE_PATH: description: 'Absolute path of the assetstore directory ON THE DEV MACHINE' required: false @@ -108,11 +106,11 @@ jobs: -f "$CONFIG_PATH/docker-compose-rest.yml" -f "$CONFIG_PATH/docker-compose.yml" \ config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -40 \ || echo "compose config failed" - # The overlay must REPLACE the fixed ports the base compose files publish, not add to + # The overlay must REPLACE the fixed ports the vanilla files publish, not add to # them: compose merges `ports` lists across -f files. If a fixed port survives the # merge above, the overlay is missing `ports: !override` and this instance will # fight whichever one already owns it on the host. - echo "===== base compose files alone, for comparison (the fixed ports the overlay must replace)" + echo "===== vanilla files alone, for comparison (the fixed ports the overlay must replace)" docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -30 \ @@ -122,7 +120,7 @@ jobs: -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 - echo " WARNING: overlay still inherits the base fixed ports." + 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'." else @@ -133,7 +131,7 @@ jobs: run: | docker exec dspacedb$INSTANCE sh -c 'echo "PGPORT=$PGPORT"; pg_isready -U dspace; psql -U dspace -d postgres -tAc "SHOW port;" 2>/dev/null' || echo "could not probe dspacedb$INSTANCE" - # Does the instance actually hold the expected data and serve it? A green import + # Does the instance actually hold the imported data and serve it? A green import # job only proves the commands exited 0. - name: data + service health run: | @@ -143,10 +141,17 @@ jobs: docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ "select version, script, success from schema_version order by installed_rank desc limit 5;" \ 2>&1 || echo "could not read schema_version" - echo "===== anything database repair marked deleted" + # What `database repair` did to the imported CLARIN history. repair only rewrites + # this bookkeeping table -- it never touches user tables or their rows. + echo "===== CLARIN 7.6 entries / anything repair marked deleted" docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ - "select installed_rank||' | '||version||' | type='||type||' | success='||success||' | '||script from schema_version where type='DELETE' order by installed_rank desc limit 12;" \ + "select installed_rank||' | '||version||' | type='||type||' | success='||success||' | '||script from schema_version where version like '7.6%' or type='DELETE' order by installed_rank desc limit 12;" \ 2>&1 || echo "could not read schema_version" + echo "===== CLARIN-specific tables still present after repair" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select 'public tables total='||count(*) from information_schema.tables where table_schema='public';" 2>&1 || true + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select string_agg(table_name, ', ') from information_schema.tables where table_schema='public' and (table_name like '%clarin%' or table_name like '%license%');" 2>&1 || true echo "===== row counts" docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ "select 'item='||(select count(*) from item) || ' bitstream='||(select count(*) from bitstream) || ' collection='||(select count(*) from collection) || ' community='||(select count(*) from community) || ' eperson='||(select count(*) from eperson);" \ @@ -204,13 +209,13 @@ jobs: steps: - uses: actions/checkout@v6 - - name: import dump + - name: vanilla import run: | export DNAME=dspace${INSTANCE} export DDBNAME=dspacedb${INSTANCE} if [ ! -f "$DUMP_PATH" ]; then - echo "::error::Dump not found on ${{inputs.DEV_MACHINE}}: '$DUMP_PATH' (set the DUMP_PATH input)" + echo "::error::Dump not found on ${{inputs.DEV_MACHINE}}: $DUMP_PATH" exit 1 fi echo "Importing dump: $DUMP_PATH ($(du -h "$DUMP_PATH" | cut -f1))" @@ -221,7 +226,7 @@ jobs: echo "=====" docker cp "$DUMP_PATH" $DDBNAME:/tmp/dump.sql - # Recreate the database from scratch and load the dump. + # Recreate the database from scratch and load the vanilla dump. docker exec $DDBNAME /bin/bash -c " dropdb -U dspace dspace || true && createdb -U dspace --owner=dspace --encoding=UNICODE dspace && @@ -251,13 +256,17 @@ jobs: echo "Stopping app container so its restart loop can't kill the migration..." docker stop $DNAME || true - # `database repair` before `migrate`: if the dump's schema_version lists migrations - # that this tree does not carry, Flyway validation refuses to migrate at all - # ("Detected applied migration not resolved locally"). repair marks those entries - # as deleted; it only rewrites the bookkeeping table, never user tables. + # `database repair` before `migrate`: the dump comes from a CLARIN 7.6 instance, + # so its flyway_schema_history lists CLARIN-specific migrations that do not exist + # in this vanilla v9 tree. Flyway validation then refuses to migrate at all: + # "Detected applied migration not resolved locally: 7.6.2026.06.01." + # repair marks those unresolvable entries as deleted, which is exactly what we want + # when migrating an old CLARIN dump onto vanilla v9 -- their DDL is already in the + # dump, we just do not carry the migration scripts any more. echo "Running one-off DB repair + migration via docker compose..." docker compose --env-file $ENVFILE -p dspace-${INSTANCE} \ -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + \ -f $OVERLAY/docker-compose-rest.yml -f $OVERLAY/docker-compose.yml \ run --rm --no-deps --entrypoint /bin/bash dspace \ -c "while (!/dev/null 2>&1; do sleep 1; done; cd /dspace/bin && ./dspace database repair && ./dspace database migrate ignored" @@ -284,7 +293,6 @@ jobs: echo "Assetstore path is empty. Not copying assetstore." else docker cp "$ASSETSTORE_PATH" $DNAME:/dspace/ - # The v7 image runs the webapp as the `dspace` user (see start.sh); v9 dropped this. docker exec -u root $DNAME chown -R dspace:dspace /dspace/assetstore fi diff --git a/build-scripts/run/start.sh b/build-scripts/run/start.sh index 67b066f4557..8c0c129aece 100755 --- a/build-scripts/run/start.sh +++ b/build-scripts/run/start.sh @@ -10,7 +10,7 @@ echo "Using envfile: [$ENVFILE] for project: [$PROJECT]" source $ENVFILE -# The base compose files publish fixed host ports (5432/8080/8983/4000), which are global to +# The vanilla compose files publish fixed host ports (5432/8080/8983/4000), which are global to # the machine, so this `up` would fight whichever instance already owns them. When # INSTANCE_OVERLAY points at /opt/dspace-envs/, bring the containers up through that # overlay too: its `ports: !override` replaces the fixed ports with instance-scoped ones. From 0c936f7708ac4db778b043a339b5eaeb93681608 Mon Sep 17 00:00:00 2001 From: Juraj Roka <95219754+jr-rk@users.noreply.github.com> Date: Tue, 10 Nov 2026 07:28:22 +0100 Subject: [PATCH 4/6] ci(deploy): pass workflow inputs to shell via env DUMP_PATH and DEV_MACHINE were interpolated straight into `run:` scripts, so a crafted workflow_dispatch value could inject shell commands on the self-hosted runner. Expose them as env vars and reference those instead. --- .github/workflows/deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b84dc7e851c..0bf0c97004f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -75,6 +75,7 @@ jobs: INSTANCE: ${{inputs.INSTANCE}} CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env + DUMP_PATH: ${{inputs.DUMP_PATH}} steps: - uses: actions/checkout@v6 @@ -85,7 +86,7 @@ jobs: echo "===== $CONFIG_PATH/dump" ls -la "$CONFIG_PATH/dump/" || echo "MISSING: $CONFIG_PATH/dump" echo "===== dump referenced by DUMP_PATH input" - ls -la "${{ inputs.DUMP_PATH }}" || echo "MISSING dump: ${{ inputs.DUMP_PATH }}" + ls -la "$DUMP_PATH" || echo "MISSING dump: $DUMP_PATH" echo "===== port-ish keys from .env (values shown; these are ports, not secrets)" grep -E '^(PG_PORT|SOLR_PORT|DSPACE_PORT|DSPACE_FE_PORT|DSPACE_REST_PORT|DSPACE_DOCKER_REST_PORT|DSPACE_VER|DSPACE_HOST)=' "$ENVFILE" || echo "no port keys found" @@ -205,6 +206,7 @@ jobs: CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} DUMP_PATH: ${{inputs.DUMP_PATH}} ASSETSTORE_PATH: ${{inputs.ASSETSTORE_PATH}} + DEV_MACHINE: ${{inputs.DEV_MACHINE}} ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} steps: - uses: actions/checkout@v6 @@ -215,7 +217,7 @@ jobs: export DDBNAME=dspacedb${INSTANCE} if [ ! -f "$DUMP_PATH" ]; then - echo "::error::Dump not found on ${{inputs.DEV_MACHINE}}: $DUMP_PATH" + echo "::error::Dump not found on $DEV_MACHINE: $DUMP_PATH" exit 1 fi echo "Importing dump: $DUMP_PATH ($(du -h "$DUMP_PATH" | cut -f1))" From 78c549ddec9c62fd85581c1b773876f084532fd3 Mon Sep 17 00:00:00 2001 From: Juraj Roka <95219754+jr-rk@users.noreply.github.com> Date: Tue, 10 Nov 2026 08:15:11 +0100 Subject: [PATCH 5/6] ci(deploy): import the anonymized dump into 8633 The dev-5 dump is now anonymized (accounts, e-mails, tokens) before it is placed on dev-20 as /opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16_anon.sql. --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0bf0c97004f..85c6fae33be 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,7 @@ on: DUMP_PATH: required: false type: string - default: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16.sql' + default: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16_anon.sql' ASSETSTORE_PATH: required: false type: string @@ -53,7 +53,7 @@ on: description: 'Absolute path of the SQL dump ON THE DEV MACHINE (used only when IMPORT is checked)' required: false type: string - default: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16.sql' + default: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16_anon.sql' ASSETSTORE_PATH: description: 'Absolute path of the assetstore directory ON THE DEV MACHINE' required: false From 04a87ea5caa381a5699d4692a94cfbaaa0c08dd9 Mon Sep 17 00:00:00 2001 From: Juraj Roka <95219754+jr-rk@users.noreply.github.com> Date: Tue, 10 Nov 2026 09:43:15 +0100 Subject: [PATCH 6/6] ci(deploy): fail on dump errors, recreate dev user, surface compose errors - psql loads the dump with ON_ERROR_STOP=1: the anonymized dump restores with zero errors, so any error now means a partial restore that later steps would not catch. - The import replaces the whole DB, dropping the dev user start.sh created; recreate it, since the REST tests after import log in as it. - The probe verdict printed "OK" when `compose config` failed and only looked for the dtq-dev-9-base fixed ports. Check `config -q` first and also flag the 6+ digit ports this branch builds from INSTANCE. --- .github/workflows/deploy.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 85c6fae33be..39264c47603 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -117,10 +117,20 @@ jobs: config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -30 \ || echo "compose config failed" echo "===== verdict" - if docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ + # The greps above swallow compose errors (`cmd | grep | head || echo` never reaches + # the echo), so check the resolution itself first. + if ! err=$(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 -q 2>&1); then + echo " ERROR: compose config failed, the deploy will fail the same way:" + echo "$err" | sed 's/^/ /' + # On this branch the repo files build ports from INSTANCE (808${INSTANCE} -> 8088633), + # so an inherited port shows up as a 6+ digit number rather than a fixed one. + elif 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|[0-9]{6,})"'; 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'." @@ -208,6 +218,7 @@ jobs: ASSETSTORE_PATH: ${{inputs.ASSETSTORE_PATH}} DEV_MACHINE: ${{inputs.DEV_MACHINE}} ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + USER_PASSWORD: ${{ secrets.DSPACE_USER_PASSWORD }} steps: - uses: actions/checkout@v6 @@ -232,7 +243,7 @@ jobs: docker exec $DDBNAME /bin/bash -c " dropdb -U dspace dspace || true && createdb -U dspace --owner=dspace --encoding=UNICODE dspace && - psql -U dspace -d dspace -f /tmp/dump.sql + psql -U dspace -d dspace -v ON_ERROR_STOP=1 -f /tmp/dump.sql " echo "=====" docker exec $DDBNAME /bin/bash -c "rm -f /tmp/dump.sql" || true @@ -304,6 +315,14 @@ jobs: echo "Creating DSpace administrator..." docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace create-administrator -e dspace.admin.dev@dataquest.sk -f admin -l user -p \"${ADMIN_PASSWORD}\" -c en -o dataquest" + # The import replaced the whole DB, so the dev user start.sh created is gone too; the + # REST tests after import log in as this user. + - name: create dev user + run: | + export DNAME=dspace${INSTANCE} + echo "Creating DSpace dev user..." + docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace user --add -m dspace.user.dev@dataquest.sk -g meno -s priezvisko -l en -p \"${USER_PASSWORD}\" -o dataquest" + - name: rebuild discovery index and run oai import run: | export DNAME=dspace${INSTANCE}