Skip to content

Commit

Permalink
[devOps] create new dspace instance with imported data
Browse files Browse the repository at this point in the history
  • Loading branch information
jm committed Nov 7, 2023
1 parent de76edd commit 40fdef0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: false
- name: deploy
- name: deploy to dev-5
run: |
cd $GITHUB_WORKSPACE/build-scripts/run/
pwd
Expand Down Expand Up @@ -39,3 +39,15 @@ jobs:
export ENVFILE=$(pwd)/.env.dev-5
./start.sh dspace-5
- name: deploy dspace-import on dev-5
working-directory: build-scripts/run/
run: |
ENVFILE=/opt/dspace-envs/.env.dspace.imported.dev-5 ./start.sh dspace-5-import
sleep 120
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-angular/actions/workflows/import.yml/dispatches \
--data "{\"ref\":\"refs/heads/dtq-dev\"}"
35 changes: 35 additions & 0 deletions .github/workflows/import.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Import DSpace v5

on:
workflow_dispatch:

jobs:
deploy:
runs-on: dspace-dep-1
steps:
- uses: actions/checkout@v4
with:
repository: dataquest-dev/dspace-python-api
path: dspace-python-api
ref: 'refactor_jm'

- name: deploy dspace-import on dev-5
id: import
working-directory: dspace-python-api/scripts
run: |
docker stop dspace-import-db5 || true
DB5PORT=15432
cid=$(docker run -d --name dspace-import-db5 -v $pwd:/dq/scripts -v %cd%/../input/dump:/dq/dump \
-p 127.0.0.1:$DB5PORT:5432 -e POSTGRES_DB=empty -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=dspace postgres /bin/bash -c "cd /dq/scripts && ./init.dspacedb5.sh")
echo "cid=$cid" >> $GITHUB_OUTPUT
sleep 10
cd ../src
# cleanup resume
rm __temp/resume/*.json || true
echo python repo_import.py --resume=false
- name: cleanup
run: |
docker stop ${{ steps.import.outputs.cid }} || true
if: ${{ always() }}

0 comments on commit 40fdef0

Please sign in to comment.