Google GKE
Setup Overview
We will create a GKE cluster deployed in GCP and exposed to the outside world using Network Load Balancer and Cloud DNS domain mapping.
Jenkins-X platform is then deployed and configured with Git provider to trigger Kubernetes-based pipelines which produce Docker images pushed into private Google Container Registry (GCR). Jenkins-X will also deploy our Activiti Cloud Helm chart into Namespace of a GKE cluster and expose it via Ingress to the outside world.
The diagram above uses Kubernetes Deployment Language: https://github.com/raffaelespazzoli/kdl
All of the persistence volume claims of Activiti Cloud infrastructure and applications will be handled by Google Storage services using Google PV Storage, which will be used to provision Kubernetes persistent volumes for Audit, Query and Runtime Bundle using PostgreSQL database service.
The Walkthrough
Step 1. Installing Jenkins-X Jx Cli
We recommend to use Cloud Shell, if this is your first time installing Activiti Cloud in GKE. You may also use Bash terminal locally, if you know what you are doing.
The first thing we need to do is install the jx binary and add it to your PATH. You will need to get the jx command line tool installed locally on your machine for your OS (Linux or MacOS recommended). You should use Linux OS to install Jx in Cloud Shell.
After successful installation of jx client you should now be able to display the jx client version by executing the following command:
Required Dependencies
JX will attempt to locate any required dependencies. If JX discovers that some dependencies are missing it will prompt to install them for you in the ~/.jx/bin folder. It is recommended that you allow jx to install any missing dependencies. You may also choose to install required dependencies for your OS manually:
Kubernetes Helm (https://helm.sh)
Google Cloud SDK (https://cloud.google.com/sdk/install)
Git Client (https://git-scm.com/downloads)
In order to setup Jenkins-X in Kubernetes with Github provider for CI/CD GitOps, you will need to create a user account on Github to host Jenkins-X environment repositories.
Step 2. Creating the GKE Cluster
Before you begin, please, follow the steps to create new Google Cloud Project with private Google Container Registry that runs on Google Cloud Platform.
In the GCP Console, go to the Manage resources page and select or create a project. Note: If you don't plan to keep the resources you create in this tutorial, create a new project instead of selecting an existing project. After you finish, you can delete the project, removing all resources associated with the project and tutorial.
Make sure that billing is enabled for your project.
Enable Cloud Build API for your project: https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com
Enable Container Registry API for your project: https://console.cloud.google.com/flows/enableapi?apiid=containerregistry.googleapis.com
Enable Container Analysis API for your project: https://console.cloud.google.com/flows/enableapi?apiid=containeranalysis.googleapis.com
Then, open Cloud Shell >_ or your Bash terminal and set the following environment variables:
Then, use the following command to find out zones available for your project and choose one of the zones close to you:
Then, set the ZONE variable in your terminal using the zone near you, i.e.
If you are using Cloud Shell, then set the following environment variable:
Create Your Cluster
To create the cluster, open Google Cloud Shell for your project and run the following Jx command to guide you through creating a cluster on GKE:
Upgrade the jx if needed:
Note: Jx cli simply wraps glcoud cli to create cluster using Google SDK api. If you know what you are doing, you may choose to create cluster manually based on your availability zone requirements or api oauth scopes using gcloud command or Google Console instead of jx cli. If you do create cluster manually, please, enable the following Cloud Apis for the project: "container", "compute", "cloudbuild", "containerregistry", "containeranalysis" to utilise Container Registry, Cloud Build and Container Analysis and use the following oauth scopes for gcloud command --scopes=
options to allow API access to storage based services using cluster service account:
If you have the cluster already with these scopes enabled, connect to it in Cloud Shell or Bash console and proceed to Install Jenkins-X Platform section in this document.
JX will then prompt you for the basic configuration options for your cluster, such as:
Install Jenkins-X Platform
We are now ready to install Jenkins-X platform into the cluster with Github provider. Run the following command:
Note: To setup and use other than Github Git provider see: https://jenkins-x.io/developing/git/
JX will then prompt you for the basic configuration options for your installation, such as:
GitHub Connectivitiy
If this is the first time you have run jx in the terminal, jx will prompt you for a github username & api token. If you already have one, simply enter the values when prompted. If you don't have an api token, click on the link provided to generate one and enter the token value into the prompt:
Jenkins Connectivity
Next, jx will attempt to configure Jenkins connectivity. This should be done automatically, but sometimes Jenkins is not able to start in time. In this instance, you will be asked to login to Jenkins using the admin user. The password for the admin user will be displayed in the console. At this point, follow the instructions to add the Jenkins API token.
Setup Confirmation
The URL to access Jenkins will be printed in the output of the console together with the random admin password auto-generated by jx We now can use Jenkins credentials to log into our Jenkins server and see that Jenkins has successfully installed.
Note: after you have installed Jenkins-X, you may want to configure Jenkins-X to make all new repositories private by default with the following command:
To open Jenkins UI in the browser, run the following command to get Jenkins UI link. You may want to save it for future use:
In the Jenkins UI, you can confirm that Jenkins X has successfully installed Jenkins instance:
Step 3. Create Activiti Cloud GitOps Environments
We will now proceed to provision two environments for deploying Activiti Cloud Platform: a staging environment with Auto promotion and a production environment with Manual promotion strategy.
Get Jx Cluster Domain
Set the following environment variables:
Create Activiti Cloud DevOps Environment
Run this command to configure environments using domain name of the cluster with the Activti Cloud Environment Git repository used as the fork when creating new GitOps environment Git repo and custom environment repo prefix. Your Environment Git repo will be of the form 'environment-$prefix-$envName'
Select default options when running following commands to create Activiti Cloud Platform GitOps environments;
After Jx created new environments, run jx console
command to open Jenkins UI, where you can confirm that Jenkins X has successfully provisioned two environments for us: a staging environment and a production environment:
You can also navigate to GitHub and see that Jenkins X provisioned the projects representing the environments’ Helm chart definitions as just built by Jenkins.
Configure Activiti Cloud Environments Domain Name
After Jx creates the environment in your Git repository, open your repo, then edit env/values.yaml file to set the value of global.gateway.domain key from expose.config.domain value
Click to Commit the change. This should trigger Jenkins pipeline to rebuild and update the environments Helm chart configurations.
Step 4. Create Activiti Cloud Platform CI/CD Quickstarts
Create Activiti Cloud Quickstart Location in Jx Team Environment
We will need to create Activiti Jx Quickstart Location to use Activiti Quickstart templates published in Activiti Github https://github.com/Activiti organization repository:
Run this command to add Activiti Quickstart location for your team:
To get the list of registered quickstart locations run command:
Setup Activiti Cloud Platform in your Git repository
Run the following command to create your first Activiti Cloud Platform Git repository:
Note that there will be some warning type messages which is normal jx logging so not to worry.
After that run the following command in another terminal to monitor pipeline activities:
Then, after ~4-5 minutes you should see your Activiti Cloud Platform deployed into staging namespace in K8s cluster:
You can now find out ingress hosts exposing Activiti Cloud Platform Services:
Setup Activiti Cloud Connector in your Git Repository
Run the following command to create your first connector project Git repository:
Setup Activiti Cloud Runtime Bundle in your Git repository
Run the following command to create your first runtime bundle project Git repository:
Then, after ~4-5 minutes you should see your Connector and Runtime Bundle deployed into staging environment:
Open Activiti Cloud Modeler
http://gateway.staging.X.X.X.X.nip.io/modeling
Here instead of X.X.X.X.nip.io use the earlier $CLUSTER_DOMAIN environment variable, i.e.
Login into using credentials: modeler/password
Last updated