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!
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.
Let's Build Something
Dev Setup
- Sign Up for a Free IBM Cloud Account
- Install the IBM Cloud Developer Tools CLI (command line interface, the commands you type into your Terminal)
- Install the IBM Cloud Code Engine Plugin
- Login to Your IBM Cloud Account via the CLI
- 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
- Verify the IBM Cloud Developer Tools CLI is installed
$ ibmcloud dev help
- 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')
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
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
- Verify the IBM Cloud Code Engine Plugin is installed
$ ibmcloud ce help
4. Login to Your IBM Cloud Account via the CLI
- For Mac, Linux, and Windows 10 Pro, run the following command:
$ ibmcloud login
- Enter email and password
4. Assign a Target Resource Group
- View available resource groups
$ ibmcloud resource groups
- Assign a target resource group (default to your "Default")
$ ibmcloud target -g Default
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
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
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
CONGRATS!
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
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
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!