Deploy DSpace #2218
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: '6' | |
| IMPORT: | |
| required: false | |
| default: true | |
| type: boolean | |
| ERASE_DB: | |
| required: false | |
| default: false | |
| type: boolean | |
| workflow_dispatch: | |
| inputs: | |
| INSTANCE: | |
| required: true | |
| default: '6' | |
| type: choice | |
| options: | |
| - '*' | |
| - '6' | |
| IMPORT: | |
| required: true | |
| default: true | |
| type: boolean | |
| ERASE_DB: | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| deploy-6: | |
| if: inputs.INSTANCE == '*' || inputs.INSTANCE == '6' | |
| runs-on: dspace-dep-1 | |
| timeout-minutes: 10 | |
| env: | |
| INSTANCE: '6' | |
| ENVFILE: /opt/dspace-envs/.env.dspace.dev-5.tul | |
| 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 | |
| playwright-after-deploy6: | |
| needs: deploy-6 | |
| if: '!inputs.IMPORT' | |
| uses: ./.github/workflows/playwright-tests.yml | |
| secrets: inherit | |
| rest-tests-after-deploy6: | |
| runs-on: ubuntu-latest | |
| needs: playwright-after-deploy6 | |
| timeout-minutes: 120 | |
| steps: | |
| - name: run rest-tests | |
| run: | | |
| curl -H "Accept: application/vnd.github.everest-preview+json" \ | |
| -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \ | |
| --request POST \ | |
| https://api.github.com/repos/dataquest-dev/\ | |
| dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \ | |
| --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null | |
| # wait for it to start | |
| sleep 30s | |
| # get result of last job | |
| RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) | |
| # while job did not finish, sleep | |
| while [[ $RES == 'null' ]]; do | |
| sleep 10s | |
| RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) | |
| done; | |
| echo $RES | |
| # if last result is not success, return -1 and fail | |
| if [[ $RES != \"success\" ]]; then | |
| echo "rest-tests have failed! check appropriate action run" | |
| exit 1 | |
| fi; | |
| playwright-after-import6: | |
| needs: import-6 | |
| if: inputs.IMPORT | |
| uses: ./.github/workflows/playwright-tests.yml | |
| secrets: inherit | |
| rest-tests-after-import6: | |
| runs-on: ubuntu-latest | |
| needs: playwright-after-import6 | |
| timeout-minutes: 120 | |
| steps: | |
| - name: run rest-tests | |
| run: | | |
| curl -H "Accept: application/vnd.github.everest-preview+json" \ | |
| -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \ | |
| --request POST \ | |
| https://api.github.com/repos/dataquest-dev/\ | |
| dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \ | |
| --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null | |
| # wait for it to start | |
| sleep 30s | |
| # get result of last job | |
| RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) | |
| # while job did not finish, sleep | |
| while [[ $RES == 'null' ]]; do | |
| sleep 10s | |
| RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) | |
| done; | |
| echo $RES | |
| # if last result is not success, return -1 and fail | |
| if [[ $RES != \"success\" ]]; then | |
| echo "rest-tests have failed! check appropriate action run" | |
| exit 1 | |
| fi; | |
| import-6: | |
| runs-on: dspace-dep-1 | |
| if: inputs.IMPORT && inputs.INSTANCE == '6' | |
| timeout-minutes: 120 | |
| needs: deploy-6 | |
| env: | |
| INSTANCE: '6' | |
| steps: | |
| - name: vanilla import | |
| env: | |
| FNAME: dspace_tul_dump_2025.10.27.sql | |
| run: | | |
| export DATADIR=/opt/dspace-data/tul-dump/$FNAME | |
| export DNAME=dspace$INSTANCE | |
| export DDBNAME=dspacedb$INSTANCE | |
| echo "=====" | |
| docker stop $DNAME || true | |
| echo "=====" | |
| # echo Starting vanilla import DB | |
| docker cp $DATADIR $DDBNAME:/tmp/ | |
| # drop + create + import + cleanup | |
| docker exec $DDBNAME /bin/bash -c "dropdb -U dspace dspace && createdb -U dspace --owner=dspace --encoding=UNICODE dspace && psql -U dspace -d dspace -f /tmp/$FNAME && rm /tmp/$FNAME" | |
| echo "=====" | |
| docker start $DNAME | |
| sleep 60 | |
| docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace database migrate ignored && ./dspace create-administrator -e dspace.admin.dev@dataquest.sk -f admin -l user -p admin -c en -o dataquest" | |
| echo "=====" | |
| # new user will not be accepted unless restarted | |
| docker restart $DNAME | |
| sleep 60 | |
| echo "=====" | |
| - 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:" | |
| # very likely - https://groups.google.com/g/dspace-tech/c/tsoctFfNUsI/m/IIeYofYADAAJ | |
| # 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" | |
| - name: dspace healthcheck | |
| run: | | |
| export DNAME=dspace$INSTANCE | |
| echo "dspace healthcheck:" | |
| # docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" | |
| - name: dspace basic command | |
| run: | | |
| echo "dspace checker:" | |
| # docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l" | |