From 0d33e63048b1b99854edd7bd53eed32bef2a8f44 Mon Sep 17 00:00:00 2001 From: minottic Date: Fri, 15 Nov 2024 12:48:36 +0100 Subject: [PATCH 1/3] Add JOBS config for v4 development --- services/backend/services/v4/.compose.jobs.yaml | 1 + services/backend/services/v4/compose.jobs.yaml | 16 ++++++++++++++++ services/backend/services/v4/compose.yaml | 1 + services/backend/services/v4/config/.jobs.env | 4 ++++ services/frontend/.compose.jobs.yaml | 1 + services/frontend/compose.jobs.yaml | 12 ++++++++++++ services/frontend/compose.yaml | 1 + 7 files changed, 36 insertions(+) create mode 120000 services/backend/services/v4/.compose.jobs.yaml create mode 100644 services/backend/services/v4/compose.jobs.yaml create mode 100644 services/backend/services/v4/config/.jobs.env create mode 120000 services/frontend/.compose.jobs.yaml create mode 100644 services/frontend/compose.jobs.yaml diff --git a/services/backend/services/v4/.compose.jobs.yaml b/services/backend/services/v4/.compose.jobs.yaml new file mode 120000 index 00000000..8aa7b1cc --- /dev/null +++ b/services/backend/services/v4/.compose.jobs.yaml @@ -0,0 +1 @@ +../../../.empty.yaml \ No newline at end of file diff --git a/services/backend/services/v4/compose.jobs.yaml b/services/backend/services/v4/compose.jobs.yaml new file mode 100644 index 00000000..665e4270 --- /dev/null +++ b/services/backend/services/v4/compose.jobs.yaml @@ -0,0 +1,16 @@ +services: + backend: + build: + context: + https://github.com/SciCatProject/scicat-backend-next.git#release-jobs + environment: + GITHUB_REPO: + https://github.com/SciCatProject/scicat-backend-next.git#release-jobs + env_file: + - ./config/.jobs.env + volumes: + - v4_jobs_dev:${WORKDIR:-/home/node/app} + +volumes: + v4_jobs_dev: + driver: local diff --git a/services/backend/services/v4/compose.yaml b/services/backend/services/v4/compose.yaml index 114b5b97..2e1f7409 100644 --- a/services/backend/services/v4/compose.yaml +++ b/services/backend/services/v4/compose.yaml @@ -4,3 +4,4 @@ include: - .${ELASTIC_ENABLED:+/}compose.elastic.yaml - .${DEV:+/}compose.dev.yaml - .${KEYCLOAK_HTTPS_URL:+/}compose.https.yaml + - .${DEV:+${JOBS_ENABLED:+/}}compose.jobs.yaml diff --git a/services/backend/services/v4/config/.jobs.env b/services/backend/services/v4/config/.jobs.env new file mode 100644 index 00000000..1a3a5000 --- /dev/null +++ b/services/backend/services/v4/config/.jobs.env @@ -0,0 +1,4 @@ +CREATE_JOB_GROUPS=group1,group2 +UPDATE_JOB_GROUPS=group1 +DELETE_JOB_GROUPS=archivemanager +JOB_CONFIGURATION_FILE=test/config/jobconfig.yaml diff --git a/services/frontend/.compose.jobs.yaml b/services/frontend/.compose.jobs.yaml new file mode 120000 index 00000000..ad51ac20 --- /dev/null +++ b/services/frontend/.compose.jobs.yaml @@ -0,0 +1 @@ +../.empty.yaml \ No newline at end of file diff --git a/services/frontend/compose.jobs.yaml b/services/frontend/compose.jobs.yaml new file mode 100644 index 00000000..009065e8 --- /dev/null +++ b/services/frontend/compose.jobs.yaml @@ -0,0 +1,12 @@ +services: + frontend: + build: + context: https://github.com/SciCatProject/frontend.git#release-jobs + environment: + GITHUB_REPO: https://github.com/SciCatProject/frontend.git#release-jobs + volumes: + - frontend_jobs_dev:${WORKDIR:-/home/node/app} + +volumes: + frontend_jobs_dev: + driver: local diff --git a/services/frontend/compose.yaml b/services/frontend/compose.yaml index 02fd1bee..f01bba7c 100644 --- a/services/frontend/compose.yaml +++ b/services/frontend/compose.yaml @@ -4,3 +4,4 @@ include: - .${OIDC_ENABLED:+/}compose.oidc.yaml - .${LDAP_ENABLED:+/}compose.ldap.yaml - .${DEV:+/}compose.dev.yaml + - .${DEV:+${JOBS_ENABLED:+/}}compose.jobs.yaml From 0204fba6c74b02a57ed5bbc43aa02ffcf302f08c Mon Sep 17 00:00:00 2001 From: minottic Date: Fri, 15 Nov 2024 12:51:53 +0100 Subject: [PATCH 2/3] Extend readme to include jobs --- README.md | 4 ++++ services/backend/services/v4/README.md | 5 +++++ services/frontend/README.md | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 5c9dffa9..1e1a82e1 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ This project requires docker and docker compose. The docker version must be late Release `v3.0` is the first stable and reviewed version of SciCatLive. +## Create the release-jobs DEV environment + +To start the containers in DEV mode with JOBS settings, set the env variables `DEV=true` and `JOBS_ENABLED=true` [here](.env). This will start the backend and the frontend in development mode with code checkout out at `#release-jobs` branch, including the requirements to run tests. + ## Steps
diff --git a/services/backend/services/v4/README.md b/services/backend/services/v4/README.md index 04892f39..67f86bb6 100644 --- a/services/backend/services/v4/README.md +++ b/services/backend/services/v4/README.md @@ -31,6 +31,11 @@ If `OIDC_ENABLED` is toggled, you can use OIDC to log in with a [OIDC user](../k With `DEV=true`, since the container might have limited memory, it is recommended to run unit tests with the option `--runInBand`, as [here](./entrypoints/tests.sh), which makes the tests run sequentially, avoiding to fill the RAM which makes them freeze. +With `DEV=true` and `JOBS_ENABLED=true` containers in `DEV` mode is created with code checkout out at `#release-jobs` branch, in a dedicated docker volume: `v4_jobs_dev`. As docker caches images, it is recommended to run `npm install` whenever rerunning `docker compose up -d`, or rebuild the image without cache with: +```bash +docker compose up -d --build +``` + ## Dependencies Here below we show the internal dependencies of the service, which are not already covered [here](../../../../README.md) and [here](../../README.md) (if `B` depends on `A`, then we visualize as `A --> B`). The same subdomain to service convention applies. diff --git a/services/frontend/README.md b/services/frontend/README.md index d8a8e4aa..df3113e7 100644 --- a/services/frontend/README.md +++ b/services/frontend/README.md @@ -22,6 +22,11 @@ Since there was a small breaking change from `v3` to `v4`, when connecting to th With `DEV=true`, please use `npm start -- --host 0.0.0.0`. This is to allow traffic from any IP to the `frontend` component and it is necessary since the component runs in the docker network. +With `DEV=true` and `JOBS_ENABLED=true` containers in `DEV` mode is created with code checkout out at `#release-jobs` branch, in a dedicated docker volume: `frontend_jobs_dev`. As docker caches images, it is recommended to run `npm install` whenever rerunning `docker compose up -d`, or rebuild the image without cache with: +```bash +docker compose up -d --build +``` + Setting the [BACKEND_HTTPS_URL env variable](../../.env) requires changing the `backend` URL used by the `frontend`. This is managed [here](../../entrypoints/merge_json.sh). :warning: When setting `FRONTENT_HTTPS_URL` it is likely you also want to set the `BACKEND_HTTPS_URL`, to allow the communication between the two wherever the browser is accessed. From 40181ed7e6fe5980b696d1cf2b2b3951da83c56e Mon Sep 17 00:00:00 2001 From: sofyalaski Date: Tue, 28 Jan 2025 16:43:26 +0100 Subject: [PATCH 3/3] adds admin to the delete jobs group in jobs config --- services/backend/services/v4/config/.jobs.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/backend/services/v4/config/.jobs.env b/services/backend/services/v4/config/.jobs.env index 1a3a5000..7cf43e56 100644 --- a/services/backend/services/v4/config/.jobs.env +++ b/services/backend/services/v4/config/.jobs.env @@ -1,4 +1,4 @@ CREATE_JOB_GROUPS=group1,group2 UPDATE_JOB_GROUPS=group1 -DELETE_JOB_GROUPS=archivemanager +DELETE_JOB_GROUPS=archivemanager,admin JOB_CONFIGURATION_FILE=test/config/jobconfig.yaml