Please install :
- oc cli : https://docs.openshift.com/container-platform/4.7/cli_reference/openshift_cli/getting-started-cli.html
- kn cli : https://docs.openshift.com/container-platform/4.7/serverless/installing_serverless/installing-kn.html#installing-kn
oc login https://ocp-url:6443 -u login -p password
export PROJECT=companies-catalog
oc new-project $PROJECT
Routes include the project name, if you choose another one, don't forget to change it on the differents places/files (such kogito-realm) to use the correct urls.
oc create secret generic username \
--from-literal=username=username \
--from-literal=password=password \
--type=kubernetes.io/basic-auth
oc create secret docker-registry quay-secret \
--docker-server=quay.io/username \
--docker-username=username \
--docker-password=password\
--docker-email=email
oc secrets link builder quay-secret -n $PROJECT
oc secrets link default quay-secret --for=pull -n $PROJECT
git clone https://github.com/mouachan/companies-catalog.git cd companies-catalog
export TMP_DIR=tmp
mkdir $TMP_DIR
install openshift-serverless operator from OperatorHub
create a knative-serving instance
./manifest/scripts/knative-serving.sh
tkn pipeline start build-and-deploy \
-w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/mouachan/companies-catalog/main/manifest/build/pipeline/persistent_volume_claim.yaml \
-p deployment-name=pipelines-companies-catalog \
-p git-url=https://github.com/mouachan/companies-catalog.git \
-p IMAGE=image-registry.openshift-image-registry.svc:5000/pipelines-companies/pipelines-companies-catalog \
# check if persistent mongo exist
oc get templates -n openshift | grep mongodb
# if not create it
oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mongodb-persistent-template.json -n $PROJECT
#get paramters list
oc process --parameters -n openshift mongodb-persistent
#create the instannce
oc process mongodb-persistent -n openshift -p MONGODB_USER=admcomp -p MONGODB_PASSWORD=r3dh4t2021! -p MONGODB_DATABASE=companies -p MONGODB_ADMIN_PASSWORD=r3dh4t2021! \
| oc create -n $PROJECT -f -
oc get pods
NAME READY STATUS RESTARTS AGE
mongodb-1-9zhxm 1/1 Running 0 41s
mongodb-1-deploy 0/1 Completed 0 47s
create the schema
MONGO_POD_NAME=$(oc get pods --output=jsonpath={.items..metadata.name} -l 'name=mongodb')
oc exec -it $MONGO_POD_NAME -- bash -c 'mongo companies -u admcomp -p r3dh4t2021!' < ./manifest/create-schema.js
add records
oc exec -it $MONGO_POD_NAME -- bash -c 'mongo companies -u admcomp -p r3dh4t2021!' < ./manifest/insert-records.js
oc apply -f ./manifest/companies-svc-knative.yml
oc create -f manifest/companies-catalog-template.yaml
oc process companies-catalog -p MONGODB_USER=admcomp -p MONGODB_PASSWORD=r3dh4t2021! -p MONGODB_DATABASE=companies -p MONGODB_ADMIN_PASSWORD=r3dh4t2021! -p REGISTRY_SECRET=quay-secret -p IMAGE_SVC_CATALOG=quay.io/mouachan/companies-svc:1.0 -p SVC_CATALOG_NAME=companies-svc | oc create -f -
oc delete configmap/companiesdb-init secret/mongodb service/mongodb persistentvolumeclaim/mongodb deploymentconfig.apps.openshift.io/mongodb service.serving.knative.dev/companies-svc template/companies-catalog
create new namespace
oc new-project catalog-pipeline
create the maven pvc
oc apply -f ./manifest/build/pvc/maven_source_pvc.yaml
create the configmap containing the custom settings.xml
oc apply -f ./manifest/build/tasks/custom_maven_settings.yaml
create the mvn task
oc apply -f ./manifest/build/tasks/mvn.yaml
create the git clone task
oc apply -f ./manifest/build/tasks/git_clone.yaml
create the build image task
oc apply -f ./manifest/build/tasks/build-image.yaml
apply the pipeline
oc apply -f ./manifest/build/pipeline/pipeline.yaml
configure the authorizations
oc adm policy add-scc-to-user privileged -z default -n catalog-pipeline
oc edit configmap config-defaults -n openshift-pipelines
oc create clusterrolebinding pipeline --clusterrole=cluster-admin --serviceaccount=catalog-pipeline:pipeline
oc secrets link pipeline quay-secret
run the pipeline
oc apply -f ./manifest/build/pipeline/pipelinerun.yaml
package the helm charts
helm package companies-catalog-helm
from you github create a new git repository (companies-catalog-helm) Go back to your browser, in the “settings” section of your git repository, scroll down to Github Pages sectionand select the gh-pages as a branch. (more details on https://medium.com/@mattiaperi/create-a-public-helm-chart-repository-with-github-pages-49b180dbb417)
clone the repository
copy the package
mv ../companies-catalog/companies-catalog-helm/companies-catalog-helm-0.1.0.tgz .
Create an index
helm repo index companies-catalog-helm/ --url https://mouachan.github.io/companies-catalog-helm
Push
git add . && git commit -m “Initial commit” && git push origin main
add a the helm chart repository to the openshift developer catalog
cat <<EOF | oc apply -f -
apiVersion: helm.openshift.io/v1beta1
kind: HelmChartRepository
metadata:
name: bbank-apps-helm-repo
spec:
name: bbank-apps-helm-repo
connectionConfig:
url: https://mouachan.github.io/companies-catalog-helm
EOF