Skip to content

Commit b6a13a7

Browse files
committed
Merge branch 'dspace-cris-2024_02_x' into ux-plus-cris-2024_02_x
2 parents b73b5a6 + 435a02f commit b6a13a7

12 files changed

Lines changed: 128 additions & 54 deletions

.github/workflows/docker.yml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,66 @@ name: Docker images
99
on:
1010
push:
1111
branches:
12-
- main
13-
- 'dspace-**'
12+
- main-cris
13+
- 'dspace-cris-*_02_x'
1414
tags:
15-
- 'dspace-**'
15+
- 'dspace-cris-**'
1616
pull_request:
1717

1818
permissions:
1919
contents: read # to fetch code (actions/checkout)
2020
packages: write # to write images to GitHub Container Registry (GHCR)
2121

2222
jobs:
23+
24+
####################################################
25+
# Build/Push the '4science/dspace-cris-dependencies' image.
26+
# This image is used by all other DSpace build jobs.
27+
####################################################
28+
dspace-cris-angular-dependencies:
29+
# Ensure this job never runs on forked repos. It's only executed for '4science/dspace'
30+
if: github.repository == '4science/dspace-angular'
31+
# Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
32+
uses: 4science/DSpace/.github/workflows/reusable-docker-build.yml@dspace-cris-2024_02_x
33+
with:
34+
build_id: dspace-cris-angular-dependencies
35+
image_name: 4science/dspace-cris-angular-dependencies
36+
dockerfile_path: ./Dockerfile.dependencies
37+
secrets:
38+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
39+
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
40+
41+
2342
#############################################################
24-
# Build/Push the 'dspace/dspace-angular' image
43+
# Build/Push the '4science/dspace-cris-angular' image
2544
#############################################################
2645
dspace-angular:
2746
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
28-
if: github.repository == 'dspace/dspace-angular'
47+
if: github.repository == '4science/dspace-angular'
2948
# Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
30-
uses: DSpace/DSpace/.github/workflows/reusable-docker-build.yml@main
49+
uses: 4science/DSpace/.github/workflows/reusable-docker-build.yml@dspace-cris-2024_02_x
50+
needs: dspace-cris-angular-dependencies
3151
with:
32-
build_id: dspace-angular-dev
33-
image_name: dspace/dspace-angular
52+
build_id: dspace-cris-angular-dev
53+
image_name: 4science/dspace-cris-angular
3454
dockerfile_path: ./Dockerfile
3555
secrets:
3656
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
3757
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
3858

3959
#############################################################
40-
# Build/Push the 'dspace/dspace-angular' image ('-dist' tag)
60+
# Build/Push the '4science/dspace-cris-angular' image ('-dist' tag)
4161
#############################################################
4262
dspace-angular-dist:
4363
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
44-
if: github.repository == 'dspace/dspace-angular'
64+
if: github.repository == '4science/dspace-angular'
4565
# Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
46-
uses: DSpace/DSpace/.github/workflows/reusable-docker-build.yml@main
66+
uses: 4science/DSpace/.github/workflows/reusable-docker-build.yml@dspace-cris-2024_02_x
67+
# Must run after 'dspace-dependencies' job above
68+
needs: dspace-cris-angular-dependencies
4769
with:
48-
build_id: dspace-angular-dist
49-
image_name: dspace/dspace-angular
70+
build_id: dspace-cris-angular-dist
71+
image_name: 4science/dspace-cris-angular
5072
dockerfile_path: ./Dockerfile.dist
5173
# As this is a "dist" image, its tags are all suffixed with "-dist". Otherwise, it uses the same
5274
# tagging logic as the primary 'dspace/dspace-angular' image above.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
33

44
ARG NODE_VERSION=22
5-
ARG DSPACE_VERSION=2024_02_x
5+
ARG DSPACE_VERSION=dspace-cris-2024_02_x
66
ARG DOCKER_REGISTRY=docker.io
77

8-
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-2024_02_x} AS dev
8+
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-dspace-cris-2024_02_x} AS dev
99

1010
WORKDIR /app
1111
ADD . /app/

Dockerfile.dependencies

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Test build:
2-
# docker build -f Dockerfile.dependencies -t 4science/dspace-angular-dependencies:2024_02_x .
2+
# docker build -f Dockerfile.dependencies -t 4science/dspace-cris-angular-dependencies:dspace-cris-2024_02_x .
33

44
# Angular 17 + Node 22 optimized Dockerfile
55
ARG NODE_VERSION=22
6-
ARG DSPACE_VERSION=2024_02_X
6+
ARG DSPACE_VERSION=dspace-cris-2024_02_x
77
ARG DOCKER_REGISTRY=docker.io
88

9-
FROM ${DOCKER_REGISTRY:-docker.io}/node:${NODE_VERSION-22}-alpine AS dependencies
9+
FROM docker.io/node:${NODE_VERSION-22}-alpine AS dependencies
1010

1111
# Install build dependencies
1212
RUN apk add --no-cache python3 make g++
@@ -15,4 +15,4 @@ WORKDIR /app
1515

1616
# Install dependencies (use npm ci if you have package-lock.json)
1717
COPY package.json yarn.lock ./
18-
RUN yarn install --network-timeout 300000
18+
RUN yarn install --frozen-lockfile --network-timeout 300000

Dockerfile.dist

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
# syntax=docker/dockerfile:1.7-labs
22

33
# This image will be published as dspace/dspace-angular:$DSPACE_VERSION-dist
4-
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
4+
# See https://github.com/4science/dspace-angular/tree/main/docker for usage details
55

66
# Test build:
7-
# docker build -f Dockerfile.dist -t dspace/dspace-angular:dspace-8_x-dist .
7+
# docker build -f Dockerfile.dist -t 4science/dspace-angular:dspace-cris-2024_02_x-dist .
88

99
# Angular 17 + Node 22 optimized Dockerfile
1010
ARG NODE_VERSION=22
11-
ARG DSPACE_VERSION=2024_02_x
11+
ARG DSPACE_VERSION=dspace-cris-2024_02_x
1212
ARG DOCKER_REGISTRY=docker.io
1313

14-
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-2024_02_x} AS build
14+
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-dspace-cris-2024_02_x} AS build
1515

16-
COPY --parents src/** config/** webpack/** docker/dspace-ui.json angular.json server.ts startup-message.ts tsconfig.json tsconfig.app.json tsconfig.server.json tsconfig.spec.json tsconfig.ts-node.json typedoc.json /app/
16+
COPY . /app/
1717

1818
WORKDIR /app
1919

2020
# Build Angular app
2121
RUN yarn build:prod
22+
RUN yarn build:mirador
2223

2324
# ---- Production image ----
24-
FROM ${DOCKER_REGISTRY:-docker.io}/node:${NODE_VERSION-22}-alpine AS prod
25+
FROM docker.io/node:${NODE_VERSION-22}-alpine AS prod
2526

2627
# Install pm2 globally and clean npm cache
2728
RUN npm install --global pm2 && npm cache clean --force

bitbucket-pipelines.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ definitions:
1818
- git config --global user.name "${BB_EMAIL}"
1919
- git clone https://x-token-auth:${E2ERUNNERS_ACCESS_TOKEN}@${E2E_VALUES_REPO}
2020
- cd e2erunners-values
21-
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL > ${HASH_COMMIT}
22-
- sed -i "s#BRANCH_NAME#${BRANCH_NAME}#g" TPL ${HASH_COMMIT}
21+
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL-cris-2024 > ${HASH_COMMIT}
22+
- sed -i "s#BRANCH_NAME#${BRANCH_NAME}#g" TPL-cris-2024 ${HASH_COMMIT}
2323
- git add ${HASH_COMMIT}
2424
- git commit -m "Add configuration for e2e-${HASH_COMMIT}" || echo "No changes to commit"
2525
- git push
@@ -44,8 +44,8 @@ definitions:
4444
- git config --global user.name "${BB_EMAIL}"
4545
- git clone https://x-token-auth:${E2ERUNNERS_ACCESS_TOKEN}@${E2E_VALUES_REPO}
4646
- cd e2erunners-values
47-
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL > ${HASH_COMMIT}
48-
- sed -i "s#BRANCH_NAME#${BRANCH_NAME}#g" TPL ${HASH_COMMIT}
47+
- sed "s#HASH_COMMIT#${HASH_COMMIT}#g" TPL-cris-2024 > ${HASH_COMMIT}
48+
- sed -i "s#BRANCH_NAME#${BRANCH_NAME}#g" TPL-cris-2024 ${HASH_COMMIT}
4949
- git add ${HASH_COMMIT}
5050
- git commit -m "Add configuration for e2e-${HASH_COMMIT}" || echo "No changes to commit"
5151
- git push
@@ -184,6 +184,21 @@ definitions:
184184
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
185185
- git push
186186

187+
- step: &deploy-on-test
188+
name: Deploy on Test environment
189+
image: alpine/git:latest
190+
script:
191+
- export HASH_COMMIT=${BITBUCKET_COMMIT:0:8}
192+
- export BRANCH_NAME=$(echo "$BITBUCKET_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's|/|--|g')
193+
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
194+
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
195+
- cd dspace-values
196+
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "test/${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "test/${BRANCH_FILE}"'
197+
- git config --global user.email "${BB_EMAIL}"
198+
- git config --global user.name "${BB_USER}"
199+
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
200+
- git push
201+
187202
- step: &turn-on-dev
188203
name: Turn On Dev environment
189204
image: alpine/git:latest
@@ -214,6 +229,21 @@ definitions:
214229
- git commit -am "Enable staging environment for ${BRANCH_NAME}" || echo "No changes to commit"
215230
- git push
216231

232+
- step: &turn-on-test
233+
name: Turn On Test environment
234+
image: alpine/git:latest
235+
script:
236+
- export HASH_COMMIT=${BITBUCKET_COMMIT:0:8}
237+
- export BRANCH_NAME=$(echo "$BITBUCKET_BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's|/|--|g')
238+
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
239+
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
240+
- cd dspace-values
241+
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
242+
- git config --global user.email "${BB_USER}"
243+
- git config --global user.name "${BB_EMAIL}"
244+
- git commit -am "Enable test environment for ${BRANCH_NAME}" || echo "No changes to commit"
245+
- git push
246+
217247
- step: &find-and-invalidate-cloudfront-dev
218248
name: Invalidate CloudFront Dev Cache
219249
image: amazon/aws-cli
@@ -236,6 +266,17 @@ definitions:
236266
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='staging--${CLOUDFRONT_NAME}'].Id" --output text)
237267
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
238268

269+
- step: &find-and-invalidate-cloudfront-test
270+
name: Invalidate CloudFront Test Cache
271+
image: amazon/aws-cli
272+
script:
273+
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
274+
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
275+
- export AWS_DEFAULT_REGION=$AWS_REGION
276+
- export CLOUDFRONT_NAME=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
277+
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='test--${CLOUDFRONT_NAME}'].Id" --output text)
278+
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
279+
239280
pipelines:
240281
custom:
241282
e2e-on-custom-backend:
@@ -253,6 +294,8 @@ pipelines:
253294
- step: *turn-on-dev
254295
turn-on-staging:
255296
- step: *turn-on-staging
297+
turn-on-test:
298+
- step: *turn-on-test
256299
branches:
257300
'ux-plus-cris-2024_02_x':
258301
- step: *preliminary-operation
@@ -272,6 +315,14 @@ pipelines:
272315
- step: *find-and-invalidate-cloudfront-dev
273316
- step: *deploy-on-staging
274317
- step: *find-and-invalidate-cloudfront-staging
318+
'test/**':
319+
- step: *preliminary-operation
320+
- step: *angular-build
321+
- parallel: *parallel-run-tests
322+
- step: *build-and-push
323+
- step: *deploy-on-test
324+
- step: *find-and-invalidate-cloudfront-test
325+
275326
pull-requests:
276327
'**':
277328
- step: *preliminary-operation

docker/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ the Docker compose scripts in this 'docker' folder.
2323
This Dockerfile is used to build a *development* DSpace-CRIS Angular UI image, published as '4science/dspace-cris-angular'
2424

2525
```
26-
docker build -t 4science/dspace-cris-angular:2024_02_x .
26+
docker build -t 4science/dspace-cris-angular:dspace-cris-2024_02_x .
2727
```
2828

2929
This image is built *automatically* after each commit is made to the `main` branch.
3030

3131
Admins to our DockerHub repo can manually publish with the following command.
3232
```
33-
docker push 4science/dspace-cris-angular:2024_02_x
33+
docker push 4science/dspace-cris-angular:dspace-cris-2024_02_x
3434
```
3535

3636
### Dockerfile.dist
@@ -39,7 +39,7 @@ The `Dockerfile.dist` is used to generate a *production* build and runtime envir
3939

4040
```bash
4141
# build the latest image
42-
docker build -f Dockerfile.dist -t 4science/dspace-cris-angular:2024_02_x-dist .
42+
docker build -f Dockerfile.dist -t 4science/dspace-cris-angular:dspace-cris-2024_02_x-dist .
4343
```
4444

4545
A default/demo version of this image is built *automatically*.
@@ -71,7 +71,7 @@ docker compose -f docker/docker-compose.yml build
7171

7272
This command provides a quick way to start both the frontend & backend from this single codebase
7373
```
74-
docker compose -p c24 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
74+
docker compose -p dcris24 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
7575
```
7676

7777
Keep in mind, you may also start the backend by cloning the 'DSpace/DSpace' GitHub repository separately. See the next section.
@@ -86,14 +86,14 @@ _The system will be started in 2 steps. Each step shares the same docker network
8686

8787
From 'DSpace/DSpace' clone (build first as needed):
8888
```
89-
docker compose -p c24 up -d
89+
docker compose -p dcris24 up -d
9090
```
9191

9292
NOTE: More detailed instructions on starting the backend via Docker can be found in the [Docker Compose instructions for the Backend](https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/README.md).
9393

9494
From 'DSpace/dspace-angular' clone (build first as needed)
9595
```
96-
docker compose -p c24 -f docker/docker-compose.yml up -d
96+
docker compose -p dcris24 -f docker/docker-compose.yml up -d
9797
```
9898

9999
At this point, you should be able to access the UI from http://localhost:4000,
@@ -107,38 +107,38 @@ This allows you to run the Angular UI in *production* mode, pointing it at the d
107107
```
108108
docker compose -f docker/docker-compose-dist.yml pull
109109
docker compose -f docker/docker-compose-dist.yml build
110-
docker compose -p c24 -f docker/docker-compose-dist.yml up -d
110+
docker compose -p dcris24 -f docker/docker-compose-dist.yml up -d
111111
```
112112

113113
## Ingest test data from AIPDIR
114114

115115
Create an administrator
116116
```
117-
docker compose -p c24 -f docker/cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en
117+
docker compose -p dcris24 -f docker/cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en
118118
```
119119

120120
Load content from AIP files
121121
```
122-
docker compose -p c24 -f docker/cli.yml -f ./docker/cli.ingest.yml run --rm dspace-cli
122+
docker compose -p dcris24 -f docker/cli.yml -f ./docker/cli.ingest.yml run --rm dspace-cli
123123
```
124124

125125
## Alternative Ingest - Use Entities dataset
126126
_Delete your docker volumes or use a unique project (-p) name_
127127

128128
Start DSpace-CRIS with Database Content from a database dump
129129
```
130-
docker compose -p c24 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f docker/db.entities.yml up -d
130+
docker compose -p dcris24 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f docker/db.entities.yml up -d
131131
```
132132

133133
Load assetstore content and trigger a re-index of the repository
134134
```
135-
docker compose -p c24 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
135+
docker compose -p dcris24 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
136136
```
137137

138138
## End to end testing of the REST API (runs in GitHub Actions CI).
139139
_In this instance, only the REST api runs in Docker using the Entities dataset. GitHub Actions will perform CI testing of Angular using Node to drive the tests. See `.github/workflows/build.yml` for more details._
140140

141141
This command is only really useful for testing our Continuous Integration process.
142142
```
143-
docker compose -p c24ci -f docker/docker-compose-ci.yml up -d
143+
docker compose -p dcris24ci -f docker/docker-compose-ci.yml up -d
144144
```

docker/cli.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
# Therefore, it should be kept in sync with that file
1515
networks:
1616
# Default to using network named 'dspacenet' from docker-compose-rest.yml.
17-
# Its full name will be prepended with the project name (e.g. "-p d8" means it will be named "d8_dspacenet")
17+
# Its full name will be prepended with the project name (e.g. "-p dcris24" means it will be named "dcris24_dspacenet")
1818
# If COMPOSITE_PROJECT_NAME is missing, default value will be "docker" (name of folder this file is in)
1919
default:
2020
name: ${COMPOSE_PROJECT_NAME:-docker}_dspacenet
2121
external: true
2222
services:
2323
dspace-cli:
24-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-cli:${DSPACE_VER:-2024_02_x}"
24+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-cli:${DSPACE_VER:-dspace-cris-2024_02_x}"
2525
container_name: dspace-cli
2626
environment:
2727
# Below syntax may look odd, but it is how to override dspace.cfg settings via env variables.

docker/db.entities.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# # Therefore, it should be kept in sync with that file
1515
services:
1616
dspacedb:
17-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-postgres-pgcrypto:${DSPACE_VER:-2024_02_x}-loadsql"
17+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-postgres-pgcrypto:${DSPACE_VER:-dspace-cris-2024_02_x}-loadsql"
1818
environment:
1919
# This LOADSQL should be kept in sync with the URL in 4Science/DSpace
2020
# This SQL is available from https://github.com/4Science/DSpace-CRIS-Files/releases/download/cris-2024.02.00/db-entities.sql

0 commit comments

Comments
 (0)