Skip to content

Commit ea87217

Browse files
author
abhinav
committed
Merge branch 'dspace-8_x' into cache-bust-dynamic-configuration-8.x
2 parents 2ead58a + 7fbbb53 commit ea87217

146 files changed

Lines changed: 2668 additions & 1533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 18+
2525
DSPACE_UI_HOST: 127.0.0.1
2626
DSPACE_UI_PORT: 4000
27+
DSPACE_UI_BASEURL: http://127.0.0.1:4000
2728
# Ensure all SSR caching is disabled in test environment
2829
DSPACE_CACHE_SERVERSIDE_BOTCACHE_MAX: 0
2930
DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0
@@ -51,11 +52,11 @@ jobs:
5152
steps:
5253
# https://github.com/actions/checkout
5354
- name: Checkout codebase
54-
uses: actions/checkout@v4
55+
uses: actions/checkout@v6
5556

5657
# https://github.com/actions/setup-node
5758
- name: Install Node.js ${{ matrix.node-version }}
58-
uses: actions/setup-node@v4
59+
uses: actions/setup-node@v6
5960
with:
6061
node-version: ${{ matrix.node-version }}
6162

@@ -80,7 +81,7 @@ jobs:
8081
id: yarn-cache-dir-path
8182
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
8283
- name: Cache Yarn dependencies
83-
uses: actions/cache@v4
84+
uses: actions/cache@v5
8485
with:
8586
# Cache entire Yarn cache directory (see previous step)
8687
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -113,7 +114,7 @@ jobs:
113114
# so that it can be shared with the 'codecov' job (see below)
114115
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
115116
- name: Upload code coverage report to Artifact
116-
uses: actions/upload-artifact@v4
117+
uses: actions/upload-artifact@v7
117118
if: matrix.node-version == '18.x'
118119
with:
119120
name: coverage-report-${{ matrix.node-version }}
@@ -122,7 +123,7 @@ jobs:
122123

123124
# Login to our Docker registry, so that we can access private Docker images using "docker compose" below.
124125
- name: Login to ${{ env.DOCKER_REGISTRY }}
125-
uses: docker/login-action@v3
126+
uses: docker/login-action@v4
126127
with:
127128
registry: ${{ env.DOCKER_REGISTRY }}
128129
username: ${{ github.repository_owner }}
@@ -140,7 +141,7 @@ jobs:
140141
# https://github.com/cypress-io/github-action
141142
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
142143
- name: Run e2e tests (integration tests)
143-
uses: cypress-io/github-action@v6
144+
uses: cypress-io/github-action@v7.1.9
144145
with:
145146
# Run tests in Chrome, headless mode (default)
146147
browser: chrome
@@ -155,7 +156,7 @@ jobs:
155156
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
156157
# Save those in an Artifact
157158
- name: Upload e2e test videos to Artifacts
158-
uses: actions/upload-artifact@v4
159+
uses: actions/upload-artifact@v7
159160
if: always()
160161
with:
161162
name: e2e-test-videos-${{ matrix.node-version }}
@@ -164,7 +165,7 @@ jobs:
164165
# If e2e tests fail, Cypress creates a screenshot of what happened
165166
# Save those in an Artifact
166167
- name: Upload e2e test failure screenshots to Artifacts
167-
uses: actions/upload-artifact@v4
168+
uses: actions/upload-artifact@v7
168169
if: failure()
169170
with:
170171
name: e2e-test-screenshots-${{ matrix.node-version }}
@@ -316,19 +317,19 @@ jobs:
316317
runs-on: ubuntu-latest
317318
steps:
318319
- name: Checkout
319-
uses: actions/checkout@v4
320+
uses: actions/checkout@v6
320321

321322
# Download artifacts from previous 'tests' job
322323
- name: Download coverage artifacts
323-
uses: actions/download-artifact@v4
324+
uses: actions/download-artifact@v8
324325

325326
# Now attempt upload to Codecov using its action.
326327
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
327328
#
328329
# Retry action: https://github.com/marketplace/actions/retry-action
329330
# Codecov action: https://github.com/codecov/codecov-action
330331
- name: Upload coverage to Codecov.io
331-
uses: Wandalen/wretry.action@v1.3.0
332+
uses: Wandalen/wretry.action@v3.8.0
332333
with:
333334
action: codecov/codecov-action@v4
334335
# Ensure codecov-action throws an error when it fails to upload

.github/workflows/codescan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ jobs:
3535
steps:
3636
# https://github.com/actions/checkout
3737
- name: Checkout repository
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v6
3939

4040
# Initializes the CodeQL tools for scanning.
4141
# https://github.com/github/codeql-action
4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v3
43+
uses: github/codeql-action/init@v4
4444
with:
4545
languages: javascript
4646

4747
# Autobuild attempts to build any compiled languages
4848
- name: Autobuild
49-
uses: github/codeql-action/autobuild@v3
49+
uses: github/codeql-action/autobuild@v4
5050

5151
# Perform GitHub Code Scanning.
5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v3
53+
uses: github/codeql-action/analyze@v4

.github/workflows/docker.yml

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,123 @@ jobs:
5757
# Enable redeploy of sandbox & demo if the branch for this image matches the deployment branch of
5858
# these sites as specified in reusable-docker-build.xml
5959
REDEPLOY_SANDBOX_URL: ${{ secrets.REDEPLOY_SANDBOX_URL }}
60-
REDEPLOY_DEMO_URL: ${{ secrets.REDEPLOY_DEMO_URL }}
60+
REDEPLOY_DEMO_URL: ${{ secrets.REDEPLOY_DEMO_URL }}
61+
62+
#################################################################################
63+
# Test Deployment via Docker to ensure newly built images are working properly
64+
#################################################################################
65+
docker-deploy:
66+
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
67+
if: github.repository == 'dspace/dspace-angular'
68+
runs-on: ubuntu-latest
69+
# Must run after all major images are built
70+
needs: [dspace-angular, dspace-angular-dist]
71+
env:
72+
# Override default dspace.server.url & REST 'host' because backend starts at http://127.0.0.1:8080
73+
dspace__P__server__P__url: http://127.0.0.1:8080/server
74+
DSPACE_REST_HOST: 127.0.0.1
75+
# Override default dspace.ui.url to also use 127.0.0.1.
76+
dspace__P__ui__P__url: http://127.0.0.1:4000
77+
# Override default ui.baseUrl to also use 127.0.0.1. This should match 'dspace.ui.url'.
78+
DSPACE_UI_BASEURL: http://127.0.0.1:4000
79+
steps:
80+
# Checkout our codebase (to get access to Docker Compose scripts)
81+
- name: Checkout codebase
82+
uses: actions/checkout@v6
83+
# Download Docker image artifacts (which were just built by reusable-docker-build.yml)
84+
- name: Download Docker image artifacts
85+
uses: actions/download-artifact@v8
86+
with:
87+
# Download all amd64 Docker images (TAR files) into the /tmp/docker directory
88+
pattern: docker-image-*-linux-amd64
89+
path: /tmp/docker
90+
merge-multiple: true
91+
# Load each of the images into Docker by calling "docker image load" for each.
92+
# This ensures we are using the images just built & not any prior versions on DockerHub
93+
- name: Load all downloaded Docker images
94+
run: |
95+
find /tmp/docker -type f -name "*.tar" -exec docker image load --input "{}" \;
96+
docker image ls -a
97+
# Start backend using our compose script in the codebase.
98+
- name: Start backend in Docker
99+
# MUST use docker.io as we don't have a copy of this backend image in our GitHub Action,
100+
# and docker.io is the only public image. If we ever hit aggressive rate limits at DockerHub,
101+
# we may need to consider making the 'ghcr.io' images public & switch this to 'ghcr.io'
102+
env:
103+
DOCKER_REGISTRY: docker.io
104+
run: |
105+
docker compose -f docker/docker-compose-rest.yml up -d
106+
sleep 10
107+
docker container ls
108+
# Create a test admin account. Load test data from a simple set of AIPs as defined in cli.ingest.yml
109+
# NOTE: Before creating test data, we wait for the backend to become responsive by requesting it every 10 sec.
110+
# Timeout after 5 minutes. This is done to ensure the backend is fully initialized before we create test data.
111+
- name: Load test data into Backend
112+
run: |
113+
timeout 5m wget --retry-connrefused -t 0 --waitretry=10 http://127.0.0.1:8080/server/api
114+
docker compose -f docker/cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en
115+
docker compose -f docker/cli.yml -f docker/cli.ingest.yml run --rm dspace-cli
116+
# Verify backend started successfully.
117+
# 1. Make sure root endpoint is responding (check for dspace.name defined in docker-compose.yml)
118+
# 2. Also check /collections endpoint to ensure the test data loaded properly (check for a collection name in AIPs)
119+
- name: Verify backend is responding properly
120+
run: |
121+
result=$(wget -O- -q http://127.0.0.1:8080/server/api)
122+
echo "$result"
123+
echo "$result" | grep -oE "\"DSpace Started with Docker Compose\""
124+
result=$(wget -O- -q http://127.0.0.1:8080/server/api/core/collections)
125+
echo "$result"
126+
echo "$result" | grep -oE "\"Dog in Yard\""
127+
# Start production frontend using our compose script in the codebase.
128+
- name: Start production frontend in Docker
129+
# Specify the GHCR copy of the production frontend, so that we use the newly built image
130+
env:
131+
DOCKER_REGISTRY: ghcr.io
132+
run: |
133+
docker compose -f docker/docker-compose-dist.yml up -d
134+
sleep 10
135+
docker container ls
136+
# Verify production frontend started successfully.
137+
# 1. Make sure /home path has "DSpace software" (this is in the footer of the page)
138+
# 2. Also check /community-list page lists one of the test Communities in the loaded test data
139+
- name: Verify production frontend is responding properly
140+
run: |
141+
result=$(wget -O- -q http://127.0.0.1:4000/home)
142+
echo "$result"
143+
echo "$result" | grep -oE "\"DSpace software\""
144+
- name: Error logs of production frontend (if error in startup)
145+
if: ${{ failure() }}
146+
run: |
147+
docker compose -f docker/docker-compose-dist.yml logs
148+
# Now shutdown the production frontend image and startup the development frontend image
149+
- name: Shutdown production frontend
150+
run: |
151+
docker compose -f docker/docker-compose-dist.yml down
152+
sleep 10
153+
docker container ls
154+
- name: Startup development frontend
155+
# Specify the GHCR copy of the development frontend, so that we use the newly built image
156+
env:
157+
DOCKER_REGISTRY: ghcr.io
158+
run: |
159+
docker compose -f docker/docker-compose.yml up -d
160+
sleep 10
161+
docker container ls
162+
# Verify development frontend started successfully.
163+
# 1. First, keep requesting the frontend every 10 seconds to wait until its up. Timeout after 10 minutes.
164+
# 2. Once it's responding, check to see if the word "DSpace" appears.
165+
# We cannot check for anything more specific because development mode doesn't have SSR.
166+
- name: Verify development frontend is responding properly
167+
run: |
168+
timeout 10m wget --retry-connrefused -t 0 --waitretry=10 http://127.0.0.1:4000
169+
result=$(wget -O- -q http://127.0.0.1:4000)
170+
echo "$result"
171+
echo "$result" | grep -oE "DSpace"
172+
- name: Error logs of development frontend (if error in startup)
173+
if: ${{ failure() }}
174+
run: |
175+
docker compose -f docker/docker-compose.yml logs
176+
# Shutdown our containers
177+
- name: Shutdown running Docker containers
178+
run: |
179+
docker compose -f docker/docker-compose.yml -f docker/docker-compose-rest.yml down

.github/workflows/issue_opened.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
# Only add to project board if issue is flagged as "needs triage" or has no labels
1717
# NOTE: By default we flag new issues as "needs triage" in our issue template
1818
if: (contains(github.event.issue.labels.*.name, 'needs triage') || join(github.event.issue.labels.*.name) == '')
19-
uses: actions/add-to-project@v1.0.0
19+
uses: actions/add-to-project@v1.0.2
2020
# Note, the authentication token below is an ORG level Secret.
2121
# It must be created/recreated manually via a personal access token with admin:org, project, public_repo permissions
2222
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token

.github/workflows/port_merged_pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
if: github.event.pull_request.merged
2424
steps:
2525
# Checkout code
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
2727
# Port PR to other branch (ONLY if labeled with "port to")
2828
# See https://github.com/korthout/backport-action
2929
- name: Create backport pull requests
30-
uses: korthout/backport-action@v2
30+
uses: korthout/backport-action@v4
3131
with:
3232
# Trigger based on a "port to [branch]" label on PR
3333
# (This label must specify the branch name to port to)

.github/workflows/pull_request_opened.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
# Assign the PR to whomever created it. This is useful for visualizing assignments on project boards
2222
# See https://github.com/toshimaru/auto-author-assign
2323
- name: Assign PR to creator
24-
uses: toshimaru/auto-author-assign@v2.1.0
24+
uses: toshimaru/auto-author-assign@v3.0.1

Dockerfile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
# This image will be published as dspace/dspace-angular
22
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
33

4-
FROM docker.io/node:18-alpine
4+
FROM docker.io/node:22-alpine
55

66
# Ensure Python and other build tools are available
77
# These are needed to install some node modules, especially on linux/arm64
88
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
99

1010
WORKDIR /app
11-
ADD . /app/
12-
EXPOSE 4000
11+
12+
# Copy over package files first, so this layer will only be rebuilt if those files change.
13+
COPY package.json yarn.lock ./
1314

1415
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
1516
# See, for example https://github.com/yarnpkg/yarn/issues/5540
1617
RUN yarn install --network-timeout 300000
1718

19+
# Add the rest of the source code
20+
COPY . /app/
21+
1822
# When running in dev mode, 4GB of memory is required to build & launch the app.
1923
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
2024
# See Docker environment var precedence: https://docs.docker.com/compose/environment-variables/envvars-precedence/
2125
ENV NODE_OPTIONS="--max_old_space_size=4096"
2226

2327
# On startup, run in DEVELOPMENT mode (this defaults to live reloading enabled, etc).
24-
# Listen / accept connections from all IP addresses.
25-
# NOTE: At this time it is only possible to run Docker container in Production mode
26-
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
2728
ENV NODE_ENV=development
28-
CMD yarn serve --host 0.0.0.0
29+
30+
EXPOSE 4000
31+
32+
# On startup, run this command to start application in dev mode
33+
ENTRYPOINT [ "yarn", "serve" ]
34+
# By default set host to 0.0.0.0 to listen/accept connections from all IP addresses.
35+
# Poll for changes every 5 seconds (if any detected, app will rebuild/restart)
36+
CMD ["--host 0.0.0.0", "--poll 5000"]

Dockerfile.dist

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,46 @@
44
# Test build:
55
# docker build -f Dockerfile.dist -t dspace/dspace-angular:dspace-8_x-dist .
66

7-
FROM docker.io/node:18-alpine AS build
7+
# Step 1 - Build code for production
8+
FROM docker.io/node:22-alpine AS build
89

910
# Ensure Python and other build tools are available
1011
# These are needed to install some node modules, especially on linux/arm64
1112
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
1213

1314
WORKDIR /app
15+
16+
# Copy over package files first, so this layer will only be rebuilt if those files change.
1417
COPY package.json yarn.lock ./
1518
RUN yarn install --network-timeout 300000
1619

17-
ADD . /app/
20+
# Around 4GB of memory is required to build the app for production.
21+
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
22+
# See Docker environment var precedence: https://docs.docker.com/compose/environment-variables/envvars-precedence/
23+
ENV NODE_OPTIONS="--max_old_space_size=4096"
24+
25+
COPY . /app/
1826
RUN yarn build:prod
1927

20-
FROM node:18-alpine
28+
# Step 2 - Start up UI via PM2
29+
FROM docker.io/node:22-alpine
30+
31+
# Install PM2
2132
RUN npm install --global pm2
2233

34+
# Copy pre-built code from build image
2335
COPY --chown=node:node --from=build /app/dist /app/dist
36+
# Copy configs and PM2 startup script from local machine
2437
COPY --chown=node:node config /app/config
2538
COPY --chown=node:node docker/dspace-ui.json /app/dspace-ui.json
2639

40+
# Start up UI in PM2 in production mode
2741
WORKDIR /app
2842
USER node
2943
ENV NODE_ENV=production
3044
EXPOSE 4000
31-
CMD pm2-runtime start dspace-ui.json --json
45+
46+
# On startup, run start the DSpace UI in PM2
47+
ENTRYPOINT [ "pm2-runtime", "start", "dspace-ui.json" ]
48+
# By default, pass param that specifies to use JSON format logs.
49+
CMD ["--json"]

0 commit comments

Comments
 (0)