Awesome
DevOps for Cloud Native Reference Application
This project is part of the 'IBM Cloud Native Reference Architecture' suite, available at https://github.com/ibm-cloud-architecture/refarch-cloudnative
Introduction
DevOps, specifically automated Continuous Integration and Continuous Deployment (CI/CD), is important for Cloud Native Microservice style application. This project is developed to demonstrate how to use tools and services available on IBM Bluemix to implement the CI/CD for the BlueCompute reference application.
The project uses Bluemix DevOps open toolchains to implement the CI/CD. The goal is to standup most of the application components as part of an automated pipeline. So you don't have to go through the manual setup as outlined in the project main repository page. The toolchain for BlueCompute application looks like this:
To read more about the Open Toolchains, please check out this Blog post
Let's get started.
Setup BlueCompute application using Bluemix DevOps open toolchain
Bluemix DevOps toolchain provided with this application integrates the source code in git repositories with deployment scripts to continuously deliver code changes to staging and production applications.
To demonstrate hybrid connectivity, the inventory microservice in BlueCompute application is setup to connect to a MySQL cluster in US and London regions. Setup Vyatta network gateway appliances in SoftLayer US and London regions, and then setup MySQL servers in both regions.
Prerequisites
You need to have a Bluemix account. Login to your Bluemix account or register for a new account here
Once you have logged in, create a new space for hosting the application in US-South and London regions. Use the same space name in both regions.
Step 1: Setup VPN Tunnel and MySQL servers in SoftLayer
See VPN and MySQL instructions to setup on-premise MySQL server accessible from Bluemix service over a VPN tunnel.
After setting up the vpn tunnel and MySQL servers, get following information to set in toolchain configuration.
US-South | London | |
---|---|---|
Vyatta Gateway Address | ||
VPN Pre-shared Key | ||
Subnet with MySQL servers | ||
MySQL server addresses | ipaddr:port[,ipaddr:port].. |
Step 2: Provision the API Connect Service
- In the Bluemix console, click on Catalog and select API.
- Select the API Connect service.
- Click "Create" in the Getting Started with API Connect page. In API Connect creation page, specify the Service name for example cloudnative-apic-service. Then select the Essentials plan for this walkthrough.
- After the API Connect service is created, launch the API Connect service.
- In the API Manager page, navigate to the API Connect Dashboard and select "Add Catalog" at the top left. You may notice that a sandbox has automatically been generated for you.
- Name the catalog "BlueCompute" and press "Add".
- Select the catalog and then navigate to the Settings tab and click the Portal sub-tab.
- To setup a Developer Portal that your consumers can use to explore your API, select the IBM Developer Portal radio button. Then click the "Save" button to top right menu section. This will provision a portal for you. You should receive a message like the one below.
- Once the new Developer Portal has been created, you will receive an email.
Step 3: Create the Bluemix DevOps toolchain
Click the following button to deploy the toolchain to Bluemix. The Bluemix DevOps runtime will parse the toolchain template file that creates and integrates GitHub repos and Continuous Delivery pipelines to deploy to a targetted space in US-South and London Bluemix regions.
- Enter toolchain name in the Name: field.
- By default, the GitHub integration is configured to clone the associated git repos to your GitHub account. Click on GitHub integration to see the list of repos that are setup to clone to your account.
- Click on Delivery Pipeline integration to do the configuration.
- By default the Bluemix Organization, and Space information will be filled with the logged in Region, Organization, and Space values. Double-check to ensure this is the desired Region, Organization, and Space this toolchain should deploy to and update Region, Organization, and Space values accordingly.
- Enter Customer Gateway, Customer Subnet, VPN Preshared key, and Onprem MySQL server addresses for both US-South and London regions based on information collected in Step 1.
- Enter IBMid Username and Password. These are Bluemix credentials, which are IBMid username and password with administrative access to API Developer Portal in the corresponding Bluemix space.
- Go to JSON Web Key Generator. Switch to Shared Secret tab, set Key Size: 2048, Key Use: Signing, Algorithm: HS256 and click on New Key button. Copy the generated key displayed in the output box titled Key identified by "k" field. Paste this key value in the JWT Shared Secret input field on the create toolchain form.
- Containers deployed by this toolchain are enabled for New Relic monitoring. Enter New Relic License Key to monitor the deployed containers.
- Click Create to create the toolchain.
- Click on View Toolchain to go to the toolchain page. This toolchain will create and integrate eight GitHub repos with Issues enabled, and eight Delivery Pipelines each connected to one of the integrated GitHub repos. Configuration data is shared between all the delivery pipelines.
Step 4: Execute the toolchain
- VPN connection should be established between VPN service in Bluemix region and the on-premise VPN gateway. Click on Delivery Pipeline named vpn. Click on play button on BUILD US-South and BUILD London boxes.
- After the VPN connections are established successfully, execute the remaining pipelines. Its recommended to start with netflix-eureka.
- For each pipeline, start deployment with BUILD US-South stage. While that deployment is running, click on BUILD London to start deployment to London region.
- For each pipeline, the DEPLOY stages will follow successful BUILD. On the pipeline page to ensure both the BUILD and DEPLOY stages completed successfully.
- Repeat above steps for each delivery pipeline in the following order: netflix-zuul, auth, micro-socialreview, micro-inventory, micro-catalog, micro-customer, micro-orders, api, and bluecompute-web.
This completes the creation of Bluemix DevOps toolchain to deploy the BlueCompute omnichannel application.
Step 5: Complete the solution
After successfully running all the DevOps pipelines, you have the entire BlueCompute backend ready on IBM Cloud. There are 3 tasks remaining to get the BlueCompute application (both Mobile and Web) working:
-
Subscribe to the APIs via API Connect developerPortal.
Please follow reference the API subscription manual to subscribe and consume the APIs. -
Configure and Run the Mobile iOS BlueCompute App.
Please follow the Run the iOS application guide to setup your iOS application. -
Configure and Run the BlueCompute Web application.
Please follow the Run the BlueCompute web app to setup the Web application in IBM Cloud.
You have set up the BlueCompute stack using IBM Bluemix DevOps open toolchains.