forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathaction.yml
More file actions
105 lines (98 loc) · 3.56 KB
/
Copy pathaction.yml
File metadata and controls
105 lines (98 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: 'Import dspace db'
description: 'CI/CD import db'
inputs:
DATADIR:
description: 'data dir with dump, icons'
required: true
type: string
INSTANCE:
description: 'port suffix'
required: true
type: string
ASSETSTORE:
description: 'location of assetstore folder'
required: false
type: string
ADMIN_PASSWORD:
description: 'Admin password for DSpace'
required: true
type: string
runs:
using: "composite"
steps:
- name: info
shell: bash
run: |
docker ps -a
- uses: actions/checkout@v4
with:
repository: dataquest-dev/dspace-import
ref: 'main'
submodules: 'recursive'
path: 'dspace-import'
- name: stop and remove containers
id: import
shell: bash
working-directory: dspace-import/scripts
env:
DATADIR: ${{ inputs.DATADIR }}
DB5PORT: 15432
DB5NAME: dspace-import-db5
DB7PORT: 543${{ inputs.INSTANCE }}
BEURL: http://dev-5.pc:8${{ inputs.INSTANCE }}/repository/server/api
BEUSERNAME: dspace.admin.dev@dataquest.sk
BEUSERPASSWORD: ${{ inputs.ADMIN_PASSWORD }}
run: |
docker stop $DB5NAME || true
echo "====="
echo Starting import DB
# create otherwise it will be created with root owner
cid=$(docker run -d --rm --name $DB5NAME -v $(pwd):/dq/scripts -v $DATADIR/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 60
# copy assetstore
echo Preparing assetstore
if [[ -z ${{ inputs.ASSETSTORE }} ]]; then
echo Location of assetstore folder is empty. Not copping assetstore
else
docker cp ${{ inputs.ASSETSTORE }} dspace${{ inputs.INSTANCE }}:/dspace/
fi
echo "====="
cd ../
pip install -r requirements.txt || true
echo "====="
cd ./src
# cleanup resume
rm __temp/resume/*.json || true
# arguments of the script
# required
echo "====="
# Generate the current timestamp for the log filename
timestamp=$(date +"%y%m%d%H%M")
log_file_timestamp="${{ inputs.LOGDIR }}python.${timestamp}.log"
echo $log_file_timestamp
mkdir ../__logs
# Continuously append to the log file $log_file_timestamp. Start appending when the first file is added to the __logs folder.
inotifywait -m -e create --format "%w%f" ../__logs/ | while IFS= read -r file; do tail -F --retry "$file" >> "$log_file_timestamp" 2>/dev/null & done &
echo "====="
args=(
--resume=false
--config=backend.endpoint=$BEURL
--config=backend.user=$BEUSERNAME
--config=backend.password=$BEUSERPASSWORD
--config=db_dspace_7.port=$DB7PORT
--config=db_dspace_5.port=$DB5PORT
--config=db_utilities_5.port=$DB5PORT
--config=input.datadir=$DATADIR/data/
--config=input.icondir=$DATADIR/icon/
)
# Add --resume argument if inputs.ASSETSTORE is defined
if [ -n "${{ inputs.ASSETSTORE }}" ]; then
args+=(--assetstore=${{ inputs.ASSETSTORE }})
fi
python3 repo_import.py "${args[@]}"
- name: cleanup
shell: bash
run: |
docker stop ${{ steps.import.outputs.cid }} || true
if: ${{ always() }}