Deploy a Health Insurance App w the Code Engine CLI in 3 Easy Steps!

Jenna Ritten - Jun 1 '21 - - Dev Community

Welcome back to Tutorial Tuesday!

This week we'll be covering how to Deploy a Health Insurance App to Code Engine in 3 easy steps!

Alt Text

IBM Cloud Code Engine is a fully managed, serverless platform that runs your containerized workloads, including web apps, micro-services, event-driven functions, or batch jobs. Code Engine even builds container images for you from your source code.

Today we're going to walk through how to deploy a health insurance application to Code Engine from an IBM Container Registry container image in 3 easy steps. As a bonus, we'll walk through how to

Requirements

IBM Cloud Pay-As-You-Go Account

The only requirement for this tutorial is an IBM Cloud pay-as-you-go account. Code Engine offers a Free Tier as outlined below. If you have an IBM Cloud Lite Tier account, you will need to upgrade your account. You will not be charged for working through this tutorial, as the CPU and Memory required to deploy the sample app fall well within the Code Engine Free Tier. For more information on Code Engine pricing for usage, click here.

Alt Text

Let's Build Something

Dev Setup

  1. Sign Up for a Free IBM Cloud Account
  2. Install the IBM Cloud Developer Tools CLI (command line interface, the commands you type into your Terminal)
  3. Install the IBM Cloud Code Engine Plugin
  4. Login to Your IBM Cloud Account via the CLI
  5. Assign a Target Resource Group

Setup & Install

2. Install the IBM Cloud Developer Tools CLI

  • For Mac and Linux, run the following command in Terminal:
$ curl -sL https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/master/linux-installer/idt-installer | bash
Enter fullscreen mode Exit fullscreen mode
  • Verify the IBM Cloud Developer Tools CLI is installed
$ ibmcloud dev help
Enter fullscreen mode Exit fullscreen mode
  • For Windows 10 Pro, run the following command as an administrator in Powershell:
$ [Net.ServicePointManager]::SecurityProtocol = "Tls12, Tls11, Tls, Ssl3"; iex(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/master/windows-installer/idt-win-installer.ps1')
Enter fullscreen mode Exit fullscreen mode

Note For Windows Users: If you encounter a Git error similar to the one below, you will need to install Git in the correct path.

$ bash: git: command not found
Enter fullscreen mode Exit fullscreen mode

Follow the Windows Guide HERE

3. Install the IBM Cloud Code Engine Plugin

  • For Mac, Linux, and Windows 10 Pro, run the following command:
$ ibmcloud plugin install code-engine
Enter fullscreen mode Exit fullscreen mode
  • Verify the IBM Cloud Code Engine Plugin is installed
$ ibmcloud ce help
Enter fullscreen mode Exit fullscreen mode

4. Login to Your IBM Cloud Account via the CLI

  • For Mac, Linux, and Windows 10 Pro, run the following command:
$ ibmcloud login
Enter fullscreen mode Exit fullscreen mode
  • Enter email and password

4. Assign a Target Resource Group

  • View available resource groups
$ ibmcloud resource groups
Enter fullscreen mode Exit fullscreen mode
  • Assign a target resource group (default to your "Default")
$ ibmcloud target -g Default
Enter fullscreen mode Exit fullscreen mode

Deploy a Health Insurance App to Code Engine

1. Create a Code Engine Project

  • Create a new Code Engine project and give it a name
$ ibmcloud ce project create --name PROJECT_NAME
Enter fullscreen mode Exit fullscreen mode

2. Create a Code Engine Application

  • Create a new application from a container image and give it a name
$ ibmcloud ce application create --name hmo --image ibmcom/hmo
Enter fullscreen mode Exit fullscreen mode

3. Update the Container Image

  • Update the Container Image to V2 of the Health Insurance App UI
$ ibmcloud ce application create --name hmo --image ibmcom/hmo
Enter fullscreen mode Exit fullscreen mode

CONGRATS!

Alt Text

You've just deployed a health insurance app to Code Engine from an IBM Container Registry image! You also updated the container image to V2 of the application with a new, fresh UI with 1 line of code! As a bonus, follow the next 2 steps to create and run a batch job from a container image!

BONUS!

Run a Batch Job

1. Create a Batch Job

  • Create a new batch job from a container image and give it a name
$ ibmcloud ce job create --name myjob --image ibmcom/hmo-task
Enter fullscreen mode Exit fullscreen mode

2. Run a Batch Job

  • Run the batch job and specify the array indices value
$ ibmcloud ce jobrun submit --job myjob --array-indices=0-9
Enter fullscreen mode Exit fullscreen mode

Stay tuned for next week's Tutorial Tuesday where we will explore Code Engine's Auto-Scaling feature in-depth with our Health Insurance App!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player