Skip to content

Commit 8bea0ef

Browse files
author
Jens Vannerum
committed
Merge remote-tracking branch 'origin/main' into w2p-122064_browse-pages-ignore-sort-config-fix-UI-main
2 parents 789c614 + 3cfc10e commit 8bea0ef

2,659 files changed

Lines changed: 40954 additions & 37796 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.

.eslintrc.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"@angular-eslint/eslint-plugin",
66
"eslint-plugin-import",
77
"eslint-plugin-jsdoc",
8-
"eslint-plugin-deprecation",
98
"unused-imports",
109
"eslint-plugin-lodash",
1110
"eslint-plugin-jsonc",
12-
"eslint-plugin-rxjs",
11+
"@smarttools/rxjs",
1312
"eslint-plugin-simple-import-sort",
1413
"eslint-plugin-import-newlines",
14+
"@stylistic",
1515
"dspace-angular-ts",
1616
"dspace-angular-html"
1717
],
@@ -37,7 +37,7 @@
3737
"plugin:@typescript-eslint/recommended-requiring-type-checking",
3838
"plugin:@angular-eslint/recommended",
3939
"plugin:@angular-eslint/template/process-inline-templates",
40-
"plugin:rxjs/recommended"
40+
"plugin:@smarttools/rxjs/recommended-legacy"
4141
],
4242
"rules": {
4343
"indent": [
@@ -175,15 +175,16 @@
175175
"ignoreParameters": true
176176
}
177177
],
178-
"@typescript-eslint/quotes": [
178+
"@angular-eslint/prefer-inject": "off",
179+
"@stylistic/quotes": [
179180
"error",
180181
"single",
181182
{
182183
"avoidEscape": true,
183184
"allowTemplateLiterals": true
184185
}
185186
],
186-
"@typescript-eslint/semi": "error",
187+
"@stylistic/semi": "error",
187188
"@typescript-eslint/no-shadow": "error",
188189
"@typescript-eslint/dot-notation": "error",
189190
"@typescript-eslint/consistent-type-definitions": "error",
@@ -206,9 +207,9 @@
206207
]
207208
}
208209
],
209-
"@typescript-eslint/type-annotation-spacing": "error",
210+
"@stylistic/type-annotation-spacing": "error",
210211
"@typescript-eslint/unified-signatures": "error",
211-
"@typescript-eslint/ban-types": "error",
212+
"@typescript-eslint/no-restricted-types": "error",
212213
"@typescript-eslint/no-floating-promises": "warn",
213214
"@typescript-eslint/no-misused-promises": "warn",
214215
"@typescript-eslint/restrict-plus-operands": "warn",
@@ -223,6 +224,7 @@
223224
"@typescript-eslint/no-unsafe-call": "off",
224225
"@typescript-eslint/no-unsafe-argument": "off",
225226
"@typescript-eslint/no-unsafe-return": "off",
227+
"@typescript-eslint/no-redundant-type-constituents": "off",
226228
"@typescript-eslint/restrict-template-expressions": "off",
227229
"@typescript-eslint/require-await": "off",
228230
"@typescript-eslint/no-base-to-string": [
@@ -235,7 +237,7 @@
235237
}
236238
],
237239

238-
"deprecation/deprecation": "warn",
240+
"@typescript-eslint/no-deprecated": "warn",
239241

240242
"simple-import-sort/imports": "error",
241243
"simple-import-sort/exports": "error",
@@ -264,7 +266,7 @@
264266
"method"
265267
],
266268

267-
"rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases
269+
"@smarttools/rxjs/no-nested-subscribe": "off", // todo: go over _all_ cases
268270

269271
// Custom DSpace Angular rules
270272
"dspace-angular-ts/alias-imports": [
@@ -279,7 +281,7 @@
279281
]
280282
}
281283
],
282-
"dspace-angular-ts/themed-component-classes": "error",
284+
"dspace-angular-ts/no-default-standalone-value": "error",
283285
"dspace-angular-ts/themed-component-selectors": "error",
284286
"dspace-angular-ts/themed-component-usages": "error",
285287
"dspace-angular-ts/themed-decorators": [

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ updates:
1515
schedule:
1616
interval: "monthly"
1717
time: "05:00"
18+
# Allow updates to be delayed for a configurable number of days to mitigate
19+
# some classes of supply chain attacks
20+
cooldown:
21+
default-days: 7
1822
# Allow up to 10 open PRs for dependencies
1923
open-pull-requests-limit: 10
2024
# Group together Angular package upgrades
@@ -101,6 +105,10 @@ updates:
101105
schedule:
102106
interval: "monthly"
103107
time: "05:00"
108+
# Allow updates to be delayed for a configurable number of days to mitigate
109+
# some classes of supply chain attacks
110+
cooldown:
111+
default-days: 7
104112
# Allow up to 10 open PRs for dependencies
105113
open-pull-requests-limit: 10
106114
# Group together Angular package upgrades
@@ -188,6 +196,10 @@ updates:
188196
schedule:
189197
interval: "monthly"
190198
time: "05:00"
199+
# Allow updates to be delayed for a configurable number of days to mitigate
200+
# some classes of supply chain attacks
201+
cooldown:
202+
default-days: 7
191203
# Allow up to 10 open PRs for dependencies
192204
open-pull-requests-limit: 10
193205
# Group together Angular package upgrades
@@ -274,6 +286,10 @@ updates:
274286
schedule:
275287
interval: "monthly"
276288
time: "05:00"
289+
# Allow updates to be delayed for a configurable number of days to mitigate
290+
# some classes of supply chain attacks
291+
cooldown:
292+
default-days: 7
277293
# Allow up to 10 open PRs for dependencies
278294
open-pull-requests-limit: 10
279295
# Group together Angular package upgrades

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
DSPACE_REST_PORT: 8080
2222
DSPACE_REST_NAMESPACE: '/server'
2323
DSPACE_REST_SSL: false
24-
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 18+
24+
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 20+
2525
DSPACE_UI_HOST: 127.0.0.1
2626
DSPACE_UI_PORT: 4000
2727
# Ensure all SSR caching is disabled in test environment
@@ -44,7 +44,7 @@ jobs:
4444
strategy:
4545
# Create a matrix of Node versions to test against (in parallel)
4646
matrix:
47-
node-version: [18.x, 20.x]
47+
node-version: [20.x, 22.x]
4848
# Do NOT exit immediately if one matrix job fails
4949
fail-fast: false
5050
# These are the actual CI steps to perform per job
@@ -114,7 +114,7 @@ jobs:
114114
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
115115
- name: Upload code coverage report to Artifact
116116
uses: actions/upload-artifact@v4
117-
if: matrix.node-version == '18.x'
117+
if: matrix.node-version == '20.x'
118118
with:
119119
name: coverage-report-${{ matrix.node-version }}
120120
path: 'coverage/dspace-angular/lcov.info'

.github/workflows/docker.yml

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,118 @@ 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+
steps:
78+
# Checkout our codebase (to get access to Docker Compose scripts)
79+
- name: Checkout codebase
80+
uses: actions/checkout@v4
81+
# Download Docker image artifacts (which were just built by reusable-docker-build.yml)
82+
- name: Download Docker image artifacts
83+
uses: actions/download-artifact@v4
84+
with:
85+
# Download all amd64 Docker images (TAR files) into the /tmp/docker directory
86+
pattern: docker-image-*-linux-amd64
87+
path: /tmp/docker
88+
merge-multiple: true
89+
# Load each of the images into Docker by calling "docker image load" for each.
90+
# This ensures we are using the images just built & not any prior versions on DockerHub
91+
- name: Load all downloaded Docker images
92+
run: |
93+
find /tmp/docker -type f -name "*.tar" -exec docker image load --input "{}" \;
94+
docker image ls -a
95+
# Start backend using our compose script in the codebase.
96+
- name: Start backend in Docker
97+
# MUST use docker.io as we don't have a copy of this backend image in our GitHub Action,
98+
# and docker.io is the only public image. If we ever hit aggressive rate limits at DockerHub,
99+
# we may need to consider making the 'ghcr.io' images public & switch this to 'ghcr.io'
100+
env:
101+
DOCKER_REGISTRY: docker.io
102+
run: |
103+
docker compose -f docker/docker-compose-rest.yml up -d
104+
sleep 10
105+
docker container ls
106+
# Create a test admin account. Load test data from a simple set of AIPs as defined in cli.ingest.yml
107+
- name: Load test data into Backend
108+
run: |
109+
docker compose -f docker/cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en
110+
docker compose -f docker/cli.yml -f docker/cli.ingest.yml run --rm dspace-cli
111+
# Verify backend started successfully.
112+
# 1. Make sure root endpoint is responding (check for dspace.name defined in docker-compose.yml)
113+
# 2. Also check /collections endpoint to ensure the test data loaded properly (check for a collection name in AIPs)
114+
- name: Verify backend is responding properly
115+
run: |
116+
result=$(wget -O- -q http://127.0.0.1:8080/server/api)
117+
echo "$result"
118+
echo "$result" | grep -oE "\"DSpace Started with Docker Compose\""
119+
result=$(wget -O- -q http://127.0.0.1:8080/server/api/core/collections)
120+
echo "$result"
121+
echo "$result" | grep -oE "\"Dog in Yard\""
122+
# Start production frontend using our compose script in the codebase.
123+
- name: Start production frontend in Docker
124+
# Specify the GHCR copy of the production frontend, so that we use the newly built image
125+
env:
126+
DOCKER_REGISTRY: ghcr.io
127+
run: |
128+
docker compose -f docker/docker-compose-dist.yml up -d
129+
sleep 10
130+
docker container ls
131+
# Verify production frontend started successfully.
132+
# 1. Make sure /home path has "DSpace software" (this is in the footer of the page)
133+
# 2. Also check /community-list page lists one of the test Communities in the loaded test data
134+
- name: Verify production frontend is responding properly
135+
run: |
136+
result=$(wget -O- -q http://127.0.0.1:4000/home)
137+
echo "$result"
138+
echo "$result" | grep -oE "\"DSpace software\""
139+
- name: Error logs of production frontend (if error in startup)
140+
if: ${{ failure() }}
141+
run: |
142+
docker compose -f docker/docker-compose-dist.yml logs
143+
# Now shutdown the production frontend image and startup the development frontend image
144+
- name: Shutdown production frontend
145+
run: |
146+
docker compose -f docker/docker-compose-dist.yml down
147+
sleep 10
148+
docker container ls
149+
- name: Startup development frontend
150+
# Specify the GHCR copy of the development frontend, so that we use the newly built image
151+
env:
152+
DOCKER_REGISTRY: ghcr.io
153+
run: |
154+
docker compose -f docker/docker-compose.yml up -d
155+
sleep 10
156+
docker container ls
157+
# Verify development frontend started successfully.
158+
# 1. First, keep requesting the frontend every 10 seconds to wait until its up. Timeout after 10 minutes.
159+
# 2. Once it's responding, check to see if the word "DSpace" appears.
160+
# We cannot check for anything more specific because development mode doesn't have SSR.
161+
- name: Verify development frontend is responding properly
162+
run: |
163+
timeout 10m wget --retry-connrefused -t 0 --waitretry=10 http://127.0.0.1:4000
164+
result=$(wget -O- -q http://127.0.0.1:4000)
165+
echo "$result"
166+
echo "$result" | grep -oE "DSpace"
167+
- name: Error logs of development frontend (if error in startup)
168+
if: ${{ failure() }}
169+
run: |
170+
docker compose -f docker/docker-compose.yml logs
171+
# Shutdown our containers
172+
- name: Shutdown running Docker containers
173+
run: |
174+
docker compose -f docker/docker-compose.yml -f docker/docker-compose-rest.yml down

Dockerfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
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
1311

14-
RUN npm install
12+
# Copy over package files first, so this layer will only be rebuilt if those files change.
13+
COPY package.json package-lock.json ./
14+
# NOTE: "ci" = clean install from package files
15+
RUN npm ci
16+
17+
# Add the rest of the source code
18+
COPY . /app/
1519

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

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

Dockerfile.dist

Lines changed: 23 additions & 5 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:latest-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+
# Copy over package files first, so this layer will only be rebuilt if those files change.
1416
COPY package.json package-lock.json ./
15-
RUN npm install
17+
# NOTE: "ci" = clean install from package files
18+
RUN npm ci
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 npm run 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)