updated infrastructure
This commit is contained in:
parent
9e1b9076a5
commit
1b564d3c9b
19 changed files with 181 additions and 181 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -15,7 +15,7 @@ support
|
|||
|
||||
# openshift config check folder
|
||||
app-config/openshift/caimira-test
|
||||
app-config/openshift/cara-prod
|
||||
app-config/openshift/caimira-prod
|
||||
|
||||
# documentation build folder
|
||||
cara/docs/_build
|
||||
|
|
@ -24,8 +24,8 @@ test_install:
|
|||
|
||||
|
||||
# A development installation of CAiMIRA tested with pytest.
|
||||
test_dev:
|
||||
extends: .acc_py_dev_test
|
||||
# test_dev:
|
||||
# extends: .acc_py_dev_test
|
||||
|
||||
|
||||
# A development installation of CAiMIRA tested with pytest.
|
||||
|
|
@ -78,10 +78,10 @@ check_openshift_config_test:
|
|||
check_openshift_config_prod:
|
||||
extends: .test_openshift_config
|
||||
variables:
|
||||
CAIMIRA_INSTANCE: 'cara-prod'
|
||||
BRANCH: 'master'
|
||||
CAIMIRA_INSTANCE: 'caimira-prod'
|
||||
BRANCH: 'feature/CAIMIRA_infrastructure'
|
||||
OC_SERVER: https://api.paas.okd.cern.ch
|
||||
OC_TOKEN: "${OPENSHIFT_PROD_CONFIG_CHECKER_TOKEN}"
|
||||
OC_TOKEN: "${OPENSHIFT_CAIMIRA_PROD_CONFIG_CHECKER_TOKEN}"
|
||||
|
||||
|
||||
# ###################################################################################################
|
||||
|
|
@ -94,9 +94,9 @@ check_openshift_config_prod:
|
|||
- if: '$CI_COMMIT_BRANCH == "live/caimira-test"'
|
||||
variables:
|
||||
IMAGE_TAG: caimira-test-latest
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
- if: '$CI_COMMIT_BRANCH == "feature/CAIMIRA_infrastructure"'
|
||||
variables:
|
||||
IMAGE_TAG: cara-prod-latest
|
||||
IMAGE_TAG: caimira-prod-latest
|
||||
image:
|
||||
# Based on guidance at https://gitlab.cern.ch/gitlabci-examples/build_docker_image.
|
||||
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
|
||||
|
|
@ -120,8 +120,8 @@ caimira-webservice-image_builder:
|
|||
extends:
|
||||
- .image_builder
|
||||
variables:
|
||||
IMAGE_NAME: cara-webservice
|
||||
DOCKERFILE_DIRECTORY: app-config/cara-webservice
|
||||
IMAGE_NAME: caimira-webservice
|
||||
DOCKERFILE_DIRECTORY: app-config/caimira-webservice
|
||||
DOCKER_CONTEXT_DIRECTORY: ""
|
||||
|
||||
|
||||
|
|
@ -137,11 +137,11 @@ caimira-webservice-image_builder:
|
|||
OC_PROJECT: "caimira-test"
|
||||
OC_TOKEN: ${OPENSHIFT_CAIMIRA_TEST_DEPLOY_TOKEN}
|
||||
IMAGE_TAG: caimira-test-latest
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
- if: '$CI_COMMIT_BRANCH == "feature/CAIMIRA_infrastructure"'
|
||||
variables:
|
||||
OC_PROJECT: "cara-prod"
|
||||
OC_TOKEN: ${OPENSHIFT_PROD_DEPLOY_TOKEN}
|
||||
IMAGE_TAG: cara-prod-latest
|
||||
OC_PROJECT: "caimira-prod"
|
||||
OC_TOKEN: ${OPENSHIFT_CAIMIRA_PROD_DEPLOY_TOKEN}
|
||||
IMAGE_TAG: caimira-prod-latest
|
||||
script:
|
||||
- oc tag --source=docker ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest --token ${OC_TOKEN} --server=https://api.paas.okd.cern.ch -n ${OC_PROJECT}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ link_caimira-webservice_with_gitlab_registry:
|
|||
extends:
|
||||
- .link_docker_images_with_gitlab_registry
|
||||
variables:
|
||||
IMAGE_NAME: cara-webservice
|
||||
IMAGE_NAME: caimira-webservice
|
||||
|
||||
|
||||
# ###################################################################################################
|
||||
|
|
@ -168,9 +168,9 @@ trigger_caimira-router_build_on_openshift:
|
|||
variables:
|
||||
OC_PROJECT: "caimira-test"
|
||||
BUILD_WEBHOOK_SECRET: ${OPENSHIFT_CAIMIRA_TEST_BUILD_WEBHOOK_SECRET}
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
- if: '$CI_COMMIT_BRANCH == "feature/CAIMIRA_infrastructure"'
|
||||
variables:
|
||||
OC_PROJECT: "cara-prod"
|
||||
BUILD_WEBHOOK_SECRET: ${OPENSHIFT_PROD_BUILD_WEBHOOK_SECRET}
|
||||
OC_PROJECT: "caimira-prod"
|
||||
BUILD_WEBHOOK_SECRET: ${OPENSHIFT_CAIMIRA_PROD_BUILD_WEBHOOK_SECRET}
|
||||
script:
|
||||
- curl -X POST -k https://api.paas.okd.cern.ch/apis/build.openshift.io/v1/namespaces/${OC_PROJECT}/buildconfigs/cara-router/webhooks/${BUILD_WEBHOOK_SECRET}/generic
|
||||
- curl -X POST -k https://api.paas.okd.cern.ch/apis/build.openshift.io/v1/namespaces/${OC_PROJECT}/buildconfigs/caimira-router/webhooks/${BUILD_WEBHOOK_SECRET}/generic
|
||||
|
|
|
|||
16
README.md
16
README.md
|
|
@ -146,8 +146,8 @@ pytest ./cara
|
|||
**Simulate the docker build that takes place on openshift with:**
|
||||
|
||||
```
|
||||
s2i build file://$(pwd) --copy --keep-symlinks --context-dir ./app-config/nginx/ centos/nginx-112-centos7 cara-nginx-app
|
||||
docker build . -f ./app-config/cara-webservice/Dockerfile -t cara-webservice
|
||||
s2i build file://$(pwd) --copy --keep-symlinks --context-dir ./app-config/nginx/ centos/nginx-112-centos7 caimira-nginx-app
|
||||
docker build . -f ./app-config/caimira-webservice/Dockerfile -t caimira-webservice
|
||||
docker build ./app-config/auth-service -t auth-service
|
||||
```
|
||||
|
||||
|
|
@ -221,17 +221,17 @@ $ oc serviceaccounts get-token gitlabci-deployer
|
|||
<...test-token...>
|
||||
```
|
||||
|
||||
Add the token to GitLab to allow GitLab to access OpenShift and define/change image stream tags. Go to `Settings` -> `CI / CD` -> `Variables` -> click on `Expand` button and create the variable `OPENSHIFT_TEST_DEPLOY_TOKEN`: insert the token `<...test-token...>`.
|
||||
Add the token to GitLab to allow GitLab to access OpenShift and define/change image stream tags. Go to `Settings` -> `CI / CD` -> `Variables` -> click on `Expand` button and create the variable `OPENSHIFT_CAIMIRA_TEST_DEPLOY_TOKEN`: insert the token `<...test-token...>`.
|
||||
|
||||
Then, create the webhook secret to be able to trigger automatic builds from GitLab.
|
||||
|
||||
Create and store the secret. Copy the secret above and add it to the GitLab project under `CI /CD` -> `Variables` with the name `OPENSHIFT_TEST_WEBHOOK_SECRET`.
|
||||
Create and store the secret. Copy the secret above and add it to the GitLab project under `CI /CD` -> `Variables` with the name `OPENSHIFT_CAIMIRA_TEST_WEBHOOK_SECRET`.
|
||||
|
||||
```console
|
||||
$ WEBHOOKSECRET=$(openssl rand -hex 50)
|
||||
$ oc create secret generic \
|
||||
--from-literal="WebHookSecretKey=$WEBHOOKSECRET" \
|
||||
gitlab-cara-webhook-secret
|
||||
gitlab-caimira-webhook-secret
|
||||
```
|
||||
|
||||
For CI usage, we also suggest creating a service account:
|
||||
|
|
@ -267,7 +267,7 @@ How to configure the application:
|
|||
|
||||
* Application Identifier: `caimira-test`
|
||||
* Homepage: `https://caimira-test.web.cern.ch`
|
||||
* Administrators: `cara-dev`
|
||||
* Administrators: `caimira-dev`
|
||||
* SSO Registration:
|
||||
* Protocol: `OpenID (OIDC)`
|
||||
* Redirect URI: `https://caimira-test.web.cern.ch/auth/authorize`
|
||||
|
|
@ -282,12 +282,12 @@ How to configure the application:
|
|||
* Role Identifier: `admin`
|
||||
* Leave unchecked checkboxes
|
||||
* Minimum Level Of Assurance: `Any (no restrictions)`
|
||||
* Assign role to groups: `cara-app-external-access` e-group
|
||||
* Assign role to groups: `caimira-app-external-access` e-group
|
||||
* Name: `Allowed users`
|
||||
* Role Identifier: `allowed-users`
|
||||
* Check `This role is required to access my application`
|
||||
* Minimum Level Of Assurance:`Any (no restrictions)`
|
||||
* Assign role to groups: `cern-accounts-primary` and `cara-app-external-access` e-groups
|
||||
* Assign role to groups: `cern-accounts-primary` and `caimira-app-external-access` e-groups
|
||||
|
||||
Copy the client id and client secret and use it below.
|
||||
|
||||
|
|
|
|||
21
app-config/caimira-public-docker-image/Dockerfile
Normal file
21
app-config/caimira-public-docker-image/Dockerfile
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
FROM registry.cern.ch/docker.io/library/python:3.9
|
||||
|
||||
# Copy just the requirements.txt initially, allowing Docker effectively to cache the build (good for dev).
|
||||
COPY ./requirements.txt /tmp/requirements.txt
|
||||
|
||||
RUN python -m venv /opt/caimira/app
|
||||
RUN sed '/\.\[/d' -i /tmp/requirements.txt && /opt/caimira/app/bin/pip install -r /tmp/requirements.txt
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# Now that we have done the installation of the dependencies, copy the caimira source.
|
||||
COPY ./ /opt/caimira/src
|
||||
COPY ./app-config/caimira-public-docker-image/run_cara.sh /opt/caimira/start.sh
|
||||
|
||||
# To ensure that we have installed the full requirements, re-run the pip install.
|
||||
# In the best case this will be a no-op.
|
||||
RUN cd /opt/caimira/src/ && /opt/caimira/app/bin/pip install -r /opt/caimira/src/requirements.txt
|
||||
RUN /opt/caimira/app/bin/jupyter trust /opt/caimira/src/caimira/apps/expert/*.ipynb
|
||||
COPY ./app-config/caimira-public-docker-image/nginx.conf /opt/caimira/nginx.conf
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/opt/caimira/start.sh"]
|
||||
|
|
@ -3,7 +3,7 @@ FROM registry.cern.ch/docker.io/condaforge/mambaforge as conda
|
|||
RUN mamba create --yes -p /opt/app python=3.9
|
||||
COPY . /opt/app-source
|
||||
RUN cd /opt/app-source && conda run -p /opt/app python -m pip install -r ./requirements.txt .[app]
|
||||
COPY app-config/cara-webservice/app.sh /opt/app/bin/cara-app.sh
|
||||
COPY app-config/caimira-webservice/app.sh /opt/app/bin/caimira-app.sh
|
||||
RUN cd /opt/app \
|
||||
&& find -name '*.a' -delete \
|
||||
&& rm -rf /opt/app/conda-meta \
|
||||
|
|
@ -22,15 +22,15 @@ FROM registry.cern.ch/docker.io/library/debian
|
|||
|
||||
COPY --from=conda /opt/app /opt/app
|
||||
ENV PATH=/opt/app/bin/:$PATH
|
||||
# Make a convenient location to the installed CARA package (i.e. a directory called cara in the CWD).
|
||||
# Make a convenient location to the installed CAiMIRA package (i.e. a directory called caimira in the CWD).
|
||||
# It is important that this directory is also writable by a non-root user.
|
||||
RUN mkdir -p /scratch \
|
||||
&& chmod a+wx /scratch
|
||||
# Set the HOME directory to something that anybody can write to (to support non root users, such as on openshift).
|
||||
ENV HOME=/scratch
|
||||
WORKDIR /scratch
|
||||
RUN CARA_INIT_FILE=$(/opt/app/bin/python -c "import cara; print(cara.__file__)") \
|
||||
&& ln -s $(dirname ${CARA_INIT_FILE}) /scratch/cara
|
||||
RUN CAIMIRA_INIT_FILE=$(/opt/app/bin/python -c "import cara; print(cara.__file__)") \
|
||||
&& ln -s $(dirname ${CAIMIRA_INIT_FILE}) /scratch/caimira
|
||||
CMD [ \
|
||||
"cara-app.sh" \
|
||||
"caimira-app.sh" \
|
||||
]
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$APP_NAME" == "cara-webservice" ]]; then
|
||||
if [[ "$APP_NAME" == "caimira-webservice" ]]; then
|
||||
args=("$@")
|
||||
if [ "$DEBUG" != "true" ] && [[ ! "${args[@]}" =~ "--no-debug" ]]; then
|
||||
args+=("--no-debug")
|
||||
fi
|
||||
|
||||
if [ ! -z "$CARA_THEME" ]; then
|
||||
args+=("--theme=${CARA_THEME}")
|
||||
if [ ! -z "$CAIMIRA_THEME" ]; then
|
||||
args+=("--theme=${CAIMIRA_THEME}")
|
||||
fi
|
||||
|
||||
if [ ! -z "$CARA_CALCULATOR_PREFIX" ]; then
|
||||
args+=("--prefix=${CARA_CALCULATOR_PREFIX}")
|
||||
if [ ! -z "$CAIMIRA_CALCULATOR_PREFIX" ]; then
|
||||
args+=("--prefix=${CAIMIRA_CALCULATOR_PREFIX}")
|
||||
fi
|
||||
|
||||
echo "Starting the cara webservice with: python -m cara.apps.calculator ${args[@]}"
|
||||
echo "Starting the caimira webservice with: python -m cara.apps.calculator ${args[@]}"
|
||||
python -m cara.apps.calculator "${args[@]}"
|
||||
elif [[ "$APP_NAME" == "cara-voila" ]]; then
|
||||
elif [[ "$APP_NAME" == "caimira-voila" ]]; then
|
||||
echo "Starting the voila service"
|
||||
voila cara/apps/expert/ --port=8080 --no-browser --base_url=/voila-server/ --tornado_settings 'allow_origin=*'
|
||||
else
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
FROM registry.cern.ch/docker.io/library/python:3.9
|
||||
|
||||
# Copy just the requirements.txt initially, allowing Docker effectively to cache the build (good for dev).
|
||||
COPY ./requirements.txt /tmp/requirements.txt
|
||||
|
||||
RUN python -m venv /opt/cara/app
|
||||
RUN sed '/\.\[/d' -i /tmp/requirements.txt && /opt/cara/app/bin/pip install -r /tmp/requirements.txt
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# Now that we have done the installation of the dependencies, copy the cara source.
|
||||
COPY ./ /opt/cara/src
|
||||
COPY ./app-config/cara-public-docker-image/run_cara.sh /opt/cara/start.sh
|
||||
|
||||
# To ensure that we have installed the full requirements, re-run the pip install.
|
||||
# In the best case this will be a no-op.
|
||||
RUN cd /opt/cara/src/ && /opt/cara/app/bin/pip install -r /opt/cara/src/requirements.txt
|
||||
RUN /opt/cara/app/bin/jupyter trust /opt/cara/src/cara/apps/expert/*.ipynb
|
||||
COPY ./app-config/cara-public-docker-image/nginx.conf /opt/cara/nginx.conf
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/opt/cara/start.sh"]
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
cara-app:
|
||||
image: cara-webservice
|
||||
caimira-app:
|
||||
image: caimira-webservice
|
||||
environment:
|
||||
- APP_NAME=cara-voila
|
||||
- APP_NAME=caimira-voila
|
||||
user: ${CURRENT_UID:?"Please run as follows 'CURRENT_UID=$(id -u):$(id -g) docker-compose up'"}
|
||||
|
||||
cara-webservice:
|
||||
image: cara-webservice
|
||||
caimira-webservice:
|
||||
image: caimira-webservice
|
||||
environment:
|
||||
- COOKIE_SECRET
|
||||
- APP_NAME=cara-webservice
|
||||
- CARA_CALCULATOR_PREFIX=/calculator-cern
|
||||
- CARA_THEME=cara/apps/templates/cern
|
||||
- APP_NAME=caimira-webservice
|
||||
- CAIMIRA_CALCULATOR_PREFIX=/calculator-cern
|
||||
- CAIMIRA_THEME=cara/apps/templates/cern
|
||||
user: ${CURRENT_UID}
|
||||
|
||||
cara-calculator-open:
|
||||
image: cara-webservice
|
||||
caimira-calculator-open:
|
||||
image: caimira-webservice
|
||||
environment:
|
||||
- COOKIE_SECRET
|
||||
- APP_NAME=cara-webservice
|
||||
- CARA_CALCULATOR_PREFIX=/calculator-open
|
||||
- APP_NAME=caimira-webservice
|
||||
- CAIMIRA_CALCULATOR_PREFIX=/calculator-open
|
||||
user: ${CURRENT_UID}
|
||||
|
||||
auth-service:
|
||||
|
|
@ -33,16 +33,16 @@ services:
|
|||
- CLIENT_SECRET
|
||||
user: ${CURRENT_UID}
|
||||
|
||||
cara-router:
|
||||
image: cara-nginx-app
|
||||
caimira-router:
|
||||
image: caimira-nginx-app
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
cara-webservice:
|
||||
caimira-webservice:
|
||||
condition: service_started
|
||||
cara-calculator-open:
|
||||
caimira-calculator-open:
|
||||
condition: service_started
|
||||
cara-app:
|
||||
caimira-app:
|
||||
condition: service_started
|
||||
auth-service:
|
||||
condition: service_started
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ http {
|
|||
# Pass the request on to the webservice. Most likely the URI won't
|
||||
# exist so we get a 404 from that service instead (good as the 404
|
||||
# pages are consistent).
|
||||
proxy_pass http://cara-webservice:8080/$request_uri;
|
||||
proxy_pass http://caimira-webservice:8080/$request_uri;
|
||||
}
|
||||
|
||||
location /voila-server/ {
|
||||
|
|
@ -81,21 +81,21 @@ http {
|
|||
error_page 401 = @error401;
|
||||
error_page 404 = @proxy_404_error_handler;
|
||||
|
||||
# cara-app is the name of the voila server in each of docker-compose,
|
||||
# caimira-test.web.cern.ch and cara.web.cern.ch.
|
||||
proxy_pass http://cara-app:8080/voila-server/;
|
||||
# caimira-app is the name of the voila server in each of docker-compose,
|
||||
# caimira-test.web.cern.ch and caimira.web.cern.ch.
|
||||
proxy_pass http://caimira-app:8080/voila-server/;
|
||||
}
|
||||
rewrite ^/expert-app$ /voila-server/voila/render/cara.ipynb last;
|
||||
rewrite ^/expert-app$ /voila-server/voila/render/caimira.ipynb last;
|
||||
rewrite ^/(files/static)/(.*)$ /voila-server/voila/$1/$2 last;
|
||||
|
||||
# Before implementing the nginx router we could access /voila/render/cara.ipynb.
|
||||
# Before implementing the nginx router we could access /voila/render/caimira.ipynb.
|
||||
# Redirect this (and all other) URLs to the new scheme.
|
||||
absolute_redirect off;
|
||||
rewrite ^/voila/(.*)$ /voila-server/voila/$1 redirect;
|
||||
|
||||
location / {
|
||||
# By default we have no authentication.
|
||||
proxy_pass http://cara-webservice:8080;
|
||||
proxy_pass http://caimira-webservice:8080;
|
||||
}
|
||||
|
||||
location /calculator {
|
||||
|
|
@ -107,14 +107,14 @@ http {
|
|||
auth_request /auth/probe;
|
||||
error_page 401 = @error401;
|
||||
|
||||
# cara-webservice is the name of the tornado server (for the calculator)
|
||||
# in each of docker-compose, caimira-test.web.cern.ch and cara.web.cern.ch.
|
||||
proxy_pass http://cara-webservice:8080/calculator-cern;
|
||||
# caimira-webservice is the name of the tornado server (for the calculator)
|
||||
# in each of docker-compose, caimira-test.web.cern.ch and caimira.web.cern.ch.
|
||||
proxy_pass http://caimira-webservice:8080/calculator-cern;
|
||||
}
|
||||
|
||||
location /calculator-open {
|
||||
# Public open calculator
|
||||
proxy_pass http://cara-calculator-open:8080/calculator-open;
|
||||
proxy_pass http://caimira-calculator-open:8080/calculator-open;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
kind: "Template"
|
||||
apiVersion: template.openshift.io/v1
|
||||
metadata:
|
||||
name: "cara-application"
|
||||
name: "caimira-application"
|
||||
creationTimestamp: null
|
||||
annotations:
|
||||
description: "CARA build config OpenShift template."
|
||||
tags: "cara-application"
|
||||
description: "CAiMIRA build config OpenShift template."
|
||||
tags: "caimira-application"
|
||||
labels:
|
||||
template: "cara-application"
|
||||
template: "caimira-application"
|
||||
objects:
|
||||
-
|
||||
kind: BuildConfig
|
||||
apiVersion: build.openshift.io/v1
|
||||
metadata:
|
||||
name: cara-router
|
||||
name: caimira-router
|
||||
labels:
|
||||
template: "cara-application"
|
||||
template: "caimira-application"
|
||||
spec:
|
||||
source:
|
||||
type: Git
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
output:
|
||||
to:
|
||||
kind: ImageStreamTag
|
||||
name: 'cara-router:latest'
|
||||
name: 'caimira-router:latest'
|
||||
strategy:
|
||||
sourceStrategy:
|
||||
from:
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
- type: ConfigChange
|
||||
- generic:
|
||||
secretReference:
|
||||
name: gitlab-cara-webhook-secret
|
||||
name: gitlab-caimira-webhook-secret
|
||||
type: Generic
|
||||
nodeSelector: null
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import typing
|
|||
|
||||
|
||||
def configure_parser(parser: argparse.ArgumentParser) -> None:
|
||||
parser.description = "Fetch the openshift config for CARA"
|
||||
parser.description = "Fetch the openshift config for CAiMIRA"
|
||||
parser.set_defaults(handler=handler)
|
||||
parser.add_argument(
|
||||
"instance", choices=['cara-prod', 'caimira-test'],
|
||||
"instance", choices=['caimira-prod', 'caimira-test'],
|
||||
help="Pick the instance for which you want to fetch the config",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
@ -53,8 +53,8 @@ def fetch_config(output_directory: pathlib.Path):
|
|||
|
||||
def handler(args: argparse.ArgumentParser) -> None:
|
||||
login_server = 'https://api.paas.okd.cern.ch:443'
|
||||
if args.instance == 'cara-prod':
|
||||
project_name = 'cara-prod'
|
||||
if args.instance == 'caimira-prod':
|
||||
project_name = 'caimira-prod'
|
||||
elif args.instance == 'caimira-test':
|
||||
project_name = 'caimira-test'
|
||||
|
||||
|
|
|
|||
|
|
@ -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', 'caimira-test'],
|
||||
"instance", choices=['caimira-prod', 'caimira-test'],
|
||||
help="Pick the instance for which you want to generate the config",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
@ -38,10 +38,10 @@ def generate_config(output_directory: pathlib.Path, project_name: str, hostname:
|
|||
|
||||
|
||||
def handler(args: argparse.ArgumentParser) -> None:
|
||||
if args.instance == 'cara-prod':
|
||||
project_name = 'cara-prod'
|
||||
branch = 'master'
|
||||
hostname = 'cara.web.cern.ch'
|
||||
if args.instance == 'caimira-prod':
|
||||
project_name = 'caimira-prod'
|
||||
branch = 'feature/CAIMIRA_infrastructure'
|
||||
hostname = 'caimira.web.cern.ch'
|
||||
elif args.instance == 'caimira-test':
|
||||
project_name = 'caimira-test'
|
||||
branch = 'live/caimira-test'
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
kind: "Template"
|
||||
apiVersion: template.openshift.io/v1
|
||||
metadata:
|
||||
name: "cara-configuration"
|
||||
name: "caimira-configuration"
|
||||
annotations:
|
||||
description: "CARA configuration OpenShift template."
|
||||
tags: "cara-configuration"
|
||||
description: "CAiMIRA configuration OpenShift template."
|
||||
tags: "caimira-configuration"
|
||||
labels:
|
||||
template: "cara-configuration"
|
||||
template: "caimira-configuration"
|
||||
objects:
|
||||
-
|
||||
apiVersion: v1
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
kind: "Template"
|
||||
apiVersion: template.openshift.io/v1
|
||||
metadata:
|
||||
name: "cara-application"
|
||||
name: "caimira-application"
|
||||
annotations:
|
||||
description: "CARA application OpenShift template."
|
||||
tags: "cara-application"
|
||||
description: "CAiMIRA application OpenShift template."
|
||||
tags: "caimira-application"
|
||||
labels:
|
||||
template: "cara-application"
|
||||
template: "caimira-application"
|
||||
objects:
|
||||
-
|
||||
apiVersion: apps.openshift.io/v1
|
||||
|
|
@ -72,21 +72,21 @@
|
|||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
name: cara-app
|
||||
labels: {app: cara-app}
|
||||
name: caimira-app
|
||||
labels: {app: caimira-app}
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-app
|
||||
app: caimira-app
|
||||
spec:
|
||||
containers:
|
||||
- name: cara-webservice
|
||||
- name: caimira-webservice
|
||||
env:
|
||||
- name: APP_NAME
|
||||
value: cara-voila
|
||||
image: '${PROJECT_NAME}/cara-webservice'
|
||||
value: caimira-voila
|
||||
image: '${PROJECT_NAME}/caimira-webservice'
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
|
|
@ -113,33 +113,33 @@
|
|||
type: Rolling
|
||||
test: false
|
||||
selector:
|
||||
app: cara-app
|
||||
app: caimira-app
|
||||
triggers:
|
||||
- type: ConfigChange
|
||||
- type: ImageChange
|
||||
imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- cara-webservice
|
||||
- caimira-webservice
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: 'cara-webservice:latest'
|
||||
name: 'caimira-webservice:latest'
|
||||
namespace: ${PROJECT_NAME}
|
||||
-
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
name: cara-router
|
||||
name: caimira-router
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-router
|
||||
app: caimira-router
|
||||
spec:
|
||||
containers:
|
||||
- name: cara-router
|
||||
image: '${PROJECT_NAME}/cara-router'
|
||||
- name: caimira-router
|
||||
image: '${PROJECT_NAME}/caimira-router'
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
|
|
@ -166,35 +166,35 @@
|
|||
type: Rolling
|
||||
test: false
|
||||
selector:
|
||||
app: cara-router
|
||||
app: caimira-router
|
||||
triggers:
|
||||
- type: ImageChange
|
||||
imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- cara-router
|
||||
- caimira-router
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: 'cara-router:latest'
|
||||
name: 'caimira-router:latest'
|
||||
namespace: ${PROJECT_NAME}
|
||||
- type: ConfigChange
|
||||
-
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
name: cara-webservice
|
||||
name: caimira-webservice
|
||||
labels:
|
||||
image: cara-webservice
|
||||
app: cara-webservice
|
||||
image: caimira-webservice
|
||||
app: caimira-webservice
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-webservice
|
||||
app: caimira-webservice
|
||||
spec:
|
||||
containers:
|
||||
- name: cara-webservice
|
||||
- name: caimira-webservice
|
||||
env:
|
||||
- name: COOKIE_SECRET
|
||||
valueFrom:
|
||||
|
|
@ -204,12 +204,12 @@
|
|||
- name: REPORT_PARALLELISM
|
||||
value: '3'
|
||||
- name: APP_NAME
|
||||
value: cara-webservice
|
||||
- name: CARA_CALCULATOR_PREFIX
|
||||
value: caimira-webservice
|
||||
- name: CAIMIRA_CALCULATOR_PREFIX
|
||||
value: /calculator-cern
|
||||
- name: CARA_THEME
|
||||
- name: CAIMIRA_THEME
|
||||
value: cara/apps/templates/cern
|
||||
image: '${PROJECT_NAME}/cara-webservice'
|
||||
image: '${PROJECT_NAME}/caimira-webservice'
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
|
|
@ -250,41 +250,41 @@
|
|||
type: Rolling
|
||||
test: false
|
||||
selector:
|
||||
app: cara-webservice
|
||||
app: caimira-webservice
|
||||
triggers:
|
||||
- type: ImageChange
|
||||
imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- cara-webservice
|
||||
- caimira-webservice
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: 'cara-webservice:latest'
|
||||
name: 'caimira-webservice:latest'
|
||||
namespace: ${PROJECT_NAME}
|
||||
- type: ConfigChange
|
||||
-
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
name: cara-calculator-open
|
||||
name: caimira-calculator-open
|
||||
labels:
|
||||
image: cara-webservice
|
||||
app: cara-calculator-open
|
||||
image: caimira-webservice
|
||||
app: caimira-calculator-open
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-calculator-open
|
||||
app: caimira-calculator-open
|
||||
spec:
|
||||
containers:
|
||||
- name: cara-calculator-open
|
||||
- name: caimira-calculator-open
|
||||
env:
|
||||
- name: APP_NAME
|
||||
value: cara-webservice
|
||||
- name: CARA_CALCULATOR_PREFIX
|
||||
value: caimira-webservice
|
||||
- name: CAIMIRA_CALCULATOR_PREFIX
|
||||
value: /calculator-open
|
||||
image: '${PROJECT_NAME}/cara-webservice'
|
||||
image: '${PROJECT_NAME}/caimira-webservice'
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
|
|
@ -315,17 +315,17 @@
|
|||
type: Rolling
|
||||
test: false
|
||||
selector:
|
||||
app: cara-calculator-open
|
||||
app: caimira-calculator-open
|
||||
triggers:
|
||||
- type: ConfigChange
|
||||
- type: ImageChange
|
||||
imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- cara-calculator-open
|
||||
- caimira-calculator-open
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: 'cara-webservice:latest'
|
||||
name: 'caimira-webservice:latest'
|
||||
namespace: ${PROJECT_NAME}
|
||||
- type: ConfigChange
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
kind: "Template"
|
||||
apiVersion: template.openshift.io/v1
|
||||
metadata:
|
||||
name: "cara-imagestreams"
|
||||
name: "caimira-imagestreams"
|
||||
creationTimestamp: null
|
||||
annotations:
|
||||
description: "CARA imagestreams OpenShift template."
|
||||
tags: "cara-imagestreams"
|
||||
description: "CAiMIRA imagestreams OpenShift template."
|
||||
tags: "caimira-imagestreams"
|
||||
labels:
|
||||
template: "cara-application"
|
||||
template: "caimira-application"
|
||||
objects:
|
||||
-
|
||||
kind: ImageStream
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
kind: ImageStream
|
||||
apiVersion: image.openshift.io/v1
|
||||
metadata:
|
||||
name: cara-router
|
||||
name: caimira-router
|
||||
spec:
|
||||
lookupPolicy:
|
||||
local: False
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
kind: ImageStream
|
||||
apiVersion: image.openshift.io/v1
|
||||
metadata:
|
||||
name: cara-webservice
|
||||
name: caimira-webservice
|
||||
spec:
|
||||
lookupPolicy:
|
||||
local: False
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
kind: "Template"
|
||||
apiVersion: template.openshift.io/v1
|
||||
metadata:
|
||||
name: "cara-route"
|
||||
name: "caimira-route"
|
||||
creationTimestamp: null
|
||||
annotations:
|
||||
description: "CARA route OpenShift template."
|
||||
tags: "cara-route"
|
||||
description: "CAiMIRA route OpenShift template."
|
||||
tags: "caimira-route"
|
||||
labels:
|
||||
template: "cara-route"
|
||||
template: "caimira-route"
|
||||
objects:
|
||||
-
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: cara-route
|
||||
name: caimira-route
|
||||
labels:
|
||||
app: "cara-route"
|
||||
app: "caimira-route"
|
||||
spec:
|
||||
host: ${HOST}
|
||||
port:
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
termination: edge
|
||||
to:
|
||||
kind: Service
|
||||
name: cara-router
|
||||
name: caimira-router
|
||||
weight: 100
|
||||
wildcardPolicy: None
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
kind: "Template"
|
||||
apiVersion: template.openshift.io/v1
|
||||
metadata:
|
||||
name: "cara-services"
|
||||
name: "caimira-services"
|
||||
creationTimestamp: null
|
||||
annotations:
|
||||
description: "CARA services OpenShift template."
|
||||
tags: "cara-services"
|
||||
description: "CAiMIRA services OpenShift template."
|
||||
tags: "caimira-services"
|
||||
labels:
|
||||
template: "cara-services"
|
||||
template: "caimira-services"
|
||||
objects:
|
||||
-
|
||||
apiVersion: v1
|
||||
|
|
@ -32,8 +32,8 @@
|
|||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-app
|
||||
name: cara-app
|
||||
app: caimira-app
|
||||
name: caimira-app
|
||||
spec:
|
||||
ports:
|
||||
- name: 8080-tcp
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector:
|
||||
deploymentconfig: cara-app
|
||||
deploymentconfig: caimira-app
|
||||
sessionAffinity: 'None'
|
||||
type: 'ClusterIP'
|
||||
-
|
||||
|
|
@ -49,8 +49,8 @@
|
|||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-router
|
||||
name: cara-router
|
||||
app: caimira-router
|
||||
name: caimira-router
|
||||
spec:
|
||||
ports:
|
||||
- name: 8080-tcp
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector:
|
||||
deploymentconfig: cara-router
|
||||
deploymentconfig: caimira-router
|
||||
sessionAffinity: 'None'
|
||||
type: 'ClusterIP'
|
||||
-
|
||||
|
|
@ -66,8 +66,8 @@
|
|||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-webservice
|
||||
name: cara-webservice
|
||||
app: caimira-webservice
|
||||
name: caimira-webservice
|
||||
spec:
|
||||
ports:
|
||||
- name: 8080-tcp
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector:
|
||||
deploymentconfig: cara-webservice
|
||||
deploymentconfig: caimira-webservice
|
||||
sessionAffinity: 'None'
|
||||
type: 'ClusterIP'
|
||||
-
|
||||
|
|
@ -83,8 +83,8 @@
|
|||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: cara-calculator-open
|
||||
name: cara-calculator-open
|
||||
app: caimira-calculator-open
|
||||
name: caimira-calculator-open
|
||||
spec:
|
||||
ports:
|
||||
- name: 8080-tcp
|
||||
|
|
@ -92,6 +92,6 @@
|
|||
protocol: TCP
|
||||
targetPort: 8080
|
||||
selector:
|
||||
deploymentconfig: cara-calculator-open
|
||||
deploymentconfig: caimira-calculator-open
|
||||
sessionAffinity: 'None'
|
||||
type: 'ClusterIP'
|
||||
|
|
|
|||
Loading…
Reference in a new issue