- In GitHub, fork this example repo.
- There are two branches that are important:
springboot
andpostgre
. In thespringboot
branch, you will have to make small modifications which we will cover in a later step.
- Inside IBM Cloud account, go to toolchains
- Make sure Resource Group is your individual
group-<x>
and Location is London. ClickCreate toolchain
- Select
Develop a Kubernetes App
- In the options, change
Select a source provider
toGitHub
. Follow instructions to link GitHub account that contains the forked repository. - Change
Clone
toExisting
and select the right repository from the dropdown list. - Click on
Delivery Pipeline
(clicking create now will bring you to the same tab). Add new IBM Cloud API key by clickingNew +
(note this is a secret credential, DO NOT SHARE). You will see a popup, default values are ok, but it is encouraged to add a description to the API key with something related to your project. - Values should be automatically populated. IMPORTANT: you must provide the correct
Cluster namespace
, do not use the defaultprod
. Use the namespace that follows this pattern:group-<lowercaseprojectname>
. - Update
Toochain name
andApp name
to include your project name as part of them and the phrasedatabase
orpostgre
etc.. I would recommend you use the same phrase for both for simplicity. Remember theToochain name
for future step. - Click
Create
.
- Once the toolchain is created, you should see a page with multiple tiles. Click the
Delivery Pipeline
tile to adjust some setting before first deployment. - Click on the settings gear of
Build
tile thenConfigure Stage
. - Under
Input
tab, switch theBranch
topostgre
. - Click
Save
at the bottom.
- Click on the settings gear of
Containerize
tile thenConfigure Stage
. - Under
Jobs
tab, switch theTester Type
toSimple
. - Click
Save
at the bottom.
- Click on the settings gear of
Deploy
tile thenConfigure Stage
. - Under the
Jobs
tab, insideDeploy script
, replace what is in the textbox with
source ./scripts/check_and_deploy_kubectl.sh
- Click
Save
at the bottom.
At this point, you should click the Play button in the Build tile to restart the toolchain and ensure your modifications are applied. Next step is to create the toolchain to deploy the Springboot app itself.
An important step is to connect the database with the app. We can do this by modifying a field in the Dockerfile
in the springboot
branch. The line
ENV PG_HOST=......
should be replaced with
ENV PG_HOST=<your-database-toolchain-name>
where <your-database-toolchain-name>
is what you remembered from step 2.8. This is the hostname that the app container will use to find the database container.
A toolchain also needs to be created for the application. Many of the steps will be similar, but with some important differences.
- Inside IBM Cloud account, go to toolchains
- Make sure Resource Group is your individual
group-<x>
and Location is London. ClickCreate toolchain
- Select
Develop a Kubernetes App
- In the options, change
Select a source provider
toGitHub
. Your GitHub account should be linked from prior steps. - Change
Clone
toExisting
and select the right repository from the dropdown list. - Click on
Delivery Pipeline
(clicking create now will bring you to the same tab). Add new IBM Cloud API key by clickingNew +
(note this is a secret credential, DO NOT SHARE). You will see a popup, default values are ok, but it is encouraged to add a description to the API key with something related to your project. - Values should be automatically populated. IMPORTANT: you must provide the correct
Cluster namespace
, do not use the defaultprod
. Use the namespace that follows this pattern:group-<lowercaseprojectname>
. - Update
Toochain name
andApp name
to include your project name as part of them. - Click
Create
.
- Once the toolchain is created, you should see a page with multiple tiles. Click the
Delivery Pipeline
tile to adjust some setting before first deployment. - Click on the settings gear of
Build
tile thenConfigure Stage
. - Under
Jobs
tab, switch theBuilder Type
toMaven
(since this Springboot example uses that). - Inside
Build script
, replace what is in the textbox with
#!/bin/bash
mvn -B package -DskipTests=True
- Under
Input
tab, switch theBranch
toSpringboot
. - Click
Save
at the bottom.
- Click on the settings gear of
Containerize
tile thenConfigure Stage
. - Under
Jobs
tab, switch theTester Type
toSimple
. - Click
Save
at the bottom.
- Click on the settings gear of
Deploy
tile thenConfigure Stage
. - Under the
Jobs
tab, insideDeploy script
, replace what is in the textbox with
source ./scripts/check_and_deploy_kubectl.sh
- Click
Save
at the bottom.
At this point, you should click the Play button in the Build tile to restart the toolchain and ensure your modifications are applied.
- In IBM Cloud, go to Clusters and select
classroom-eu-gb-1-bx2.4x16
- Click
Kubernetes Dashboard
(blue button in top right). This will open a new tab. - In the top right, select your namespace with the format
group-<lowercaseprojectname>
. - Click on
Services
(row on left pane). You should see two services. - Click on the
External Endpoint
link for the service that corresponds to the springboot app and not the database. - You should see the Santa's Grotto app! The default
username/password
combo isadmin/zxc
.