2. 2
Introduction
This workshop will demonstrate some of the integrated capabilities found in IBM Bluemix
and IBM Bluemix DevOps Services (IDS).
Bluemix now includes a new beta service to host Docker container based applications.
This service allows users to build and deploy their Docker applications completely on the
IBM cloud.
This workshop will highlight an agile process to write, build, and deploy Docker
applications using DevOps best practices for continuous delivery using an automated
pipeline to deliver new application versions faster.
This workshop will also demonstrate a new web-based way to code that does not require
the installation of any development environment, or for that matter, any application
besides a browser.
In order to complete this workshop, you will need a Bluemix account that has been
previously linked with IDS. Please use the space provided to write down the email and
password that you will be using with the workshop.
Note: You can either use your own account or you can use the provided workshop
account.
Email: ________________________________
Password: ________________________________
3. 3
Build and deploy an application using the IBM Container
Service
Log into Bluemix
1. Using your browser, go to the Bluemix website at https://bluemix.net
2. Press the “LOG IN” button located at the top right hand corner of the page.
3. In the following page, provide the email and password and press the “Sign in” button.
4. In the Dashboard page, you should notice that you do not have any Applications
created, however you may notice some services have been created in advance for the
workshops.
4. 4
Log into IDS
1. Using your browser, open another tab and go to the IDS website at
https://hub.jazz.net/
2. Press the “LOG IN” button located at the top right hand corner of the page.
3. In the following page, press the “Sign In” button.
4. In the IDS landing page, press the “EXPLORE” tab at the top of the page.
5. 5
5. In the Explore page, type “ibluemx” in the search bar and press the “Enter” key.
6. A list of projects will be displayed, select “container-devops”.
Fork the project
1. Press “FORK PROJECT” to create a personal copy of the project to work with.
2. In the “Fork Project” window, provide a name for your project and note it here:
Note: The deployed application will need to have a unique name, so it would be a good
idea to name the project something like “container-devops-<username>”, where
<username> is your account's username.
Project Name: ____________________________
6. 6
And check the “Make it private (not public)” check box, leave all other items as set, and
press the “CREATE” button.
Inspect the project code
1. You should have received the following message “Congratulations! You have
successfully created your new project.” in the new project page.
Let's look at the project source code by first pressing the “EDIT CODE” button.
7. 7
2. In the left hand tree view, select the file named “Dockerfile”. The file contents will
display in the main editor window.
This will give you an opportunity to see the instructions that will be used to create our
Docker container.
3. In the left hand tree view, select the “app.js” file. The file contents will display in the
main editor window.
This will give you an opportunity to see the code for the simple application that will run
inside the Docker container.
Note: On line 22 the application will output the following “Hello Docker Pipeline! version
1.0”.
8. 8
Configure the DevOps pipeline – Build stage
1. Click on the “BUILD & DEPLOY” button.
2. On the Build & Deploy Pipeline page, press the “+ ADD STAGE” link.
9. 9
3. In the reloaded page, rename the stage name from the default “MyStage” to “Build”
and press the “JOBS” tab in the window.
4. In the “JOBS” tab, click on “ADD JOB” and select “Build”.
5. Set the “Builder Type” to “IBM Container Service on Bluemix”, set the “Image Name” to
“ibluenode” and press the “SAVE” button to continue.
10. 10
Configure the DevOps pipeline – Deploy stage
1. Back on the Build & Deploy Pipeline page, press the “+ ADD STAGE” link.
11. 11
2. In the reloaded page, rename the stage name from the default “MyStage” to “Deploy”
and press the “JOBS” tab in the window.
4. In the “JOBS” tab, click on “ADD JOB” and select “Deploy”.
5. In the “Stage Configuration” page, set the “Deployer Type” to “IBM Container Service
13. 13
Run an initial build and deploy
1. To test the pipeline, we will run an initial build. Back in the “Pipeline: All Stages” page
press on the play arrow (which is a right hand pointing triangle) in the top of the “Build”
stage.
Note: At any time you can click on the “View logs and history” link to see detailed
messages.
2. The pipeline will automatically progress from Build to Deploy once the Build stage is
complete.
Once the Deploy stage is complete you will see the resulting container under the “LAST
EXECUTION RESULT” in the Deploy stage box.
Click on the IP address located under the “LAST EXECUTION RESULT” in the Deploy stage
box.
14. 14
3. This will open a new browser window and show the result of the newly deployed web
application, which should read:
Hello Docker Pipeline! Version 1.0
Change the application code
1. Press the “EDIT CODE” button to return to the editor.
2. Edit the “app.js” file and set the value of “res.send” to “Hello Docker Pipeline! version
2.0” and save the changes by typing “CTRL-S” (Windows), “CMD-S” (Mac) or pressing the
“File→Save” (tablets) in the editor tool bar (not in the browser window).
15. 15
Commit the code to the Git repository
1. Press the Git repository button at the left of the screen (under the pencil icon).
2. In the “Working Directory Changes” window, press the “Select All” check box, provide
some commit text (in our case we added “Increased the version displayed”), and press the
“Commit” button.
16. 16
3. Once the changes have been committed you need to press the “SYNC” button to
synchronize with the master branch.
Run a build and deploy
1. Press the “BUILD & DEPLOY” button to return to the “Pipeline: All Stages” page.
2. You will see that the build has automatically started running based on the
synchronization of the change to the repository.
Note: At any time you can click on the “View logs and history” link to see detailed
messages.
17. 17
3. The pipeline will progress from Build to Deploy once the Build stage is complete.
Once the Deploy stage is complete you will see the resulting container under the “LAST
EXECUTION RESULT” header in the Deploy stage box.
Click on the IP address located under the “LAST EXECUTION RESULT” in the Deploy stage
box.
18. 18
4. This will open a new browser window and show the result of the newly redeployed web
application which should read:
Hello Docker Pipeline! Version 2.0
Continue to iterate on your application
You can now extend the application by modifying the app.js file in a new way to render
different content, or you can choose to use a completely different Dockerfile, such as one
found on GitHub.