diff --git a/.gitignore b/.gitignore index 40759e9f..532faabf 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ venv support # openshift config check folder -app-config/openshift/test-cara +app-config/openshift/caimira-test app-config/openshift/cara-prod # documentation build folder diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f57bc054..bd388e32 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,17 +18,17 @@ variables: # ################################################################################################### # Test code -# A full installation of CARA, tested with pytest. +# A full installation of CAiMIRA, tested with pytest. test_install: extends: .acc_py_full_test -# A development installation of CARA tested with pytest. +# A development installation of CAiMIRA tested with pytest. test_dev: extends: .acc_py_dev_test -# A development installation of CARA tested with pytest. +# A development installation of CAiMIRA tested with pytest. test_dev-39: variables: PY_VERSION: "3.9" @@ -55,30 +55,30 @@ test_dev-39: script: - cd ./app-config/openshift - oc login ${OC_SERVER} --token="${OC_TOKEN}" - - python ./config-fetch.py ${CARA_INSTANCE} --output-directory ./${CARA_INSTANCE}/actual - - python ./config-generate.py ${CARA_INSTANCE} --output-directory ./${CARA_INSTANCE}/expected - - python ./config-normalise.py ./${CARA_INSTANCE}/actual ./${CARA_INSTANCE}/actual-normed - - python ./config-normalise.py ./${CARA_INSTANCE}/expected ./${CARA_INSTANCE}/expected-normed - - diff -u ./${CARA_INSTANCE}/actual-normed/ ./${CARA_INSTANCE}/expected-normed/ + - python ./config-fetch.py ${CAIMIRA_INSTANCE} --output-directory ./${CAIMIRA_INSTANCE}/actual + - python ./config-generate.py ${CAIMIRA_INSTANCE} --output-directory ./${CAIMIRA_INSTANCE}/expected + - python ./config-normalise.py ./${CAIMIRA_INSTANCE}/actual ./${CAIMIRA_INSTANCE}/actual-normed + - python ./config-normalise.py ./${CAIMIRA_INSTANCE}/expected ./${CAIMIRA_INSTANCE}/expected-normed + - diff -u ./${CAIMIRA_INSTANCE}/actual-normed/ ./${CAIMIRA_INSTANCE}/expected-normed/ artifacts: paths: - - ./app-config/openshift/${CARA_INSTANCE}/actual - - ./app-config/openshift/${CARA_INSTANCE}/expected + - ./app-config/openshift/${CAIMIRA_INSTANCE}/actual + - ./app-config/openshift/${CAIMIRA_INSTANCE}/expected check_openshift_config_test: extends: .test_openshift_config variables: - CARA_INSTANCE: 'test-cara' - BRANCH: 'live/test-cara' + CAIMIRA_INSTANCE: 'caimira-test' + BRANCH: 'live/caimira-test' OC_SERVER: https://api.paas.okd.cern.ch - OC_TOKEN: "${OPENSHIFT_TEST_CONFIG_CHECKER_TOKEN}" + OC_TOKEN: "${OPENSHIFT_CAIMIRA_TEST_CONFIG_CHECKER_TOKEN}" check_openshift_config_prod: extends: .test_openshift_config variables: - CARA_INSTANCE: 'cara-prod' + CAIMIRA_INSTANCE: 'cara-prod' BRANCH: 'master' OC_SERVER: https://api.paas.okd.cern.ch OC_TOKEN: "${OPENSHIFT_PROD_CONFIG_CHECKER_TOKEN}" @@ -91,9 +91,9 @@ check_openshift_config_prod: # Build and push images to the openshift instance, which automatically triggers an application re-deployment. stage: docker-build rules: - - if: '$CI_COMMIT_BRANCH == "live/test-cara"' + - if: '$CI_COMMIT_BRANCH == "live/caimira-test"' variables: - IMAGE_TAG: test-cara-latest + IMAGE_TAG: caimira-test-latest - if: '$CI_COMMIT_BRANCH == "master"' variables: IMAGE_TAG: cara-prod-latest @@ -141,11 +141,11 @@ oci_calculator: stage: oc-tag image: gitlab-registry.cern.ch/paas-tools/openshift-client:latest rules: - - if: '$CI_COMMIT_BRANCH == "live/test-cara"' + - if: '$CI_COMMIT_BRANCH == "live/caimira-test"' variables: - OC_PROJECT: "test-cara" - OC_TOKEN: ${OPENSHIFT_TEST_DEPLOY_TOKEN} - IMAGE_TAG: test-cara-latest + OC_PROJECT: "caimira-test" + OC_TOKEN: ${OPENSHIFT_CAIMIRA_TEST_DEPLOY_TOKEN} + IMAGE_TAG: caimira-test-latest - if: '$CI_COMMIT_BRANCH == "master"' variables: OC_PROJECT: "cara-prod" @@ -174,15 +174,15 @@ link_calculator_with_gitlab_registry: # ################################################################################################### -# Trigger build of CARA router on OpenShift +# Trigger build of CAiMIRA router on OpenShift trigger_cara-router_build_on_openshift: stage: deploy rules: - - if: '$CI_COMMIT_BRANCH == "live/test-cara"' + - if: '$CI_COMMIT_BRANCH == "live/caimira-test"' variables: - OC_PROJECT: "test-cara" - BUILD_WEBHOOK_SECRET: ${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET} + OC_PROJECT: "caimira-test" + BUILD_WEBHOOK_SECRET: ${OPENSHIFT_CAIMIRA_TEST_BUILD_WEBHOOK_SECRET} - if: '$CI_COMMIT_BRANCH == "master"' variables: OC_PROJECT: "cara-prod" diff --git a/README.md b/README.md index a2f46245..5e5933f6 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ docker build . -f ./app-config/cara-webservice/Dockerfile -t cara-webservice docker build ./app-config/auth-service -t auth-service ``` -Get the client secret from the CERN Application portal for the `cara-test` app. See [CERN-SSO-integration](#CERN-SSO-integration) for more info. +Get the client secret from the CERN Application portal for the `caimira-test` app. See [CERN-SSO-integration](#CERN-SSO-integration) for more info. ``` read CLIENT_SECRET ``` @@ -161,7 +161,7 @@ Define some env vars (copy/paste): export COOKIE_SECRET=$(openssl rand -hex 50) export OIDC_SERVER=https://auth.cern.ch/auth export OIDC_REALM=CERN -export CLIENT_ID=cara-test +export CLIENT_ID=caimira-test export CLIENT_SECRET ``` @@ -181,15 +181,15 @@ The https://cern.ch/cara application is running on CERN's OpenShift platform. In * Created a Python 3.6 (the highest possible at the time of writing) application in OpenShift * Configured a generic webhook on OpenShift, and call that from the CI of the GitLab repository -### Updating the test-cara.web.cern.ch instance +### Updating the caimira-test.web.cern.ch instance -We have a replica of https://cara.web.cern.ch running on http://test-cara.web.cern.ch. Its purpose is to simulate what will happen when -a feature is merged. To push your changes to test-cara, simply push your branch to `live/test-cara` and the CI pipeline will trigger the +We have a replica of https://cara.web.cern.ch running on http://caimira-test.web.cern.ch. Its purpose is to simulate what will happen when +a feature is merged. To push your changes to caimira-test, simply push your branch to `live/caimira-test` and the CI pipeline will trigger the deployment. To push to this branch, there is a good chance that you will need to force push - you should always force push with care and understanding why you are doing it. Syntactically, it will look something like (assuming that you have "upstream" as your remote name, but it may be origin if you haven't configured it differently): - git push --force upstream name-of-local-branch:live/test-cara + git push --force upstream name-of-local-branch:live/caimira-test ## OpenShift templates @@ -205,7 +205,7 @@ $ oc login https://api.paas.okd.cern.ch Then, switch to the project that you want to update: ```console -$ oc project cara-test +$ oc project caimira-test ``` Create a new service account in OpenShift to use GitLab container registry: @@ -256,8 +256,8 @@ $ cd app-config/openshift $ oc process -f configmap.yaml | oc create -f - $ oc process -f services.yaml | oc create -f - $ oc process -f imagestreams.yaml | oc create -f - -$ oc process -f buildconfig.yaml --param GIT_BRANCH='live/test-cara' | oc create -f - -$ oc process -f deploymentconfig.yaml --param PROJECT_NAME='cara-test' | oc create -f - +$ oc process -f buildconfig.yaml --param GIT_BRANCH='live/caimira-test' | oc create -f - +$ oc process -f deploymentconfig.yaml --param PROJECT_NAME='caimira-test' | oc create -f - ``` ### CERN SSO integration @@ -265,12 +265,12 @@ $ oc process -f deploymentconfig.yaml --param PROJECT_NAME='cara-test' | oc cre The SSO integration uses OpenID credentials configured in [CERN Applications portal](https://application-portal.web.cern.ch/). How to configure the application: -* Application Identifier: `cara-test` -* Homepage: `https://test-cara.web.cern.ch` +* Application Identifier: `caimira-test` +* Homepage: `https://caimira-test.web.cern.ch` * Administrators: `cara-dev` * SSO Registration: * Protocol: `OpenID (OIDC)` - * Redirect URI: `https://test-cara.web.cern.ch/auth/authorize` + * Redirect URI: `https://caimira-test.web.cern.ch/auth/authorize` * Leave unchecked all the other checkboxes * Define new roles: * Name: `CERN Users` @@ -318,8 +318,8 @@ $ cd app-config/openshift $ oc process -f configmap.yaml | oc replace -f - $ oc process -f services.yaml | oc replace -f - $ oc process -f imagestreams.yaml | oc replace -f - -$ oc process -f buildconfig.yaml --param GIT_BRANCH='live/test-cara' | oc replace -f - -$ oc process -f deploymentconfig.yaml --param PROJECT_NAME='cara-test' | oc replace -f - +$ oc process -f buildconfig.yaml --param GIT_BRANCH='live/caimira-test' | oc replace -f - +$ oc process -f deploymentconfig.yaml --param PROJECT_NAME='caimira-test' | oc replace -f - ``` Be aware that if you create/recreate the environment you must manually create a **route** in OpenShift, diff --git a/app-config/nginx/nginx.conf b/app-config/nginx/nginx.conf index fb69f77a..61e50a1a 100644 --- a/app-config/nginx/nginx.conf +++ b/app-config/nginx/nginx.conf @@ -82,7 +82,7 @@ http { error_page 404 = @proxy_404_error_handler; # cara-app is the name of the voila server in each of docker-compose, - # test-cara.web.cern.ch and cara.web.cern.ch. + # caimira-test.web.cern.ch and cara.web.cern.ch. proxy_pass http://cara-app:8080/voila-server/; } rewrite ^/expert-app$ /voila-server/voila/render/cara.ipynb last; @@ -108,7 +108,7 @@ http { error_page 401 = @error401; # cara-webservice is the name of the tornado server (for the calculator) - # in each of docker-compose, test-cara.web.cern.ch and cara.web.cern.ch. + # in each of docker-compose, caimira-test.web.cern.ch and cara.web.cern.ch. proxy_pass http://cara-webservice:8080/calculator-cern; } diff --git a/app-config/openshift/buildconfig.yaml b/app-config/openshift/buildconfig.yaml index 9bcbc165..5123ce4b 100644 --- a/app-config/openshift/buildconfig.yaml +++ b/app-config/openshift/buildconfig.yaml @@ -24,8 +24,6 @@ ref: ${GIT_BRANCH} uri: ${GIT_REPO} contextDir: app-config/nginx - sourceSecret: - name: sshdeploykey postCommit: {} resources: {} runPolicy: Serial @@ -52,7 +50,7 @@ parameters: - name: GIT_REPO description: The GIT repo URL - value: 'ssh://git@gitlab.cern.ch:7999/cara/cara.git' + value: 'https://gitlab.cern.ch/cara/cara.git' - name: GIT_BRANCH - description: The name of the GIT branch to use when building the app, e.g. `live/test-cara` in TEST, `master` in prod + description: The name of the GIT branch to use when building the app, e.g. `live/caimira-test` in TEST, `master` in prod required: true diff --git a/app-config/openshift/config-fetch.py b/app-config/openshift/config-fetch.py index c596c31c..1080def9 100644 --- a/app-config/openshift/config-fetch.py +++ b/app-config/openshift/config-fetch.py @@ -9,7 +9,7 @@ def configure_parser(parser: argparse.ArgumentParser) -> None: parser.description = "Fetch the openshift config for CARA" parser.set_defaults(handler=handler) parser.add_argument( - "instance", choices=['cara-prod', 'test-cara'], + "instance", choices=['cara-prod', 'caimira-test'], help="Pick the instance for which you want to fetch the config", ) parser.add_argument( @@ -55,8 +55,8 @@ def handler(args: argparse.ArgumentParser) -> None: login_server = 'https://api.paas.okd.cern.ch:443' if args.instance == 'cara-prod': project_name = 'cara-prod' - elif args.instance == 'test-cara': - project_name = 'test-cara' + elif args.instance == 'caimira-test': + project_name = 'caimira-test' actual_login_server = get_oc_server() if actual_login_server != login_server: diff --git a/app-config/openshift/config-generate.py b/app-config/openshift/config-generate.py index 3a33db5b..e50ae975 100644 --- a/app-config/openshift/config-generate.py +++ b/app-config/openshift/config-generate.py @@ -8,7 +8,7 @@ def configure_parser(parser: argparse.ArgumentParser) -> None: parser.description = "Generate the config files which can be later submitted to openshift" parser.set_defaults(handler=handler) parser.add_argument( - "instance", choices=['cara-prod', 'test-cara'], + "instance", choices=['cara-prod', 'caimira-test'], help="Pick the instance for which you want to generate the config", ) parser.add_argument( @@ -42,10 +42,10 @@ def handler(args: argparse.ArgumentParser) -> None: project_name = 'cara-prod' branch = 'master' hostname = 'cara.web.cern.ch' - elif args.instance == 'test-cara': - project_name = 'test-cara' - branch = 'live/test-cara' - hostname = 'test-cara.web.cern.ch' + elif args.instance == 'caimira-test': + project_name = 'caimira-test' + branch = 'live/caimira-test' + hostname = 'caimira-test.web.cern.ch' generate_config(pathlib.Path(args.output_directory), project_name, hostname, branch) diff --git a/app-config/openshift/deploymentconfig.yaml b/app-config/openshift/deploymentconfig.yaml index 67d9e6e5..5ae7def6 100644 --- a/app-config/openshift/deploymentconfig.yaml +++ b/app-config/openshift/deploymentconfig.yaml @@ -331,5 +331,5 @@ parameters: - name: PROJECT_NAME - description: The name of this project, e.g. test-cara + description: The name of this project, e.g. caimira-test required: true diff --git a/app-config/openshift/routes.example.yaml b/app-config/openshift/routes.example.yaml index a7f0f0e1..00607825 100644 --- a/app-config/openshift/routes.example.yaml +++ b/app-config/openshift/routes.example.yaml @@ -32,6 +32,6 @@ parameters: - name: HOST - description: The hostname of the site, e.g. test-cara.web.cern.ch + description: The hostname of the site, e.g. caimira-test.web.cern.ch required: true diff --git a/cara/apps/static/js/usage-tracking.js b/cara/apps/static/js/usage-tracking.js index 60ac23c5..b0101b73 100644 --- a/cara/apps/static/js/usage-tracking.js +++ b/cara/apps/static/js/usage-tracking.js @@ -1,4 +1,4 @@ -if (document.location.hostname == "test-cara.web.cern.ch") { +if (document.location.hostname == "caimira-test.web.cern.ch") { var _paq = _paq || []; if (typeof AuthUserDomain !== 'undefined') { _paq.push(["setCustomVariable", 1, "AuthUserDomain", AuthUserDomain, "visit"]);