@researchdatabox/redbox-dev-tools 0.0.1-beta.9950 → 5.0.0-RC1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -3
- package/bin/wrapper-webpack.js +31 -12
- package/dist/cli.js +6 -2
- package/dist/commands/form-config.js +8 -11
- package/dist/commands/sync-translation.d.ts +23 -0
- package/dist/commands/sync-translation.js +348 -0
- package/dist/templates/hook-archetype.js +4 -3
- package/package.json +4 -4
- package/templates/hook-archetype/standard/.gitignore.hbs +1 -0
- package/templates/hook-archetype/standard/.npmignore.hbs +2 -1
- package/templates/hook-archetype/standard/AGENTS.md.hbs +18 -1
- package/templates/hook-archetype/standard/Dockerfile.hbs +12 -11
- package/templates/hook-archetype/standard/README.md.hbs +28 -10
- package/templates/hook-archetype/standard/assets/default/.gitkeep +1 -0
- package/templates/hook-archetype/standard/assets/images/.gitkeep +1 -0
- package/templates/hook-archetype/standard/assets/styles/.gitkeep +1 -0
- package/templates/hook-archetype/standard/language-defaults/README.md.hbs +10 -0
- package/templates/hook-archetype/standard/language-defaults/en/translation.json.hbs +3 -0
- package/templates/hook-archetype/standard/language-defaults/meta.json.hbs +6 -0
- package/templates/hook-archetype/standard/package.json.hbs +10 -6
- package/templates/hook-archetype/standard/src/index.ts.hbs +11 -11
- package/templates/hook-archetype/standard/src/migrations/index.ts.hbs +19 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/namedqueries/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/records/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/reports/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/vocabularies/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/development/core-mount.env.hbs +3 -0
- package/templates/hook-archetype/standard/support/development/docker-compose.core-mount.yml.hbs +37 -0
- package/templates/hook-archetype/standard/support/development/docker-compose.yml.hbs +53 -20
- package/templates/hook-archetype/standard/support/development/prepare-core-mount.sh.hbs +61 -0
- package/templates/hook-archetype/standard/support/integration-testing/docker-compose.mocha.yml.hbs +45 -11
- package/templates/hook-archetype/standard/support/integration-testing/run-mocha-hook.sh.hbs +5 -0
- package/templates/hook-archetype/standard/support/integration-testing/run-mocha-redbox.sh.hbs +100 -0
- package/templates/hook-archetype/standard/support/prepare-minio.sh.hbs +74 -0
- package/templates/hook-archetype/standard/test/integration/hook-registration.test.ts.hbs +3 -1
- package/templates/hook-archetype/standard/test/unit/index.test.ts.hbs +11 -5
- package/templates/hook-archetype/standard/views/default/.gitkeep +1 -0
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
# {{packageName}} Agent Guide
|
|
2
2
|
|
|
3
|
-
This hook follows the
|
|
3
|
+
This hook follows the richer ReDBox client hook archetype generated by `@researchdatabox/redbox-dev-tools init`.
|
|
4
4
|
|
|
5
5
|
Keep these rules in place unless the user explicitly asks to change the hook model.
|
|
6
6
|
|
|
7
|
+
## Project Shape
|
|
8
|
+
|
|
9
|
+
- `src/index.ts` is the hook entry point and compiles to `dist/index.js`.
|
|
10
|
+
- `src/config/` contains config returned from `registerRedboxConfig()`.
|
|
11
|
+
- `src/form-config/` contains typed form definitions returned from `registerRedboxFormConfigs()`.
|
|
12
|
+
- `src/migrations/` contains the synchronous hook migration registry.
|
|
13
|
+
- `support/bootstrap-data/`, `assets/`, `views/`, and `language-defaults/` hold client material used by the Docker harness and hook runtime.
|
|
14
|
+
- `support/development/` and `support/integration-testing/` contain the local portal and Mocha harnesses.
|
|
15
|
+
|
|
7
16
|
## Dependency Contract
|
|
8
17
|
|
|
9
18
|
- `@researchdatabox/redbox-core` is the runtime compatibility anchor.
|
|
@@ -27,8 +36,16 @@ Use the existing scripts in `package.json`.
|
|
|
27
36
|
|
|
28
37
|
Do not replace the custom `run-hook-tsc` or `run-hook-mocha` entrypoints with plain `tsc` or `mocha`.
|
|
29
38
|
|
|
39
|
+
## Config And Migrations
|
|
40
|
+
|
|
41
|
+
Prefer returning config from `registerRedboxConfig()` instead of mutating `sails.config` in `configure()`.
|
|
42
|
+
|
|
43
|
+
Keep `registerRedboxMigrations()` synchronous. Add new migration modules to `src/migrations/index.ts`, and give each migration a unique hook-prefixed, sortable name such as `{{packageName}}:20260703T000000-seed-client-defaults`.
|
|
44
|
+
|
|
30
45
|
## Docker Runtime
|
|
31
46
|
|
|
32
47
|
The docker compose files intentionally set `NODE_PATH` so a mounted hook can resolve host-provided runtime dependencies from the Redbox portal dependency tree.
|
|
33
48
|
|
|
34
49
|
Do not remove that unless the runtime install model changes deliberately.
|
|
50
|
+
|
|
51
|
+
For mounted-core development, update `support/development/core-mount.env` or pass `REDBOX_PORTAL_PATH` in the environment, then use `npm run dev:run:core`. Do not hand-edit the generated `support/development/.tmp/core-mount.env` file.
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
ARG
|
|
1
|
+
ARG REDBOX_PORTAL_IMAGE=qcifengineering/redbox-portal:develop-pdfgen
|
|
2
2
|
|
|
3
|
-
FROM ${
|
|
3
|
+
FROM ${REDBOX_PORTAL_IMAGE} AS builder
|
|
4
4
|
|
|
5
5
|
USER root
|
|
6
6
|
|
|
7
|
-
COPY
|
|
8
|
-
COPY redbox-portal/packages/redbox-core /opt/redbox-portal/packages/redbox-core
|
|
9
|
-
COPY redbox-portal/packages/sails-ng-common /opt/redbox-portal/packages/sails-ng-common
|
|
10
|
-
COPY redbox-portal/packages/redbox-dev-tools /opt/redbox-portal/packages/redbox-dev-tools
|
|
7
|
+
COPY . /opt/{{packageName}}
|
|
11
8
|
|
|
12
9
|
RUN --mount=type=cache,target=/root/.npm \
|
|
13
10
|
cd /opt/{{packageName}} \
|
|
14
|
-
&& npm install --include=dev --ignore-scripts --
|
|
11
|
+
&& npm install --include=dev --ignore-scripts --strict-peer-deps \
|
|
15
12
|
&& npm run compile \
|
|
13
|
+
&& HOOK_TARBALL="$(npm pack --pack-destination /tmp --silent)" \
|
|
16
14
|
&& cd /opt/redbox-portal \
|
|
17
|
-
&& npm install --legacy-peer-deps --ignore-scripts /
|
|
18
|
-
&&
|
|
15
|
+
&& npm install --legacy-peer-deps --ignore-scripts "/tmp/${HOOK_TARBALL}" \
|
|
16
|
+
&& rm -f "/tmp/${HOOK_TARBALL}" \
|
|
17
|
+
&& mkdir -p /opt/redbox-portal/views /opt/redbox-portal/assets /opt/redbox-portal/.tmp/public /opt/redbox-portal/language-defaults /opt/redbox-portal/bootstrap-data \
|
|
19
18
|
&& if [ -d /opt/{{packageName}}/views ]; then cp -a /opt/{{packageName}}/views/. /opt/redbox-portal/views/; fi \
|
|
20
19
|
&& if [ -d /opt/{{packageName}}/assets ]; then cp -a /opt/{{packageName}}/assets/. /opt/redbox-portal/assets/; fi \
|
|
21
|
-
&& if [ -d /opt/{{packageName}}/
|
|
20
|
+
&& if [ -d /opt/{{packageName}}/assets ]; then cp -a /opt/{{packageName}}/assets/. /opt/redbox-portal/.tmp/public/; fi \
|
|
21
|
+
&& if [ -d /opt/{{packageName}}/language-defaults ]; then cp -a /opt/{{packageName}}/language-defaults/. /opt/redbox-portal/language-defaults/; fi \
|
|
22
|
+
&& if [ -d /opt/{{packageName}}/support/bootstrap-data ]; then cp -a /opt/{{packageName}}/support/bootstrap-data/. /opt/redbox-portal/bootstrap-data/; fi
|
|
22
23
|
|
|
23
|
-
FROM ${
|
|
24
|
+
FROM ${REDBOX_PORTAL_IMAGE} AS {{packageName}}
|
|
24
25
|
USER root
|
|
25
26
|
|
|
26
27
|
COPY --from=builder --chown=node:node --chmod='u=rwx,g=rx,o=rx' /opt/redbox-portal /opt/redbox-portal
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# {{packageName}}
|
|
2
2
|
|
|
3
|
-
A generated ReDBox hook archetype.
|
|
3
|
+
A generated ReDBox client hook archetype.
|
|
4
4
|
|
|
5
|
-
This project
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- direct `dependencies` are reserved for hook-owned runtime libraries only
|
|
10
|
-
- the generated package versions assume `redbox-core` and `redbox-dev-tools` are installed from npm, not from a sibling `redbox-portal` checkout
|
|
5
|
+
This project is shaped for migrating v4 client customisation hooks to the
|
|
6
|
+
current ReDBox hook contract. It includes TypeScript registrations for config,
|
|
7
|
+
form configs, services, controllers, and migrations, plus Docker-backed
|
|
8
|
+
development and Mocha integration harnesses.
|
|
11
9
|
|
|
12
10
|
## Development
|
|
13
11
|
|
|
@@ -19,21 +17,41 @@ npm run test:unit
|
|
|
19
17
|
|
|
20
18
|
Local installs intentionally allow lifecycle scripts so native modules and other postinstall hooks can run. Use `npm install --ignore-scripts` only in controlled CI or container contexts where that trade-off is deliberate.
|
|
21
19
|
|
|
22
|
-
For the
|
|
20
|
+
For the image-backed portal harness:
|
|
23
21
|
|
|
24
22
|
```bash
|
|
25
23
|
npm run dev:run:build
|
|
26
24
|
npm run dev:run
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
To test against a local `redbox-portal` checkout, set `REDBOX_PORTAL_PATH` in
|
|
28
|
+
`support/development/core-mount.env` and run:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run dev:run:core
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The helper script resolves relative paths from this hook root, validates the
|
|
35
|
+
portal checkout, installs missing dependencies, compiles the hook, compiles the
|
|
36
|
+
portal server packages, and writes the resolved path to
|
|
37
|
+
`support/development/.tmp/core-mount.env` for Docker Compose.
|
|
38
|
+
|
|
39
|
+
## Dependency Contract
|
|
40
|
+
|
|
41
|
+
- `@researchdatabox/redbox-core` is the runtime compatibility contract
|
|
42
|
+
- `@researchdatabox/redbox-dev-tools` provides the shared compile and unit-test toolchain
|
|
43
|
+
- direct `dependencies` are reserved for hook-owned runtime libraries only
|
|
44
|
+
- shared packages such as `axios`, `rxjs`, `lodash`, `mocha`, `chai`, `ts-node`, and `typescript` should not be pinned directly here
|
|
30
45
|
|
|
31
46
|
## Structure
|
|
32
47
|
|
|
33
48
|
- `src/index.ts`: hook entrypoint using `defineRedboxHook()`
|
|
34
49
|
- `src/api/controllers`: hook controllers
|
|
35
50
|
- `src/api/services`: hook services
|
|
36
|
-
- `src/config`: configuration and reusable form definition helpers
|
|
51
|
+
- `src/config`: configuration and reusable form definition helpers registered through `registerRedboxConfig()`
|
|
37
52
|
- `src/form-config`: form config exports
|
|
53
|
+
- `src/migrations`: synchronous hook migration registry
|
|
54
|
+
- `support/bootstrap-data`: bootstrap data copied into the portal image/harness
|
|
55
|
+
- `assets`, `views`, and `language-defaults`: client customisation material copied or resolved by the hook runtime
|
|
38
56
|
- `test/unit`: fast hook-local TypeScript tests
|
|
39
57
|
- `test/integration`: portal integration tests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
This folder contains hook-provided i18n defaults that can seed the database
|
|
2
|
+
and serve as runtime fallbacks when the database has no matching value.
|
|
3
|
+
|
|
4
|
+
Expected structure:
|
|
5
|
+
|
|
6
|
+
- `language-defaults/<lng>/translation.json`
|
|
7
|
+
- `language-defaults/meta.json` for optional category/description metadata
|
|
8
|
+
|
|
9
|
+
Keep generated client locale assets out of this folder; those belong under
|
|
10
|
+
the portal asset build output, not in the hook source.
|
|
@@ -9,18 +9,22 @@
|
|
|
9
9
|
"hasControllers": true,
|
|
10
10
|
"hasServices": true,
|
|
11
11
|
"hasConfig": true,
|
|
12
|
-
"hasFormConfigs": true
|
|
12
|
+
"hasFormConfigs": true,
|
|
13
|
+
"hasMigrations": true
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
16
|
"compile": "node ./node_modules/@researchdatabox/redbox-dev-tools/bin/run-hook-tsc.js -p tsconfig.json",
|
|
16
17
|
"test": "npm run test:unit && npm run test:integration:mocha",
|
|
17
|
-
"test:unit": "TS_NODE_PROJECT=./test/tsconfig.json npm run compile && node ./node_modules/@researchdatabox/redbox-dev-tools/bin/run-hook-mocha.js --config ./test/unit/.mocharc.cjs ./test/unit",
|
|
18
|
-
"test:integration:mocha": "npm run compile &&docker compose -f ./support/integration-testing/docker-compose.mocha.yml up --build --menu=false --abort-on-container-exit --exit-code-from redboxportal",
|
|
18
|
+
"test:unit": "TS_NODE_PROJECT=./test/tsconfig.json npm run compile && node ./node_modules/@researchdatabox/redbox-dev-tools/bin/run-hook-mocha.js --config ./test/unit/.mocharc.cjs \"./test/unit/**/*.test.ts\"",
|
|
19
|
+
"test:integration:mocha": "npm run compile && docker compose -f ./support/integration-testing/docker-compose.mocha.yml up --build --menu=false --abort-on-container-exit --exit-code-from redboxportal",
|
|
19
20
|
"test:integration:mocha:clean": "docker compose -f ./support/integration-testing/docker-compose.mocha.yml down -v --remove-orphans --timeout 180",
|
|
20
|
-
"dev:run": "
|
|
21
|
-
"dev:run:
|
|
21
|
+
"dev:run:prepare": "mkdir -p ./support/development/.tmp/attachments/staging ./support/development/.tmp/mongo ./support/development/.tmp/minio/data",
|
|
22
|
+
"dev:run": "npm run dev:run:prepare && docker compose -f ./support/development/docker-compose.yml up --menu=false --abort-on-container-exit --exit-code-from rbportal",
|
|
23
|
+
"dev:run:build": "docker compose -f ./support/development/docker-compose.yml build --pull",
|
|
22
24
|
"dev:run:clean": "docker compose -f ./support/development/docker-compose.yml down -v --remove-orphans --timeout 180",
|
|
23
|
-
"dev:run:prepare": "
|
|
25
|
+
"dev:run:core:prepare": "bash ./support/development/prepare-core-mount.sh",
|
|
26
|
+
"dev:run:core": "npm run dev:run:core:prepare && docker compose --env-file ./support/development/.tmp/core-mount.env -f ./support/development/docker-compose.yml -f ./support/development/docker-compose.core-mount.yml up --menu=false --abort-on-container-exit --exit-code-from rbportal",
|
|
27
|
+
"dev:run:core:clean": "REDBOX_PORTAL_PATH=/tmp/unused docker compose -f ./support/development/docker-compose.yml -f ./support/development/docker-compose.core-mount.yml down -v --remove-orphans --timeout 180"
|
|
24
28
|
},
|
|
25
29
|
"keywords": [
|
|
26
30
|
"sails",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import '@researchdatabox/redbox-core';
|
|
2
|
-
import { defineRedboxHook, type
|
|
2
|
+
import { defineRedboxHook, type HookRegistrationMap } from '@researchdatabox/redbox-core';
|
|
3
3
|
import type { FormConfigFrame } from '@researchdatabox/sails-ng-common';
|
|
4
4
|
import type { HookRedboxControllers } from './api/controllers';
|
|
5
5
|
import type { HookRedboxServices } from './api/services';
|
|
6
6
|
import { brandingConfigurationDefaults } from './config/brandingConfigurationDefaults';
|
|
7
7
|
import { reusableFormDefinitions } from './config/reusableFormDefinitions';
|
|
8
|
+
import { MigrationExports, registerRedboxMigrations } from './migrations';
|
|
8
9
|
|
|
9
10
|
export {};
|
|
10
11
|
|
|
@@ -20,21 +21,18 @@ const hook = defineRedboxHook({
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
},
|
|
23
|
-
configure(
|
|
24
|
-
const brandingDefaults = (sails.config.brandingConfigurationDefaults || {}) as SailsConfig['brandingConfigurationDefaults'];
|
|
25
|
-
brandingDefaults.menu = brandingConfigurationDefaults.menu as SailsConfig['brandingConfigurationDefaults']['menu'];
|
|
26
|
-
brandingDefaults.homePanels = brandingConfigurationDefaults.homePanels as SailsConfig['brandingConfigurationDefaults']['homePanels'];
|
|
27
|
-
sails.config.brandingConfigurationDefaults = brandingDefaults;
|
|
28
|
-
sails.config.reusableFormDefinitions = reusableFormDefinitions;
|
|
29
|
-
},
|
|
24
|
+
configure() {},
|
|
30
25
|
defaults: {
|
|
31
26
|
__configKey__: {
|
|
32
27
|
_hookTimeout: 120000
|
|
33
28
|
},
|
|
34
29
|
policies: {}
|
|
35
30
|
},
|
|
36
|
-
registerRedboxConfig():
|
|
37
|
-
return {
|
|
31
|
+
registerRedboxConfig(): HookRegistrationMap {
|
|
32
|
+
return {
|
|
33
|
+
brandingConfigurationDefaults,
|
|
34
|
+
reusableFormDefinitions
|
|
35
|
+
};
|
|
38
36
|
},
|
|
39
37
|
registerRedboxControllers(): HookRedboxControllers {
|
|
40
38
|
return require('./api/controllers').ControllerExports as HookRedboxControllers;
|
|
@@ -48,7 +46,9 @@ const hook = defineRedboxHook({
|
|
|
48
46
|
additionalExports: {
|
|
49
47
|
ControllerExports: require('./api/controllers').ControllerExports,
|
|
50
48
|
ServiceExports: require('./api/services').ServiceExports,
|
|
51
|
-
FormConfigExports: require('./form-config').FormConfigExports
|
|
49
|
+
FormConfigExports: require('./form-config').FormConfigExports,
|
|
50
|
+
MigrationExports,
|
|
51
|
+
registerRedboxMigrations
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RedboxMigration } from '@researchdatabox/redbox-core';
|
|
2
|
+
|
|
3
|
+
export const MigrationExports: RedboxMigration[] = [];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook migration registry. The ReDBox loader discovers this via
|
|
7
|
+
* `package.json` -> `sails.hasMigrations: true` and calls it through the
|
|
8
|
+
* generated `config/migrations.js` shim.
|
|
9
|
+
*
|
|
10
|
+
* Keep this function synchronous. Migrations are ordered lexically by `name`,
|
|
11
|
+
* so prefix new migration names with the hook package name and a sortable
|
|
12
|
+
* timestamp, for example:
|
|
13
|
+
* `{{packageName}}:20260703T000000-seed-client-defaults`.
|
|
14
|
+
*/
|
|
15
|
+
export function registerRedboxMigrations(): RedboxMigration[] {
|
|
16
|
+
return MigrationExports;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default registerRedboxMigrations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/templates/hook-archetype/standard/support/development/docker-compose.core-mount.yml.hbs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
networks:
|
|
2
|
+
main:
|
|
3
|
+
|
|
4
|
+
services:
|
|
5
|
+
rbportal:
|
|
6
|
+
environment:
|
|
7
|
+
- sails_angularDev=true
|
|
8
|
+
volumes:
|
|
9
|
+
- "../../:/opt/redbox-portal/node_modules/{{packageName}}"
|
|
10
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/app.js:/opt/redbox-portal/app.js:delegated"
|
|
11
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/agenda-sqs-backend:/opt/redbox-portal/packages/agenda-sqs-backend:delegated"
|
|
12
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/raido:/opt/redbox-portal/packages/raido:delegated"
|
|
13
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/packages/redbox-core:delegated"
|
|
14
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-dev-tools:/opt/redbox-portal/packages/redbox-dev-tools:delegated"
|
|
15
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/rva-registry:/opt/redbox-portal/packages/rva-registry:delegated"
|
|
16
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-hook-redbox-storage-mongo:/opt/redbox-portal/packages/sails-hook-redbox-storage-mongo:delegated"
|
|
17
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-ng-common:/opt/redbox-portal/packages/sails-ng-common:delegated"
|
|
18
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/views:/opt/redbox-portal/views:delegated"
|
|
19
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/agenda-sqs-backend:/opt/redbox-portal/node_modules/@researchdatabox/agenda-sqs-backend:delegated"
|
|
20
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/raido:/opt/redbox-portal/node_modules/@researchdatabox/raido-openapi-generated-node:delegated"
|
|
21
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core:delegated"
|
|
22
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core-types:delegated"
|
|
23
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-dev-tools:/opt/redbox-portal/node_modules/@researchdatabox/redbox-dev-tools:delegated"
|
|
24
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/rva-registry:/opt/redbox-portal/node_modules/@researchdatabox/rva-registry-openapi-generated-node:delegated"
|
|
25
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-hook-redbox-storage-mongo:/opt/redbox-portal/node_modules/@researchdatabox/sails-hook-redbox-storage-mongo:delegated"
|
|
26
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-ng-common:/opt/redbox-portal/node_modules/@researchdatabox/sails-ng-common:delegated"
|
|
27
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/agenda-sqs-backend:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/agenda-sqs-backend:delegated"
|
|
28
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/raido:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/raido-openapi-generated-node:delegated"
|
|
29
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/redbox-core:delegated"
|
|
30
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/redbox-core-types:delegated"
|
|
31
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-dev-tools:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/redbox-dev-tools:delegated"
|
|
32
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/rva-registry:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/rva-registry-openapi-generated-node:delegated"
|
|
33
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-hook-redbox-storage-mongo:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/sails-hook-redbox-storage-mongo:delegated"
|
|
34
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-ng-common:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/sails-ng-common:delegated"
|
|
35
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/assets/angular:/opt/redbox-portal/assets/angular:delegated"
|
|
36
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/assets/angular:/opt/redbox-portal/.tmp/public/angular:delegated"
|
|
37
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/.tmp/public/default/default/js:/opt/redbox-portal/.tmp/public/default/default/js:delegated"
|
|
@@ -4,47 +4,58 @@ networks:
|
|
|
4
4
|
services:
|
|
5
5
|
rbportal:
|
|
6
6
|
build:
|
|
7
|
-
context: '
|
|
8
|
-
dockerfile: '
|
|
7
|
+
context: '../..'
|
|
8
|
+
dockerfile: 'Dockerfile'
|
|
9
9
|
target: '{{packageName}}'
|
|
10
10
|
ports:
|
|
11
11
|
- "1500:1500"
|
|
12
|
+
- "9876:9876"
|
|
12
13
|
volumes:
|
|
13
14
|
- "../../:/opt/redbox-portal/node_modules/{{packageName}}"
|
|
14
|
-
- "
|
|
15
|
-
- "
|
|
16
|
-
- "../../../redbox-portal/packages/sails-ng-common:/opt/redbox-portal/packages/sails-ng-common"
|
|
17
|
-
- "../../../redbox-portal/.tmp/public/angular/form:/opt/redbox-portal/.tmp/public/angular/form"
|
|
18
|
-
- "../../../redbox-portal/.tmp/public/angular/local-auth:/opt/redbox-portal/.tmp/public/angular/local-auth"
|
|
19
|
-
- "../../../redbox-portal/.tmp/public/angular/export:/opt/redbox-portal/.tmp/public/angular/export"
|
|
20
|
-
- "../../../redbox-portal/.tmp/public/angular/dashboard:/opt/redbox-portal/.tmp/public/angular/dashboard"
|
|
21
|
-
- "../../../redbox-portal/.tmp/public/angular/report:/opt/redbox-portal/.tmp/public/angular/report"
|
|
22
|
-
- "../../../redbox-portal/.tmp/public/angular/manage-users:/opt/redbox-portal/.tmp/public/angular/manage-users"
|
|
23
|
-
- "../../../redbox-portal/.tmp/public/angular/admin-vocabulary:/opt/redbox-portal/.tmp/public/angular/admin-vocabulary"
|
|
24
|
-
- "../../../redbox-portal/.tmp/public/angular/manage-roles:/opt/redbox-portal/.tmp/public/angular/manage-roles"
|
|
25
|
-
- "../../../redbox-portal/.tmp/public/angular/app-config:/opt/redbox-portal/.tmp/public/angular/app-config"
|
|
26
|
-
- "../../../redbox-portal/.tmp/public/angular/deleted-records:/opt/redbox-portal/.tmp/public/angular/deleted-records"
|
|
27
|
-
- "../../../redbox-portal/.tmp/public/angular/branding:/opt/redbox-portal/.tmp/public/angular/branding"
|
|
28
|
-
- "../../../redbox-portal/.tmp/public/angular/translation:/opt/redbox-portal/.tmp/public/angular/translation"
|
|
29
|
-
- "../../../redbox-portal/.tmp/public/angular/record-search:/opt/redbox-portal/.tmp/public/angular/record-search"
|
|
15
|
+
- "../../language-defaults:/opt/redbox-portal/language-defaults"
|
|
16
|
+
- "../../support/bootstrap-data:/opt/redbox-portal/bootstrap-data"
|
|
30
17
|
- "./.tmp/attachments/staging:/attachments/staging"
|
|
31
18
|
expose:
|
|
32
19
|
- "1500"
|
|
33
20
|
environment:
|
|
21
|
+
- sails_appUrl=http://localhost:1500
|
|
34
22
|
- NODE_ENV=docker
|
|
35
23
|
- NODE_PATH=/opt/redbox-portal/node_modules:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core/node_modules
|
|
36
24
|
- LOAD_DEFAULT_FORMS=true
|
|
37
25
|
- PORT=1500
|
|
38
26
|
- NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
39
|
-
-
|
|
27
|
+
- sails_security__csrf=false
|
|
28
|
+
- sails_redbox__apiKey=development-api-key
|
|
29
|
+
- sails_auth__default__local__default__token=development-token
|
|
30
|
+
- sails_brandingConfigurationDefaults__auth__local__default__token=development-token
|
|
31
|
+
- HOOK_S3_ACCESS_KEY=minioadmin
|
|
32
|
+
- HOOK_S3_SECRET_KEY=minioadmin
|
|
33
|
+
- HOOK_S3_REGION=ap-southeast-2
|
|
34
|
+
- HOOK_S3_BUCKET=test-aws-{{packageName}}-attachments
|
|
35
|
+
- HOOK_S3_ENDPOINT=http://minio:9000
|
|
36
|
+
- HOOK_S3_KEY_PREFIX=attachments/
|
|
37
|
+
- HOOK_ATTACHMENTS_STAGE_DIR=/attachments/staging
|
|
38
|
+
- HOOK_S3_FORCE_PATH_STYLE=true
|
|
39
|
+
- HOOK_S3_SUPPORTS_ACL=false
|
|
40
|
+
- MINIO_WAIT_SECONDS=180
|
|
41
|
+
- REGENERATE_SHIMS=true
|
|
40
42
|
networks:
|
|
41
43
|
main:
|
|
42
44
|
aliases:
|
|
43
45
|
- rbportal
|
|
44
46
|
entrypoint: >-
|
|
45
47
|
/bin/bash -c "set -x;
|
|
48
|
+
if [ -n \"$${HOOK_S3_BUCKET:-}\" ]; then bash /opt/redbox-portal/node_modules/{{packageName}}/support/prepare-minio.sh development || true; fi;
|
|
46
49
|
cd /opt/redbox-portal &&
|
|
47
|
-
|
|
50
|
+
npm --prefix /opt/redbox-portal/node_modules/{{packageName}} run compile &&
|
|
51
|
+
node --enable-source-maps --inspect=0.0.0.0:9876 app.js;"
|
|
52
|
+
depends_on:
|
|
53
|
+
mongodb:
|
|
54
|
+
condition: service_started
|
|
55
|
+
solr:
|
|
56
|
+
condition: service_started
|
|
57
|
+
minio:
|
|
58
|
+
condition: service_healthy
|
|
48
59
|
|
|
49
60
|
mongodb:
|
|
50
61
|
image: mongo:7
|
|
@@ -73,3 +84,25 @@ services:
|
|
|
73
84
|
- docker-entrypoint.sh
|
|
74
85
|
- solr-precreate
|
|
75
86
|
- redbox
|
|
87
|
+
|
|
88
|
+
minio:
|
|
89
|
+
image: minio/minio:latest
|
|
90
|
+
command: server /data --console-address ":9001"
|
|
91
|
+
networks:
|
|
92
|
+
main:
|
|
93
|
+
aliases:
|
|
94
|
+
- minio
|
|
95
|
+
ports:
|
|
96
|
+
- "9000:9000"
|
|
97
|
+
- "9001:9001"
|
|
98
|
+
environment:
|
|
99
|
+
- MINIO_ROOT_USER=minioadmin
|
|
100
|
+
- MINIO_ROOT_PASSWORD=minioadmin
|
|
101
|
+
volumes:
|
|
102
|
+
- "./.tmp/minio/data:/data"
|
|
103
|
+
healthcheck:
|
|
104
|
+
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/ready"]
|
|
105
|
+
interval: 2s
|
|
106
|
+
timeout: 5s
|
|
107
|
+
retries: 90
|
|
108
|
+
start_period: 5s
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
6
|
+
HOOK_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd -P)"
|
|
7
|
+
DEFAULT_ENV_FILE="${SCRIPT_DIR}/core-mount.env"
|
|
8
|
+
TMP_DIR="${HOOK_ROOT}/support/development/.tmp"
|
|
9
|
+
RESOLVED_ENV_FILE="${TMP_DIR}/core-mount.env"
|
|
10
|
+
|
|
11
|
+
if [[ -z "${REDBOX_PORTAL_PATH:-}" && -f "${DEFAULT_ENV_FILE}" ]]; then
|
|
12
|
+
set -a
|
|
13
|
+
# shellcheck disable=SC1090
|
|
14
|
+
source "${DEFAULT_ENV_FILE}"
|
|
15
|
+
set +a
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [[ -z "${REDBOX_PORTAL_PATH:-}" ]]; then
|
|
19
|
+
echo "FATAL: Set REDBOX_PORTAL_PATH to the redbox-portal checkout you want to mount." >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [[ "${REDBOX_PORTAL_PATH}" = /* ]]; then
|
|
24
|
+
PORTAL_ROOT="$(cd "${REDBOX_PORTAL_PATH}" && pwd -P)"
|
|
25
|
+
else
|
|
26
|
+
PORTAL_ROOT="$(cd "${HOOK_ROOT}/${REDBOX_PORTAL_PATH}" && pwd -P)"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
for required_path in \
|
|
30
|
+
package.json \
|
|
31
|
+
app.js \
|
|
32
|
+
packages/redbox-core/package.json \
|
|
33
|
+
packages/redbox-dev-tools/package.json \
|
|
34
|
+
packages/sails-ng-common/package.json \
|
|
35
|
+
packages/raido/package.json \
|
|
36
|
+
packages/rva-registry/package.json \
|
|
37
|
+
packages/sails-hook-redbox-storage-mongo/package.json
|
|
38
|
+
do
|
|
39
|
+
if [[ ! -e "${PORTAL_ROOT}/${required_path}" ]]; then
|
|
40
|
+
echo "FATAL: Missing required portal path: ${PORTAL_ROOT}/${required_path}" >&2
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
done
|
|
44
|
+
|
|
45
|
+
mkdir -p "${TMP_DIR}/attachments/staging" "${TMP_DIR}/mongo" "${TMP_DIR}/minio/data"
|
|
46
|
+
chmod -R 777 "${TMP_DIR}" || true
|
|
47
|
+
|
|
48
|
+
printf 'REDBOX_PORTAL_PATH=%s\n' "${PORTAL_ROOT}" > "${RESOLVED_ENV_FILE}"
|
|
49
|
+
|
|
50
|
+
if [[ ! -d "${PORTAL_ROOT}/node_modules" ]]; then
|
|
51
|
+
(cd "${PORTAL_ROOT}" && npm install --ignore-scripts --strict-peer-deps)
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
if [[ ! -d "${HOOK_ROOT}/node_modules" ]]; then
|
|
55
|
+
(cd "${HOOK_ROOT}" && npm install --ignore-scripts)
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
(cd "${HOOK_ROOT}" && npm run compile)
|
|
59
|
+
(cd "${PORTAL_ROOT}" && npm run compile:server)
|
|
60
|
+
|
|
61
|
+
echo "Prepared core mount against: ${PORTAL_ROOT}"
|
package/templates/hook-archetype/standard/support/integration-testing/docker-compose.mocha.yml.hbs
CHANGED
|
@@ -5,35 +5,49 @@ x-rbportal-env: &rbportal-env
|
|
|
5
5
|
- NODE_ENV=integrationtest
|
|
6
6
|
- NODE_PATH=/opt/redbox-portal/node_modules:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core/node_modules
|
|
7
7
|
- PORT=1500
|
|
8
|
+
- sails_redbox__apiKey=integration-api-key
|
|
8
9
|
- sails_redbox__mochaTesting=true
|
|
10
|
+
- sails_brandingConfigurationDefaults__auth__local__default__token=integration-token
|
|
9
11
|
- sails_security__csrf=false
|
|
10
12
|
- LOAD_DEFAULT_FORMS=true
|
|
13
|
+
- HOOK_S3_ACCESS_KEY=minioadmin
|
|
14
|
+
- HOOK_S3_SECRET_KEY=minioadmin
|
|
15
|
+
- HOOK_S3_REGION=ap-southeast-2
|
|
16
|
+
- HOOK_S3_BUCKET=test-aws-{{packageName}}-attachments
|
|
17
|
+
- HOOK_S3_ENDPOINT=http://minio:9000
|
|
18
|
+
- HOOK_S3_KEY_PREFIX=attachments/
|
|
19
|
+
- HOOK_ATTACHMENTS_STAGE_DIR=/attachments/staging
|
|
20
|
+
- HOOK_S3_FORCE_PATH_STYLE=true
|
|
21
|
+
- HOOK_S3_SUPPORTS_ACL=false
|
|
22
|
+
- MINIO_WAIT_SECONDS=180
|
|
23
|
+
- REGENERATE_SHIMS=true
|
|
11
24
|
- CI=${CI:-false}
|
|
12
|
-
- RBPORTAL_COVERAGE_DIR=/tmp/coverage/mocha
|
|
25
|
+
- RBPORTAL_COVERAGE_DIR=/tmp/redbox-coverage/mocha
|
|
13
26
|
|
|
14
27
|
x-rbportal-depends: &rbportal-depends
|
|
15
28
|
mongodb:
|
|
16
29
|
condition: service_healthy
|
|
17
30
|
solr:
|
|
18
31
|
condition: service_healthy
|
|
32
|
+
minio:
|
|
33
|
+
condition: service_healthy
|
|
19
34
|
|
|
20
35
|
services:
|
|
21
36
|
redboxportal:
|
|
22
37
|
build:
|
|
23
|
-
context:
|
|
24
|
-
dockerfile:
|
|
38
|
+
context: ../..
|
|
39
|
+
dockerfile: Dockerfile
|
|
25
40
|
target: {{packageName}}
|
|
26
41
|
ports:
|
|
27
42
|
- "1500:1500"
|
|
28
43
|
volumes:
|
|
29
|
-
- "
|
|
30
|
-
- "
|
|
31
|
-
- "
|
|
32
|
-
- "
|
|
44
|
+
- "../../language-defaults:/opt/redbox-portal/language-defaults"
|
|
45
|
+
- "../../support/bootstrap-data:/opt/redbox-portal/bootstrap-data:ro"
|
|
46
|
+
- "../../support/prepare-minio.sh:/opt/redbox-portal/support/prepare-minio.sh:ro"
|
|
47
|
+
- "../../support/integration-testing:/opt/redbox-portal/support/integration-testing:ro"
|
|
48
|
+
- "../../tsconfig.json:/opt/redbox-portal/tsconfig.json:ro"
|
|
33
49
|
- "../../test/integration:/opt/redbox-portal/test/integration/{{integrationDirName}}"
|
|
34
|
-
- "
|
|
35
|
-
- "../../../redbox-portal/packages/redbox-dev-tools:/opt/redbox-portal/packages/redbox-dev-tools"
|
|
36
|
-
- "../../../redbox-portal/packages/sails-ng-common:/opt/redbox-portal/packages/sails-ng-common"
|
|
50
|
+
- "./.tmp/attachments/staging:/attachments/staging"
|
|
37
51
|
depends_on: *rbportal-depends
|
|
38
52
|
expose:
|
|
39
53
|
- "1500"
|
|
@@ -45,7 +59,7 @@ services:
|
|
|
45
59
|
init: true
|
|
46
60
|
entrypoint:
|
|
47
61
|
- bash
|
|
48
|
-
- /opt/redbox-portal/
|
|
62
|
+
- /opt/redbox-portal/support/integration-testing/run-mocha-hook.sh
|
|
49
63
|
|
|
50
64
|
mongodb:
|
|
51
65
|
image: mongo:7
|
|
@@ -82,3 +96,23 @@ services:
|
|
|
82
96
|
- docker-entrypoint.sh
|
|
83
97
|
- solr-precreate
|
|
84
98
|
- redbox
|
|
99
|
+
|
|
100
|
+
minio:
|
|
101
|
+
image: minio/minio:latest
|
|
102
|
+
command: server /data --console-address ":9001"
|
|
103
|
+
networks:
|
|
104
|
+
main:
|
|
105
|
+
aliases:
|
|
106
|
+
- minio
|
|
107
|
+
expose:
|
|
108
|
+
- "9000"
|
|
109
|
+
- "9001"
|
|
110
|
+
environment:
|
|
111
|
+
- MINIO_ROOT_USER=minioadmin
|
|
112
|
+
- MINIO_ROOT_PASSWORD=minioadmin
|
|
113
|
+
healthcheck:
|
|
114
|
+
test: [ 'CMD-SHELL', 'curl -fsS http://localhost:9000/minio/health/ready' ]
|
|
115
|
+
interval: '5s'
|
|
116
|
+
timeout: '5s'
|
|
117
|
+
retries: 20
|
|
118
|
+
start_period: '10s'
|
|
@@ -5,5 +5,10 @@ set -euo pipefail
|
|
|
5
5
|
cd /opt/redbox-portal
|
|
6
6
|
|
|
7
7
|
export RBPORTAL_MOCHA_TEST_PATHS=${RBPORTAL_MOCHA_TEST_PATHS:-$'test/integration/{{integrationDirName}}/**/*.test.ts'}
|
|
8
|
+
export RBPORTAL_SAILS_LOG_LEVEL=${RBPORTAL_SAILS_LOG_LEVEL:-error}
|
|
9
|
+
|
|
10
|
+
if [ -n "${HOOK_S3_BUCKET:-}" ] && [ -f /opt/redbox-portal/support/prepare-minio.sh ]; then
|
|
11
|
+
bash /opt/redbox-portal/support/prepare-minio.sh integration
|
|
12
|
+
fi
|
|
8
13
|
|
|
9
14
|
exec bash /opt/redbox-portal/support/integration-testing/run-mocha-redbox.sh
|