Skip to content

Commit fa79c1e

Browse files
author
Andrea Barbasso
committed
Merge branch 'main' into task/main/CST-16756_squashed
# Conflicts: # src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts # src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.spec.ts # src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts
2 parents 0ebf6bc + df6cb45 commit fa79c1e

File tree

94 files changed

+714
-298
lines changed

Some content is hidden

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

94 files changed

+714
-298
lines changed

.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 [email protected] -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

.github/workflows/stale.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# DSpace rules for flagging untouched issues and PRs as stale using 'stale':
2+
# https://github.com/actions/stale
3+
name: 'Mark issues and PRs as stale'
4+
on:
5+
# Schedule to run weekly on Sunday at 3:03am UTC
6+
# NOTE: This time is purposefully different from the "stale" bot settings in "DSpace/DSpace" to help
7+
# ensure we don't hit GitHub's rate limits.
8+
schedule:
9+
- cron: '3 3 * * 0'
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
jobs:
16+
stale:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/stale@v10
20+
with:
21+
# Number of GitHub API calls to allow in a single run (to avoid hitting GitHub's rate limit)
22+
# Default is 30. But, we've found that only results in processing ~7 issues or PRs. So, we've increased it.
23+
operations-per-run: 60
24+
# Issues will be marked stale after 3 years of no activity
25+
days-before-issue-stale: 1095
26+
# Issues marked stale will be closed after one additional week of no activity
27+
days-before-issue-close: 7
28+
# High priority issues are never marked stale
29+
exempt-issue-labels: 'high priority'
30+
# When an issue is marked stale, this label and comment will be added to the issue.
31+
stale-issue-label: stale
32+
stale-issue-message: |
33+
This issue has been automatically marked as stale because it has not had
34+
activity in 3 years. It will be closed in 7 days if no further activity occurs.
35+
36+
Allowing issues to close as stale helps us filter out issues which can wait
37+
for future development time. All issues closed by this bot will continue to act
38+
like normal issues; they can be searched for, commented on or reopened at any point.
39+
40+
To extend the lifetime of an issue please comment below. This will help us to see
41+
that this issue is still affecting you with current versions of DSpace, and encourage
42+
us to re-prioritize this issue.
43+
# When an issue is closed, this comment will be added to the issue.
44+
close-issue-message: |
45+
This issue has been closed automatically as "stale". If this still affects you please
46+
request to re-open this issue via a comment, providing us with details on how this still
47+
impacts your usage of DSpace.
48+
# PRs will be marked stale after 1 year of no activity
49+
days-before-pr-stale: 365
50+
# PRs marked stale will be closed after two additional weeks of no activity
51+
days-before-pr-close: 14
52+
# High priority PRs are never marked stale
53+
exempt-pr-labels: 'high priority'
54+
# When a PR is marked stale, this label and comment will be added to the issue.
55+
stale-pr-label: stale
56+
stale-pr-message: |
57+
This pull request has been automatically marked as stale because it has not had
58+
activity in one year. It will be closed in 14 days if no further activity occurs.
59+
60+
Allowing pull requests to close as stale helps us filter out old work that is no longer
61+
relevant and helps developers focus on reviewing current work.
62+
63+
All pull requests closed by this bot act like normal pull requests;
64+
they can be searched for, commented on or reopened at any point.
65+
66+
If these changes are still relevant then please comment and/or rebase your PR based on the
67+
latest DSpace code. This will remove the stale status and notify us to assign a reviewer
68+
for your PR.
69+
close-pr-message: |
70+
This pull request has been closed automatically. If these changes are still relevant
71+
then please re-open this pull request with a comment and rebase your PR based on the latest
72+
DSpace code. This will notify us to assign a reviewer to your PR.

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:20-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:20-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:20-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"]

docker/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ the Docker compose scripts in this 'docker' folder.
2020

2121
### Dockerfile
2222

23-
This Dockerfile is used to build a *development* DSpace Angular UI image, published as 'dspace/dspace-angular'
23+
This Dockerfile is used to build a *development* mode DSpace Angular UI image, published as 'dspace/dspace-angular'. Because it uses development mode, this image supports "live reloading" of the user interface
24+
when local source code is modified.
2425

2526
```
2627
docker build -t dspace/dspace-angular:latest .
@@ -35,7 +36,7 @@ docker push dspace/dspace-angular:latest
3536

3637
### Dockerfile.dist
3738

38-
The `Dockerfile.dist` is used to generate a *production* build and runtime environment.
39+
The `Dockerfile.dist` is used to build a *production* mode DSpace Angular UI image, published as 'dspace/dspace-angular' with a `*-dist` tag. Because it uses production mode, this image supports Server Side Rendering (SSR).
3940

4041
```bash
4142
# build the latest image

docker/cli.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ networks:
1616
# Default to using network named 'dspacenet' from docker-compose-rest.yml.
1717
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
1818
# If COMPOSITE_PROJECT_NAME is missing, default value will be "docker" (name of folder this file is in)
19-
default:
19+
dspacenet:
2020
name: ${COMPOSE_PROJECT_NAME:-docker}_dspacenet
2121
external: true
2222
services:
@@ -28,19 +28,15 @@ services:
2828
# See https://github.com/DSpace/DSpace/blob/main/dspace/config/config-definition.xml
2929
# __P__ => "." (e.g. dspace__P__dir => dspace.dir)
3030
# __D__ => "-" (e.g. google__D__metadata => google-metadata)
31-
# dspace.dir
32-
dspace__P__dir: /dspace
3331
# db.url: Ensure we are using the 'dspacedb' image for our database
3432
db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace'
3533
# solr.server: Ensure we are using the 'dspacesolr' image for Solr
3634
solr__P__server: http://dspacesolr:8983/solr
35+
networks:
36+
- dspacenet
3737
volumes:
3838
# Keep DSpace assetstore directory between reboots
3939
- assetstore:/dspace/assetstore
40-
entrypoint: /dspace/bin/dspace
41-
command: help
42-
tty: true
43-
stdin_open: true
4440

4541
volumes:
4642
assetstore:

docker/db.entities.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ services:
3434
- |
3535
while (!</dev/tcp/dspacedb/5432) > /dev/null 2>&1; do sleep 1; done;
3636
/dspace/bin/dspace database migrate ignored
37-
java -jar /dspace/webapps/server-boot.jar --dspace.dir=/dspace
37+
java -jar /dspace/webapps/server-boot.jar

docker/docker-compose-ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ services:
4141
ports:
4242
- published: 8080
4343
target: 8080
44-
stdin_open: true
45-
tty: true
4644
volumes:
4745
- assetstore:/dspace/assetstore
4846
# Ensure that the database is ready BEFORE starting tomcat
@@ -75,8 +73,6 @@ services:
7573
ports:
7674
- published: 5432
7775
target: 5432
78-
stdin_open: true
79-
tty: true
8076
volumes:
8177
# Keep Postgres data directory between reboots
8278
- pgdata:/pgdata
@@ -89,8 +85,6 @@ services:
8985
ports:
9086
- published: 8983
9187
target: 8983
92-
stdin_open: true
93-
tty: true
9488
working_dir: /var/solr/data
9589
volumes:
9690
# Keep Solr data directory between reboots
@@ -116,6 +110,8 @@ services:
116110
cp -r /opt/solr/server/solr/configsets/qaevent/* qaevent
117111
precreate-core suggestion /opt/solr/server/solr/configsets/suggestion
118112
cp -r /opt/solr/server/solr/configsets/suggestion/* suggestion
113+
precreate-core audit /opt/solr/server/solr/configsets/audit
114+
cp -r /opt/solr/server/solr/configsets/audit/* audit
119115
chown -R solr:solr /var/solr
120116
runuser -u solr -- solr-foreground
121117
volumes:

0 commit comments

Comments
 (0)