Skip to content

Commit 6152b30

Browse files
Merge branch 'main' into w2p-101108_Angular-15-upgrade
2 parents 051b17e + 4847fc6 commit 6152b30

78 files changed

Lines changed: 29416 additions & 29264 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.

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ trim_trailing_whitespace = false
1515

1616
[*.ts]
1717
quote_type = single
18+
19+
[*.json5]
20+
ij_json_keep_blank_lines_in_code = 3

.eslintrc.json

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"eslint-plugin-jsdoc",
88
"eslint-plugin-deprecation",
99
"unused-imports",
10-
"eslint-plugin-lodash"
10+
"eslint-plugin-lodash",
11+
"eslint-plugin-jsonc"
1112
],
1213
"overrides": [
1314
{
@@ -224,6 +225,42 @@
224225
"@angular-eslint/template/no-negated-async": "off",
225226
"@angular-eslint/template/eqeqeq": "off"
226227
}
228+
},
229+
{
230+
"files": [
231+
"*.json5"
232+
],
233+
"extends": [
234+
"plugin:jsonc/recommended-with-jsonc"
235+
],
236+
"rules": {
237+
"no-irregular-whitespace": "error",
238+
"no-trailing-spaces": "error",
239+
"jsonc/comma-dangle": [
240+
"error",
241+
"always-multiline"
242+
],
243+
"jsonc/indent": [
244+
"error",
245+
2
246+
],
247+
"jsonc/key-spacing": [
248+
"error",
249+
{
250+
"beforeColon": false,
251+
"afterColon": true,
252+
"mode": "strict"
253+
}
254+
],
255+
"jsonc/no-dupe-keys": "off",
256+
"jsonc/quotes": [
257+
"error",
258+
"double",
259+
{
260+
"avoidEscape": false
261+
}
262+
]
263+
}
227264
}
228265
]
229266
}

.github/workflows/build.yml

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
# https://github.com/actions/cache/blob/main/examples.md#node---yarn
6969
- name: Get Yarn cache directory
7070
id: yarn-cache-dir-path
71-
run: echo "::set-output name=dir::$(yarn cache dir)"
71+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
7272
- name: Cache Yarn dependencies
7373
uses: actions/cache@v3
7474
with:
@@ -93,12 +93,16 @@ jobs:
9393
- name: Run specs (unit tests)
9494
run: yarn run test:headless
9595

96+
# Upload code coverage report to artifact (for one version of Node only),
97+
# so that it can be shared with the 'codecov' job (see below)
9698
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
97-
# Upload coverage reports to Codecov (for one version of Node only)
98-
# https://github.com/codecov/codecov-action
99-
- name: Upload coverage to Codecov.io
100-
uses: codecov/codecov-action@v3
101-
if: matrix.node-version == '16.x'
99+
- name: Upload code coverage report to Artifact
100+
uses: actions/upload-artifact@v3
101+
if: matrix.node-version == '18.x'
102+
with:
103+
name: dspace-angular coverage report
104+
path: 'coverage/dspace-angular/lcov.info'
105+
retention-days: 14
102106

103107
# Using docker-compose start backend using CI configuration
104108
# and load assetstore from a cached copy
@@ -112,11 +116,10 @@ jobs:
112116
# https://github.com/cypress-io/github-action
113117
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
114118
- name: Run e2e tests (integration tests)
115-
uses: cypress-io/github-action@v4
119+
uses: cypress-io/github-action@v5
116120
with:
117-
# Run tests in Chrome, headless mode
121+
# Run tests in Chrome, headless mode (default)
118122
browser: chrome
119-
headless: true
120123
# Start app before running tests (will be stopped automatically after tests finish)
121124
start: yarn run serve:ssr
122125
# Wait for backend & frontend to be available
@@ -176,3 +179,32 @@ jobs:
176179

177180
- name: Shutdown Docker containers
178181
run: docker-compose -f ./docker/docker-compose-ci.yml down
182+
183+
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
184+
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
185+
# See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
186+
codecov:
187+
# Must run after 'tests' job above
188+
needs: tests
189+
runs-on: ubuntu-latest
190+
steps:
191+
- name: Checkout
192+
uses: actions/checkout@v3
193+
194+
# Download artifacts from previous 'tests' job
195+
- name: Download coverage artifacts
196+
uses: actions/download-artifact@v3
197+
198+
# Now attempt upload to Codecov using its action.
199+
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
200+
#
201+
# Retry action: https://github.com/marketplace/actions/retry-action
202+
# Codecov action: https://github.com/codecov/codecov-action
203+
- name: Upload coverage to Codecov.io
204+
uses: Wandalen/wretry.action@v1.0.36
205+
with:
206+
action: codecov/codecov-action@v3
207+
# Try upload 5 times max
208+
attempt_limit: 5
209+
# Run again in 30 seconds
210+
attempt_delay: 30000

.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@v0.3.0
19+
uses: actions/add-to-project@v0.5.0
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/label_merge_conflicts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
# See: https://github.com/prince-chrismc/label-merge-conflicts-action
2525
- name: Auto-label PRs with merge conflicts
26-
uses: prince-chrismc/label-merge-conflicts-action@v2
26+
uses: prince-chrismc/label-merge-conflicts-action@v3
2727
# Add "merge conflict" label if a merge conflict is detected. Remove it when resolved.
2828
# Note, the authentication token is created automatically
2929
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

Dockerfile

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

44
FROM node:18-alpine
5-
WORKDIR /app
6-
ADD . /app/
7-
EXPOSE 4000
85

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

10+
WORKDIR /app
11+
ADD . /app/
12+
EXPOSE 4000
13+
1314
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
1415
# See, for example https://github.com/yarnpkg/yarn/issues/5540
1516
RUN yarn install --network-timeout 300000
1617

18+
# When running in dev mode, 4GB of memory is required to build & launch the app.
19+
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
20+
# See Docker environment var precedence: https://docs.docker.com/compose/environment-variables/envvars-precedence/
21+
ENV NODE_OPTIONS="--max_old_space_size=4096"
22+
1723
# On startup, run in DEVELOPMENT mode (this defaults to live reloading enabled, etc).
1824
# Listen / accept connections from all IP addresses.
1925
# NOTE: At this time it is only possible to run Docker container in Production mode
20-
# if you have a public IP. See https://github.com/DSpace/dspace-angular/issues/1485
26+
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
27+
ENV NODE_ENV development
2128
CMD yarn serve --host 0.0.0.0

angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@
266266
"options": {
267267
"lintFilePatterns": [
268268
"src/**/*.ts",
269-
"src/**/*.html"
269+
"src/**/*.html",
270+
"src/**/*.json5"
270271
]
271272
}
272273
}

docker/README.md

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@
66
If you wish to run DSpace on Docker in production, we recommend building your own Docker images. You are welcome to borrow ideas/concepts from the below images in doing so. But, the below images should not be used "as is" in any production scenario.
77
***
88

9-
## 'Dockerfile' in root directory
9+
## Overview
10+
The scripts in this directory can be used to start the DSpace User Interface (frontend) in Docker.
11+
Optionally, the backend (REST API) might also be started in Docker.
12+
13+
For additional options/settings in starting the backend (REST API) in Docker, see the Docker Compose
14+
documentation for the backend: https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/README.md
15+
16+
## Root directory
17+
18+
The root directory of this project contains all the Dockerfiles which may be referenced by
19+
the Docker compose scripts in this 'docker' folder.
20+
21+
### Dockerfile
22+
1023
This Dockerfile is used to build a *development* DSpace 7 Angular UI image, published as 'dspace/dspace-angular'
1124

1225
```
@@ -20,6 +33,8 @@ Admins to our DockerHub repo can manually publish with the following command.
2033
docker push dspace/dspace-angular:dspace-7_x
2134
```
2235

36+
### Dockerfile.dist
37+
2338
The `Dockerfile.dist` is used to generate a *production* build and runtime environment.
2439

2540
```bash
@@ -29,7 +44,7 @@ docker build -f Dockerfile.dist -t dspace/dspace-angular:dspace-7_x-dist .
2944

3045
A default/demo version of this image is built *automatically*.
3146

32-
## docker directory
47+
## 'docker' directory
3348
- docker-compose.yml
3449
- Starts DSpace Angular with Docker Compose from the current branch. This file assumes that a DSpace 7 REST instance will also be started in Docker.
3550
- docker-compose-rest.yml
@@ -54,25 +69,41 @@ docker-compose -f docker/docker-compose.yml build
5469

5570
## To start DSpace (REST and Angular) from your branch
5671

72+
This command provides a quick way to start both the frontend & backend from this single codebase
5773
```
5874
docker-compose -p d7 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
5975
```
6076

77+
Keep in mind, you may also start the backend by cloning the 'DSpace/DSpace' GitHub repository separately. See the next section.
78+
79+
6180
## Run DSpace REST and DSpace Angular from local branches.
81+
82+
This section assumes that you have clones *both* the 'DSpace/DSpace' and 'DSpace/dspace-angular' GitHub
83+
repositories. When both are available locally, you can spin up both in Docker and have them work together.
84+
6285
_The system will be started in 2 steps. Each step shares the same docker network._
6386

64-
From DSpace/DSpace (build as needed)
87+
From 'DSpace/DSpace' clone (build first as needed):
6588
```
6689
docker-compose -p d7 up -d
6790
```
6891

69-
From DSpace/DSpace-angular
92+
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).
93+
94+
From 'DSpace/dspace-angular' clone (build first as needed)
7095
```
7196
docker-compose -p d7 -f docker/docker-compose.yml up -d
7297
```
7398

99+
At this point, you should be able to access the UI from http://localhost:4000,
100+
and the backend at http://localhost:8080/server/
101+
74102
## Run DSpace Angular dist build with DSpace Demo site backend
75103

104+
This allows you to run the Angular UI in *production* mode, pointing it at the demo backend
105+
(https://api7.dspace.org/server/).
106+
76107
```
77108
docker-compose -f docker/docker-compose-dist.yml pull
78109
docker-compose -f docker/docker-compose-dist.yml build
@@ -104,9 +135,10 @@ Load assetstore content and trigger a re-index of the repository
104135
docker-compose -p d7 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
105136
```
106137

107-
## End to end testing of the rest api (runs in travis).
108-
_In this instance, only the REST api runs in Docker using the Entities dataset. Travis will perform CI testing of Angular using Node to drive the tests._
138+
## End to end testing of the REST API (runs in GitHub Actions CI).
139+
_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._
109140

141+
This command is only really useful for testing our Continuous Integration process.
110142
```
111-
docker-compose -p d7ci -f docker/docker-compose-travis.yml up -d
143+
docker-compose -p d7ci -f docker/docker-compose-ci.yml up -d
112144
```

docker/docker-compose-dist.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ services:
1919
DSPACE_UI_HOST: dspace-angular
2020
DSPACE_UI_PORT: '4000'
2121
DSPACE_UI_NAMESPACE: /
22+
# NOTE: When running the UI in production mode (which the -dist image does),
23+
# these DSPACE_REST_* variables MUST point at a public, HTTPS URL.
24+
# This is because Server Side Rendering (SSR) currently requires a public URL,
25+
# see this bug: https://github.com/DSpace/dspace-angular/issues/1485
2226
DSPACE_REST_SSL: 'true'
2327
DSPACE_REST_HOST: api7.dspace.org
2428
DSPACE_REST_PORT: 443

docker/docker-compose-rest.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ services:
3939
# proxies.trusted.ipranges: This setting is required for a REST API running in Docker to trust requests
4040
# from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above.
4141
proxies__P__trusted__P__ipranges: '172.23.0'
42-
image: dspace/dspace:dspace-7_x-test
42+
image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-dspace-7_x-test}"
4343
depends_on:
4444
- dspacedb
4545
networks:
@@ -82,8 +82,7 @@ services:
8282
# DSpace Solr container
8383
dspacesolr:
8484
container_name: dspacesolr
85-
# Uses official Solr image at https://hub.docker.com/_/solr/
86-
image: solr:8.11-slim
85+
image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-dspace-7_x}"
8786
# Needs main 'dspace' container to start first to guarantee access to solr_configs
8887
depends_on:
8988
- dspace
@@ -96,28 +95,26 @@ services:
9695
tty: true
9796
working_dir: /var/solr/data
9897
volumes:
99-
# Mount our "solr_configs" volume available under the Solr's configsets folder (in a 'dspace' subfolder)
100-
# This copies the Solr configs from main 'dspace' container into 'dspacesolr' via that volume
101-
- solr_configs:/opt/solr/server/solr/configsets/dspace
10298
# Keep Solr data directory between reboots
10399
- solr_data:/var/solr/data
104100
# Initialize all DSpace Solr cores using the mounted local configsets (see above), then start Solr
105101
# * First, run precreate-core to create the core (if it doesn't yet exist). If exists already, this is a no-op
106-
# * Second, copy updated configs from mounted configsets to this core. If it already existed, this updates core
107-
# to the latest configs. If it's a newly created core, this is a no-op.
102+
# * Second, copy configsets to this core:
103+
# Updates to Solr configs require the container to be rebuilt/restarted:
104+
# `docker-compose -p d7 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d --build dspacesolr`
108105
entrypoint:
109106
- /bin/bash
110107
- '-c'
111108
- |
112109
init-var-solr
113-
precreate-core authority /opt/solr/server/solr/configsets/dspace/authority
114-
cp -r -u /opt/solr/server/solr/configsets/dspace/authority/* authority
115-
precreate-core oai /opt/solr/server/solr/configsets/dspace/oai
116-
cp -r -u /opt/solr/server/solr/configsets/dspace/oai/* oai
117-
precreate-core search /opt/solr/server/solr/configsets/dspace/search
118-
cp -r -u /opt/solr/server/solr/configsets/dspace/search/* search
119-
precreate-core statistics /opt/solr/server/solr/configsets/dspace/statistics
120-
cp -r -u /opt/solr/server/solr/configsets/dspace/statistics/* statistics
110+
precreate-core authority /opt/solr/server/solr/configsets/authority
111+
cp -r /opt/solr/server/solr/configsets/authority/* authority
112+
precreate-core oai /opt/solr/server/solr/configsets/oai
113+
cp -r /opt/solr/server/solr/configsets/oai/* oai
114+
precreate-core search /opt/solr/server/solr/configsets/search
115+
cp -r /opt/solr/server/solr/configsets/search/* search
116+
precreate-core statistics /opt/solr/server/solr/configsets/statistics
117+
cp -r /opt/solr/server/solr/configsets/statistics/* statistics
121118
exec solr -f
122119
volumes:
123120
assetstore:

0 commit comments

Comments
 (0)