Deploy DSpace #2282
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # DSpace Docker deploy on dataquest servers | |
| name: Deploy DSpace | |
| on: | |
| workflow_call: | |
| inputs: | |
| INSTANCE: | |
| required: false | |
| type: string | |
| default: '5' | |
| IMPORT: | |
| required: false | |
| default: true | |
| type: boolean | |
| ERASE_DB: | |
| required: false | |
| default: false | |
| type: boolean | |
| workflow_dispatch: | |
| inputs: | |
| INSTANCE: | |
| required: true | |
| default: '5' | |
| type: choice | |
| options: | |
| - '*' | |
| - '5' | |
| - '8' | |
| IMPORT: | |
| required: true | |
| default: true | |
| type: boolean | |
| ERASE_DB: | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| deploy-5: | |
| if: inputs.INSTANCE == '*' || inputs.INSTANCE == '5' | |
| runs-on: dspace-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 }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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/ | |
| 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 up -d --no-build | |
| deploy-8: | |
| if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8' | |
| runs-on: dspace-dep-1 | |
| timeout-minutes: 120 | |
| 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 }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/erase-db | |
| if: inputs.ERASE_DB | |
| with: | |
| INSTANCE: ${{ env.INSTANCE }} | |
| NAME: dspace-${{ env.INSTANCE }} | |
| - name: deploy dspace-import on dev-5 | |
| working-directory: build-scripts/run/ | |
| 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 | |
| # 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 | |
| if: inputs.IMPORT | |
| needs: deploy-5 | |
| env: | |
| INSTANCE: '5' | |
| ENVFILE: /opt/dspace-envs/.env.dspace.dev-5 | |
| 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 }} | |
| - name: dspace basic command | |
| 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" | |
| echo "dspace reindex solr:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b" | |
| echo "dspace reindex OAI-PMH:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace oai import -c" | |
| echo "dspace checker:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l" | |
| - name: dspace healthcheck | |
| run: | | |
| export DNAME=dspace$INSTANCE | |
| echo "dspace healthcheck:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" | |
| 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: dspace basic command | |
| 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" | |
| echo "dspace reindex solr:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b" | |
| echo "dspace reindex OAI-PMH:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace oai import -c" | |
| echo "dspace checker:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l" | |
| - name: dspace healthcheck | |
| run: | | |
| export DNAME=dspace$INSTANCE | |
| echo "dspace healthcheck:" | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" | |
| playwright-after-deploy8: | |
| needs: deploy-8 | |
| if: '!inputs.IMPORT' | |
| uses: ./.github/workflows/playwright-tests.yml | |
| secrets: inherit | |
| rest-tests-after-deploy8: | |
| runs-on: ubuntu-latest | |
| needs: playwright-after-deploy8 | |
| if: '!inputs.IMPORT' | |
| timeout-minutes: 120 | |
| env: | |
| GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} | |
| REPO: dataquest-dev/dspace-rest-test | |
| WORKFLOW: run_unittests.yml | |
| steps: | |
| - name: run rest-tests | |
| run: | | |
| OUTPUT=$(gh workflow run "$WORKFLOW" \ | |
| --repo "$REPO" \ | |
| --ref master \ | |
| -f CUSTOMER="${{ github.ref_name }}" \ | |
| -f URL="http://dev-5.pc:88/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 | |
| if: inputs.IMPORT | |
| uses: ./.github/workflows/playwright-tests.yml | |
| secrets: inherit | |
| rest-tests-after-import8: | |
| runs-on: ubuntu-latest | |
| needs: playwright-after-import8 | |
| timeout-minutes: 120 | |
| env: | |
| GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} | |
| REPO: dataquest-dev/dspace-rest-test | |
| WORKFLOW: run_unittests.yml | |
| steps: | |
| - name: run rest-tests | |
| run: | | |
| OUTPUT=$(gh workflow run "$WORKFLOW" \ | |
| --repo "$REPO" \ | |
| --ref master \ | |
| -f CUSTOMER="${{ github.ref_name }}" \ | |
| -f URL="http://dev-5.pc:88/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 |