diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c6a83067feb..39264c47603 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,29 +4,39 @@ name: Deploy DSpace on: workflow_call: inputs: + DEV_MACHINE: + required: false + type: string + default: 'dev-20' 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: '/opt/dspace-envs/8633/dump/dspace_dev5_dump_26.07.16_anon.sql' + 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' IMPORT: required: true default: true @@ -35,50 +45,146 @@ on: required: false default: false type: boolean + DEV_MACHINE: + required: false + type: string + default: 'dev-20' + DUMP_PATH: + 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_anon.sql' + 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 + DUMP_PATH: ${{inputs.DUMP_PATH}} 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 "$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" + + - 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 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 "===== 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 \ + || echo "compose config failed" + echo "===== verdict" + # 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 -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'." + 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 imported 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" + # 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 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);" \ + 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 +192,155 @@ 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}} + DEV_MACHINE: ${{inputs.DEV_MACHINE}} + ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + USER_PASSWORD: ${{ secrets.DSPACE_USER_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: vanilla import 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 $DEV_MACHINE: $DUMP_PATH" + 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" + echo "=====" + docker cp "$DUMP_PATH" $DDBNAME:/tmp/dump.sql + + # 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 && + 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 - 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 }} + - name: run database migration + run: | + 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`: 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" + + 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 - - name: dspace basic command + - name: copy assetstore run: | - export DNAME=dspace$INSTANCE - docker logs -n 50 $DNAME + export DNAME=dspace${INSTANCE} - echo "dspace version:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace version" + echo "Preparing assetstore" + if [ -z "$ASSETSTORE_PATH" ]; then + echo "Assetstore path is empty. Not copying assetstore." + else + docker cp "$ASSETSTORE_PATH" $DNAME:/dspace/ + docker exec -u root $DNAME chown -R dspace:dspace /dspace/assetstore + fi - echo "dspace cleanup:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace cleanup -v" + - 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 solr:" - docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b" + # 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" - 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 +354,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-20.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 +383,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-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 fceb3297045..b74d10c5b4c 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-20' 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 de61d114727..082c28cb740 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-20.pc:8633/repository/ NAME: lindat-767 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..8c0c129aece 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 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. +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