From cb3381ca335cc59d15ead90d3dcdf97242ccab6a Mon Sep 17 00:00:00 2001 From: "govert@muze.nl" Date: Tue, 28 Jan 2025 14:08:32 +0100 Subject: [PATCH 1/7] new installation script, removing graphql and updates DB on install --- .gitmodules | 12 ------------ curriculum-graphql-server | 1 - docker-compose.yml | 1 - install.sh | 36 ++++++++++++++++++++++++++++-------- 4 files changed, 28 insertions(+), 22 deletions(-) delete mode 100644 .gitmodules delete mode 160000 curriculum-graphql-server diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3e41071..0000000 --- a/.gitmodules +++ /dev/null @@ -1,12 +0,0 @@ -[submodule "curriculum-graphql-server"] - path = curriculum-graphql-server - url = git@github.com:slonl/curriculum-graphql-server -[submodule "curriculum-rest-api"] - path = curriculum-rest-api - url = git@github.com:slonl/curriculum-rest-api -[submodule "curriculum-search-server"] - path = curriculum-search-server - url = git@github.com:slonl/curriculum-search-server.git -[submodule "curriculum-store"] - path = curriculum-store - url = git@github.com:slonl/curriculum-store diff --git a/curriculum-graphql-server b/curriculum-graphql-server deleted file mode 160000 index 9e12a4a..0000000 --- a/curriculum-graphql-server +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9e12a4a6e43f40d56823c5f5b3c0fca9aa27f15b diff --git a/docker-compose.yml b/docker-compose.yml index f3e0d03..d4cc00d 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,6 @@ services: - DATA_DIR=/home/node/app/curriculum volumes: - ./curriculum-search-server/:/home/node/app - - ./curriculum-graphql-server/data/:/home/node/app/curriculum ports: - "3001:3001" entrypoint: ["/bin/sh","-c"] diff --git a/install.sh b/install.sh index 75c5204..c8074cb 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,30 @@ -#!/bin/bash -cd ./curriculum-graphql-server -git submodule update --init -git submodule foreach 'git checkout editor' -cd .. +#!/usr/bin/env bash -docker-compose exec graphql sh -c 'cd json-graphql-server && npm install' -docker-compose exec graphql sh -c 'npm run combine' +set -o errexit # Exit script when a command exits with non-zero status. +set -o errtrace # Exit on error inside any functions or sub-shells. +set -o nounset # Exit script on use of an undefined variable. +set -o pipefail # Return exit status of the last command in the pipe that exited with a non-zero exit code -docker-compose exec rest-api sh -c 'npm install' \ No newline at end of file +git clone https://github.com/slonl/curriculum-rest-api.git +cd curriculum-rest-api +git pull +npm update +cd .. +git clone https://github.com/slonl/curriculum-search-server.git +cd curriculum-search-server +git pull +npm update +cd .. +git clone https://github.com/slonl/curriculum-store.git +cd curriculum-store +git pull +cd scripts +./init.sh +cd .. +npm update +cd scripts +node tojsontag.mjs +node convert.mjs ../data/curriculum.jsontag ../data/data.json +cd .. +npm update +echo project installation completed succesfully, you can now start docker with "docker compose up" \ No newline at end of file From b39ad414f1980d129510d1c577359bae8e130344 Mon Sep 17 00:00:00 2001 From: "govert@muze.nl" Date: Tue, 28 Jan 2025 14:18:17 +0100 Subject: [PATCH 2/7] added some verbose hints as to what to do once the script is run --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c8074cb..a2b1a61 100755 --- a/install.sh +++ b/install.sh @@ -27,4 +27,5 @@ node tojsontag.mjs node convert.mjs ../data/curriculum.jsontag ../data/data.json cd .. npm update -echo project installation completed succesfully, you can now start docker with "docker compose up" \ No newline at end of file +echo project installation completed succesfully, please add apikeys.json +echo after adding the apikeys and editors, you can now start docker with "docker compose up" \ No newline at end of file From b4856ce5a325e5fe8123c031ee620d9bec3a52a9 Mon Sep 17 00:00:00 2001 From: "govert@muze.nl" Date: Tue, 28 Jan 2025 14:28:07 +0100 Subject: [PATCH 3/7] updated readme file --- README.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a6790bd..1679345 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,29 @@ # Curriculum Rest API Development -This repository contains a development environment for the opendata.slo.nl curriculum rest api. The rest api needs a working graphql server, so that is also included, but there should be no need for further development here. +This repository contains a development environment for the opendata.slo.nl curriculum rest api. ## Setup +Requires: node and git to be installed. + +from the root folder (curriculum-restapi-dev): + ```bash -cd curriculum-graphql-server -git submodule update --init -git submodule foreach 'git checkout editor' -cd .. +./install.sh ``` +Once the install script is run, the apiKeys.json and editors.json need to be added in the curriculum-rest-api folder. + ## Usage +Requires: docker installed. + +from the root folder (curriculum-restapi-dev): + ```bash -docker-compose up +docker compose up ``` -This starts two docker images, one for the rest api on localhost:4500. And one for the graphql server on localhost:3500. - -The startup of the graphql server can take a few minutes, it will also run npm install and fetch all the data from the submodules and combine them in a single json file for the graphql server. +This starts two docker images, one for the rest api on localhost:4500. And one for the simplystore server on localhost:3500. ## Todo - -In production the rest api runs with an apache server as proxy. This server also provides the static assets (css, images, etc.) These are currently missing in this setup. - From bb3443875c4525e06067bc789436e9f2e3d2bcb7 Mon Sep 17 00:00:00 2001 From: "govert@muze.nl" Date: Tue, 18 Feb 2025 13:53:04 +0100 Subject: [PATCH 4/7] updated install script --- install.sh | 70 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/install.sh b/install.sh index a2b1a61..e4bbec9 100755 --- a/install.sh +++ b/install.sh @@ -5,27 +5,49 @@ set -o errtrace # Exit on error inside any functions or sub-shells. set -o nounset # Exit script on use of an undefined variable. set -o pipefail # Return exit status of the last command in the pipe that exited with a non-zero exit code -git clone https://github.com/slonl/curriculum-rest-api.git -cd curriculum-rest-api -git pull -npm update -cd .. -git clone https://github.com/slonl/curriculum-search-server.git -cd curriculum-search-server -git pull -npm update -cd .. -git clone https://github.com/slonl/curriculum-store.git -cd curriculum-store -git pull -cd scripts -./init.sh -cd .. -npm update -cd scripts -node tojsontag.mjs -node convert.mjs ../data/curriculum.jsontag ../data/data.json -cd .. -npm update -echo project installation completed succesfully, please add apikeys.json -echo after adding the apikeys and editors, you can now start docker with "docker compose up" \ No newline at end of file +install() { + aggregateData() { + local sPath + readonly sPath="${1?One parameters required: }" + + pushd "${sPath}/curriculum-store/scripts/" + + bash ./init.sh + node tojsontag.mjs + node convert.mjs "${sPath}/curriculum-store/data/curriculum.jsontag" "${sPath}/curriculum-store/data/data.json" + } + + installRepos(){ + local sPath + readonly sPath="${1?One parameters required: }" + + git -C "${sPath}" clone https://github.com/slonl/curriculum-rest-api.git + npm --prefix "${sPath}/curriculum-rest-api" update + + + git -C "${sPath}" clone https://github.com/slonl/curriculum-search-server.git + npm --prefix "${sPath}/curriculum-search-server" update + + git -C "${sPath}" clone https://github.com/slonl/curriculum-store.git + npm --prefix "${sPath}/curriculum-store" update + } + + local sRootPath + readonly sRootPath="${1?One parameters required: }" + + installRepos "${sRootPath}" + aggregateData "${sRootPath}" + + echo 'Project installation completed successfully. Please take the following steps:' + echo '' + echo '1. Add "apikeys.json" in curriculum-rest-api folder' + echo '2. If you want to edit data, add "editors.json" in curriculum-rest-api folder' + echo '3. Start docker using the "docker compose up" command from curriculum-restapi-dev folder' +} + +if [ "${BASH_SOURCE[0]}" != "${0}" ]; then + export -f install +else + # Replace "${PWD}" with "${@}" to allow passing in a path to the script + install "${PWD}" +fi \ No newline at end of file From d10d50b7c604070c47aa6d5770ee5e63d3a2c89a Mon Sep 17 00:00:00 2001 From: "govert@muze.nl" Date: Tue, 18 Feb 2025 15:57:38 +0100 Subject: [PATCH 5/7] added better follow up prompt --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index e4bbec9..4cc1062 100755 --- a/install.sh +++ b/install.sh @@ -42,7 +42,8 @@ install() { echo '' echo '1. Add "apikeys.json" in curriculum-rest-api folder' echo '2. If you want to edit data, add "editors.json" in curriculum-rest-api folder' - echo '3. Start docker using the "docker compose up" command from curriculum-restapi-dev folder' + echo '3. (optional) Make sure to select the correct branches in curriculum-rest-api' + echo '4. Start docker using the "docker compose up" command from curriculum-restapi-dev folder' } if [ "${BASH_SOURCE[0]}" != "${0}" ]; then From bffb3e2008f6cf58a4b2c38d633fe30c79308a83 Mon Sep 17 00:00:00 2001 From: "govert@muze.nl" Date: Tue, 1 Jul 2025 09:54:43 +0200 Subject: [PATCH 6/7] updated install script so the convert.mjs works again --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 4cc1062..80bf053 100755 --- a/install.sh +++ b/install.sh @@ -14,7 +14,7 @@ install() { bash ./init.sh node tojsontag.mjs - node convert.mjs "${sPath}/curriculum-store/data/curriculum.jsontag" "${sPath}/curriculum-store/data/data.json" + node convert.mjs "${sPath}/curriculum-store/data/schema.jsontag" "${sPath}/curriculum-store/data/curriculum.jsontag" "${sPath}/curriculum-store/data/data.jsontag" } installRepos(){ From a2e66ad433c6a19e3445b6e3c05dfe161e9377f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Govert=20Comb=C3=A9e?= Date: Wed, 21 Jan 2026 15:40:20 +0100 Subject: [PATCH 7/7] Update install.sh script update to support the added registration app --- install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 80bf053..60f8d3f 100755 --- a/install.sh +++ b/install.sh @@ -21,6 +21,9 @@ install() { local sPath readonly sPath="${1?One parameters required: }" + git -C "${sPath}"https://github.com/slonl/curriculum-registration-app.git + npm --prefix "${sPath}/curriculum-registration-app" update + git -C "${sPath}" clone https://github.com/slonl/curriculum-rest-api.git npm --prefix "${sPath}/curriculum-rest-api" update @@ -51,4 +54,4 @@ if [ "${BASH_SOURCE[0]}" != "${0}" ]; then else # Replace "${PWD}" with "${@}" to allow passing in a path to the script install "${PWD}" -fi \ No newline at end of file +fi