Developing Cloud Native Applications
Developing Cloud Native Applications
Cloud native applications consist of microservices that work together to leverage the
advantages of cloud computing.
Cloud native capabilities propel companies like Netflix and Pinterest. These
companies have leveraged the velocity of cloud native development to reap huge
rewards in the marketplace. According to a recent study, more than 60% of
organizations will use a cloud managed service offering from an external provider
within the next few years.
The second characteristic, broad network, access means that cloud computing
resources can be accessed via the network through standard mechanisms and
platforms such as: mobile phones, tablets, laptops, and workstations.
The third characteristic, resource pooling, is what gives cloud providers economies
of scale, which they pass on to their customers, making cloud cost efficient.
Using a multi-tenant model, computing resources are pooled to serve multiple
consumers.
Cloud resources are dynamically assigned and reassigned according to demand
without customers needing to concern themselves with the physical location of these
resources.
Rapid elasticity, the 4th characteristic, implies that you can access more resources
when you need them and scale back when you don't because resources are
elastically provisioned and released.
The 5th characteristic, measured service, means that you only pay for what you use
or reserve as you go.
If you're not using resources, you're not paying resource usage is monitored
measured and reported transparently based on utilisation.
It is a revolution in that it has changed the way the world consumes compute
services by making them more cost efficient while also making organisations more
agile in responding to changes in their markets.
Private cloud means that the cloud infrastructure is provisioned for exclusive use by
a single organisation it could run on premises, or it could be owned managed and
operated by a service provider.
When you use a mix of both public and private clouds working together seamlessly
that is classified as the hybrid model.
As a service model you get access to the platform, that is hardware and software
tools, usually those needed to develop and deploy applications to users over the
Internet.
In a cloud native app, the application code is designed, built, and delivered very
differently than it would be for conventional, monolithic apps.
Examining the cloud native solution stack will help you to understand where each
part of cloud app development takes place, and how it relates to other parts.
This means that application code needs to be instrumented with things like:
standardized logging,
standardized events,
a standard catalogue that multiple microservices and cloud native apps can
use to match those logging and events and
standardized tracing for microservices.
The mission of the CNCF is: To make cloud native computing ubiquitous, and To
make cloud native innovations accessible for everyone.
To help companies navigate the cloud native landscape, CNCF provide a trail map
that illustrates the recommended path through the cloud native landscape.
The trail map leads you through implementing cloud native computing technologies
in the following sequence:
Containerization,
CI/CD,
Orchestration and application definition,
Observability and analysis,
Service Proxy, Discovery, and Mesh,
Networking, policy, and security,
Distributed database and storage,
Streaming and messaging,
Container registry and runtime, and
Software distribution.
At each step, companies can decide whether to develop and implement the
technology themselves, use a vendor offering, or not implement that technology at
all.
Hybrid Cloud
What makes a hybrid cloud?
A hybrid cloud is a combination of one or more public clouds and one or more
private
cloud environments.
Public clouds are hosted by external vendors, with multiple tenants on a single
hardware platform, and can include servers in multiple locations.
A hosted private cloud is maintained by an external vendor for one organization.
An on-premises private cloud belongs to a single organization who hosts and
manages their own cloud space.
Private cloud provides maximum control over the computing environment and data,
which is especially important, or even mandatory if your company deals with highly
sensitive data or must comply with strict industry or governmental regulations.
On-premises (legacy) data centre servers require that organizations install and
maintain their own on-premises hardware and software.
Public clouds and private hosted clouds enable organizations to consume PaaS and
IaaS on demand.
Organizations can quickly update their platforms and infrastructure with the latest
technology, mitigating technology investment risks.
On premises private clouds require that organizations plan ahead for storage and
memory upgrades.
On premises legacy data centres face the most risk with commitments to longer-term
storage and memory technology.
With platform and infrastructure needs rapidly changing, many organizations use
cloud to free their developers from concerns about storage and memory,
empowering them to focus on business needs.
Security as a Service is a SaaS capability offered by both public cloud and private
hosted cloud vendors.
Vendors secure the hardware, enabling hosted organizations to focus on data and
application security and development.
On premises cloud and legacy data centres must allocate resources to secure their
hardware, data, and applications.
Security as a Service is a SaaS capability offered by both public cloud and private
hosted cloud vendors.
Vendors secure the hardware, enabling hosted organizations to focus on data and
application security and development.
On premises cloud and legacy data centres must allocate resources to secure their
hardware, data, and applications.
Public and hosted private cloud tenants can access the IBM Cloud catalogue of
tested, deployable database, API, and end-user applications, saving their
organizations development and deployment time.
On premises cloud and data centre locations, with some exceptions, need to build in
additional time and money for database, API and end-user application development,
testing and deployment.
IBM offers Cloud Packs for both off premises and on premises hybrid and multi-cloud
environments.
Preparation for Modernization
Application modernization is the process of taking existing legacy applications and
modernizing the underlying platform infrastructure, deployment strategy, and the
code architecture to increase developer productivity and reduce costs.
Containerization refers to the ability to take your existing software with minor updates
to move to the cloud.
Refactoring means changing and extending the application over time to enable an
easier move to the cloud.
Finally, the goal is to transform into a cloud native application with an architecture
built on loosely coupled microservices and API first architecture.
This modernization effort touches the build, deploy, and run stages.
One of the more popular patterns for modernization involves refactoring and
breaking down legacy monolithic applications into a collection of small, loosely
coupled microservices.
The second approach is not to touch the existing application but add any new
features and capabilities using microservices.
The third approach is to refactor the code to lift-and-shift portions of the application.
While this may be possible, a complete restructure of the application to run on the
cloud provides more benefit in the long run.
Test Driven Development by its very definition ensures that all production code has
been tested and passes at least one test.
TDD makes the code base more flexible and extensible as the architecture requires
developers to think of features as small units of code that are tested independently
and integrated with the other pieces.
This leads to loosely coupled modules that work well with each other.
Ultimately, this pattern is a natural fit for the continuous delivery model, where code
is automatically and continuously pushed to production.
TDD ensures the code is robust and catches any failures before deployment.
CI/CD is an approach to software development where you build and deploy your
software so that it can be released into production at any time.
DevOps teams work with developers to build pipelines that continuously test the
code before releasing into production.
This leads to a mindset where consequences of breaking a build are less severe,
encouraging teams to work more closely with each other.
Continuous delivery naturally favours more frequent builds with small number of
changes in each build instead of doing a big deployment with many code changes.
This use of automated pipelines that ensures code is delivered continuously through
the test and production environments in a repeatable and orderly fashion ensures
less breakdowns in production.
While Test Driven Development and CI/CD are crucial to deliver usable software,
efficient operations are essential to create reliable and scalable solutions. An SRE or
Site Reliability Engineer bridges this gap between development and operations.
They spend at most 50% of their time on improving existing operations to reduce
failures and future efforts and the other 50% on development tasks like creating new
features and implementing automation.
Any additional workload is shared with the development teams.
SREs embrace risk in a controlled fashion instead of avoiding it completely.
They use error budgets to determine how much time the system can be down when
making changes. This budget is in turn defined by service-level-agreements (SLA) or
intended service-level objectives (SLO).
Module 1 Summary
At this point in the course, you know:
The CNCF is an independent body that provides guidance on the use and
evolution of cloud native technologies.
TDD, CI/CD, and SRE are approaches that enable rapid development and
reliable deployment.
IBM Cloud Overview: IaaS, PaaS, and
Runtimes
IBM Cloud is an open cloud computing platform that combines infrastructure as a
service (IaaS) with platform as a service (PaaS), and includes a catalogue of diverse
cloud services, which can be used to rapidly build and deploy business applications
or infrastructure.
As an IaaS, it allows developers fine-grained control over the infrastructure on which
their apps are deployed. Developers can deploy high-performance, bare-metal
servers, virtual servers, containers, and cloud storage, in IBM Cloud data centre
locations around the world.
As a PaaS, it provides developers access to IBM software for integration, security,
transaction, and other key functions, and software from IBM Business Partners. The
application types can range from web, mobile, big data, and smart devices to the
Internet of Things.
As a PaaS provider, IBM Cloud allows you to build, manage, and run applications,
such as web, mobile, big data, smart devices, and Internet of Things.
IBM Cloud uses Cloud Foundry, which is an open source platform as a service
offering that provides a choice of clouds, frameworks, and application services.
Cloud Foundry provides the monitoring, deployment, and logging tools for hosting
apps.
IBM Cloud also adds the following enhancements to Cloud Foundry:
Extends Cloud Foundry with services from IBM and IBM partners.
Provides a scriptable command-line interface (CLI).
Provides integration with development tools to ease the deployment process.
DevOps services provide an online code editor, a build pipeline, and a version
control system.
IBM Cloud runs on IBM Cloud data centres locations around the world.
IBM Cloud enables application developers to focus on application capabilities by
providing the following resources on the cloud:
Runtimes on which to run applications.
A catalogue of selectable services, such as databases, mobile support,
analytics, artificial intelligence, and security, which are used to build
applications.
Ability to integrate with data from the organization and traditional workloads
that are running in on-premises systems.
DevOps capabilities and tools, including code-editors, version control,
deployment pipelines, and hosting, monitoring, and scaling apps.
Integration services allow applications to access traditional workloads that are
running in the organization’s on-premises environment.
The services and runtimes available in IBM Cloud might change over time, as new
services and runtimes are developed, and older services are deprecated.
With IBM Cloud, developers are given a choice of runtimes on which to run their
applications.
You can run your app using a particular runtime, without the need to manage the
underlying infrastructure.
A runtime is a set of resources that is used to run an application.
Each runtime features an associated build pack, which is a collection of scripts that
prepare your code to run on IBM Cloud.
Runtimes are provided by IBM or through Community Build packs.
Consider the following points:
The IBM runtimes include Liberty for Java, SDK for Node.js, and Runtime for
Swift.
IBM Cloud and Cloud Foundry support more runtimes through the Community
Build packs. This open-source community features written build packs for
other runtimes, such as Go, PHP, Python, Ruby, and Tomcat.
The following runtimes are available for Java: Tomcat: An open-source Java
web application server.
Liberty for Java: IBM WebSphere Liberty is a Java EE application server
which can deploy any Tomcat application.
It also offers support for more Java web features for example, Message
Beans and JMX.
Note that the available runtimes in IBM Cloud can change.
IBM Cloud Overview: Services, Regions
and Cloud Foundry
IBM Cloud provides a broad range of pre-built services (from IBM and third-party
providers) that can be used when assembling your application.
Watson services enable you to add the power of artificial intelligence to your
application with speech, vision, and natural language processing APIs.
Data & Analytics services help you to get data from integrated cloud databases, build
data-driven applications, and analyze your data.
In addition, services in the following categories help you to develop key features
within your application:
Integration services: APIs: Create, manage, enforce, and run APIs
Integrate: Access traditional workloads running in the organization’s on-
premises environment
Mobile: Use mobile backend infrastructure to build, monitor, and test mobile
apps.
Internet of Things: Communicate with connected devices, sensors, and
gateways.
Functions: Execute in response to incoming events (based on Apache
OpenWhisk).
Application Services: Many application services, such as Blockchain.
Message Hub, WebSphere Application Server, Business Rules, and other
application services on the cloud.
DevOps: Tools to help innovate new applications faster and cheaper.
Security: Build security into your application design.
Infrastructure services help you to manage the underlying infrastructure your
application runs on.
Note that the services available in IBM Cloud can change.
A region is a defined geographical territory to which you can deploy your
applications. Locations are data centres within the region in which hardware is
deployed.
Locations are not specified during application deployment. Not all IBM Cloud
services are available in all regions.
Not all IBM Cloud services are available in all regions.
You can choose to deploy your application to a single region or multiple regions.
Consider the following points: For low application latency, select the region that is
nearest to your users.
To meet certain countries’ data security requirements, select the region where you
are required to store the application data. For high availability, select multiple
regions. If your application fails in one region, it is still available on another region.
You should use similar criteria when choosing a location to deploy infrastructure.
Within the IBM Cloud console, the region is automatically set to the closest healthy
region. To switch to another region, click the user account link, expand the Region
menu and select the region. If you use a Lite Account, you can use only one region
for your applications and services.
Cloud Foundry uses the Diego architecture to manage the application life-cycle for
deploying and starting the application on Cloud Foundry.
As a developer, you interact with IBM Cloud by using your web browser or the CLI.
When you create an app and deploy it to Cloud Foundry, the IBM Cloud environment
determines an appropriate virtual server to which to send the app.
The virtual server is chosen based on several factors, including the hardware/file
system that is required by the app, and the load that is on the machine.
After a virtual server is chosen, the following tasks are completed:
An application manager on the virtual server installs the appropriate
framework and runtime for the app.
The app is deployed into that framework.
When the deployment completes, the application artifacts are started.
When the app is deployed, if it has a web interface (as for a Java web app), or
other REST-based services (such as mobile services exposed publicly to the
mobile app), users of the app can communicate with it by using normal HTTP
requests.
Each virtual server has multiple apps deployed on it.
Building in the IBM Cloud
You can build applications in IBM Cloud by using IBM Cloud Foundry. Cloud
Foundry is a platform that provides a developer focused environment, where you can
build different kinds of applications powered by DevOps and Security:
Front-end, Back-end, Mobile, Web, Internet of Things, Blockchain, Enterprise
grade Messaging Apps, and Quantum.
Once your application is built and tested, you can deploy it using technologies like
serverless computing, IBM Cloud Foundry and Kubernetes.
The IBM Cloud Code Engine is a new service that provides a fully managed,
serverless platform to run 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.
Because these workloads are all hosted within the same Kubernetes infrastructure,
all of them can seamlessly work together. The Code Engine experience is designed
so that you can focus on writing code and not on the infrastructure that is needed to
host it.
Services hosted by IBM Cloud provide ready-to-use functionality that your
application can access. You can use predefined services provided by IBM Cloud,
which include database, messaging, push notifications for mobile apps, and elastic
caching for web applications, along with various machine learning and AI services.
You can build custom services to meet your needs.
These services might be simple utilities, such as functions for a runtime library, or
complex business logic for a business process modelling service or a database.
The IBM Cloud catalogue lists Services, Software, and Consulting resources.
Resources are entities such as Cloud Foundry applications, services, virtual
machines, and containers, that you can create according to your requirements. To
help you locate the resource you want to create, the IBM Cloud catalogue organizes
resources into Category, Provider, Pricing Plan, Compliance, and Release.
IBM Cloud manages and maintains the infrastructure that runs your Cloud Foundry
applications. To support apps in varied scenarios, IBM Cloud supports multiple types
of infrastructure:
IBM Cloud Kubernetes Service. Kubernetes containers provide more control
over the computing infrastructure to run the application and services through
Docker-like APIs. Docker packages software into standardized units that are
called containers. Containers are described later in this course.
Virtual Servers. Virtual servers are software implementation of hardware that
runs applications. You can configure the operating system, server runtime
environment, and application. Use Virtual Servers when you want to control
the infrastructure right down to the operating system level.
IBM Cloud for VMware Solutions. IBM Cloud for VMWare Solutions offers on-
demand deployment and management of VMware Cloud Foundation and
vCenter Server.
Physical infrastructure resources. You also can deploy and use physical
infrastructure resources, such as bare metal servers, storage, networking, and
security, for fine-grained control over computing resources.
IBM Cloud supports the following infrastructure types:
Containers include all the elements that an application needs to run, providing
greater control over the computing infrastructure by running the application
and services through Docker-like APIs.
Docker packages software into standardized containers.
The IBM Cloud Kubernetes Service combines Docker and Kubernetes to
deliver powerful tools, an intuitive user experience, built-in security, and
isolation to automate the deployment, operation, scaling, and monitoring of
containerized applications over a cluster.
You can create a Kubernetes cluster that consists of one or more VMs that
are called worker nodes.
Every worker node represents a compute host in which you can deploy, run,
and manage containerized applications. You can use and extend public
images, such as the IBM Integration Bus V10 Developer Edition, which you
can use to start developing your own integration solution. Containers give you
more control, but still do not require you to manage an operating system or
network. IBM containers resemble the popular open-source container engine
Docker but have some IBM Cloud specific features, such as their ability to
integrate with Cloud Foundry routers.
Virtual servers are a software implementation of hardware that runs
applications that is similar to a computer. You can configure the operating
system, server runtime environment, and application. If you want to control
the infrastructure down to the operating system level, consider the use of
Virtual servers.
Containers and virtual servers share objectives:
To isolate an application and its dependencies into a self-contained unit that
can run anywhere. They both remove the need for physical hardware, which
allows for more efficient use of computing resources.
Virtual servers, or virtual machines (VM), provide hardware virtualization and
are created by using a hypervisor.
The hypervisor virtualizes the physical hardware to create a software-defined
computer that runs its own operating system. Unless special software is
installed for cloud management, an operating system that is running on a VM
is unaware that it is running on VM.
A container provides operating system-level virtualization.
A container library such as Docker separates different user spaces for each
container. On the surface, these spaces might resemble a VM to a user. The
main difference between containers and VMs is that containers share the
operating system kernel with other containers that are running on the
machine, which is not the case with VMS. Therefore, you might see a VM
running Linux on a Windows server or Windows on a Linux server. However,
you do not see a container that runs Linux on anything other than a Linux
server.
The containers on that Linux server are separate user spaces on that Linux
server and the hardware is not virtualized.
Data storage also is managed differently in containers. In VMs, virtual disks
are created and are similar to physical disks in that after you write something
to the disk, it stays there until you delete it.
With containers, you can make changes to the disk and then delete your
changes when you are done.
Getting Started with IBM Cloud Catalogue
Resources
In IBM Cloud, starter kits are packages of sample applications.
When you create an application by using starter kit, IBM Cloud configures the
services for the application.
IBM Cloud also provides the source code and documentation for the sample
application in the starter kit. A starter kit contains an application, its associated
runtime environment, and certain predefined services. Starter kits guide you as you
begin your application development, and help you get started quickly.
For example, you can select the Python Web App with Flask starter kit to host a web
application and accelerate development time of server-side scripts by using the web
app template and SDK.
Services are extensions to the cloud environment that IBM Cloud hosts and
manages. Predefined services provided by IBM Cloud include NoSQL and SQL
databases, the ability to send push notifications to your mobile app, and automated
language translation.
You can add services to your IBM Cloud application from the IBM Cloud catalogue.
Services provide a predefined endpoint that you can access from your application to
use the predefined functionality of that service.
The infrastructure for services is managed by IBM Cloud, and your app needs to
focus on the provided endpoint only.
You can bind more than one app to a service to share services between your apps.
Many IBM Cloud services are available, and more are being added.
The slide shows a sample of the available Watson AI services.
Creating and managing an IBM Cloud
Application
Let’s create an IBM Cloud application.
First, go to the dashboard and click Create resource.
Next, look in the catalogue and select the Compute category and click the Cloud
Foundry tile and then, select the runtime you want to use.
The following runtimes are now available as Cloud Foundry Apps:
Liberty for Java,
SDK for Node.js,
ASP.NET Core,
Runtime for Swift,
Xpages,
Go,
PHP,
Python,
Ruby, and
Tomcat.
Note that choices might change in future.
Enter your application name and hostname. Then, choose the region, organization,
and space, and select the pricing plan for this application.
Note that the free tier is only available in the Lite account. If you’re using the trial
account, the free tier isn’t available. If you are using the IBM Cloud Lite account, you
are not charged for any usage.
To open the Application Details page, click the application name in the IBM Cloud
Dashboard. Here you can check and control status of your applications. View and
adjust the memory resources that are used and even start, stop, and restart your
application. You can also view the application in a browser and adjust the number of
instances.
To view the application route, click Visit App URL from the Application Details page.
The application route is the entry point for your application users and it lets you host
a REST service, web app, or web page. You can only access the application route if
the application is running. The application route must be unique across all applications in
the domain.
Creating an IBM Cloud Service and Web
App
You can add an IBM Cloud service to your application by clicking Create resource
from the application dashboard and then, selecting a service from the IBM Cloud
Catalogue.
You must then enter a name for the service and select a pricing plan for your
service. Plans allow you to choose different “sizes” for the service, such as how
much power you put behind it.
For example, with some services, you can choose if you share hardware or use
dedicated hardware.
You can bind the service to your application from this page, or leave the service
unbound.
If you leave the service unbound, IBM Cloud creates and provides credentials for
accessing the service, which you can access from within the service dashboard.
If you bind the service to an application, the credentials are in the application's
environment variables.
To bind the service to your application, browse to your Application Details page and
select the Connections tab on the left navigation bar, then click Create connection.
To bind a service to your application, hover over the compatible service and click
Connect.
A dialog box prompts you to restage the application.
Click Restage. Restaging the application makes the service available for use by your
application.
IBM Cloud allows you to choose one of the services that was created earlier to bind
it to your application.
IBM Cloud lists the services that you created that are compatible with your service
and runtime environment.
Some services are specific to certain runtimes, such as a Java Runtime monitor, and
might not be applicable or indeed usable from your application.
When you bind a service to an application, IBM Cloud creates a set of credentials to
access the service and places the connection information for this service in the
application environment variable, which is called VCAP_SERVICES.
Environment variables contain the environment information of a deployed application
on IBM Cloud.
IBM Cloud automatically populates the environment variable VCAP_SERVICES with
the services that you bind to your IBM Cloud application.
Use the user-defined environment variables for configuration settings, instead of
hard-coding the values in your application.
For example, you can save the web service endpoint, user name, and password for
a cloud-based database as a user-defined environment variable.
You can access the application environment variables from the Application Details
page by clicking Runtime on the left navigation bar then, clicking the Environment
variables tab.
To create a Web App, click the three horizontal bars that are next to the IBM Cloud
logo, choose Web Apps, and then, click Get Starter Kit. Web Apps contains starter-
kits that are pre-configured and integrated with various technologies that enable you
to quickly develop your web application. For example, Express.js React is a starter-
kit which provides a rich React front-end delivered from a Node.js application.
Introduction to Node.js
Node.js is an open-source language that runs on V8.
Being open source, means that node.js can run on Linux, Windows, and Mac OSX.
V8 is an open-source engine that was developed by Google for the Google Chrome
browser.
Developers often use JavaScript for client-side functionality.
Node.js is the server component in the same language.
Node.js is event-driven and uses asynchronous, non-blocking I/O.
With server-side JavaScript, Node applications process, and route web service
requests from the client.
1. In step 1, the user selects an option in the user interface, written in HTML and
CSS.
2. In step 2, this action by the user triggers JavaScript code that implements the
business logic on the client-side, for example, input validation.
3. In step 3, the JavaScript application makes a web service call over HTTP with
a JSON data payload. The REST web service, which is part of a node.js
application running on the node server, receives the HTTP request.
4. In step 4, the REST web service processes the request and returns the result
to the client as a JSON payload over HTTP.
Although developers can still use JavaScript for browser functionality in frameworks,
such as angularJS, Dojo, and jQuery, they can now use Node.js in the same
components of the architecture where they use Java, Perl, C++, Python, and Ruby.
Node.js is used in production by companies, such as Uber, Yahoo!, LinkedIn,
GoDaddy, eBay, and PayPal. It is event-driven and uses asynchronous, non-
blocking I/O.
Express.js is a highly configurable framework for building applications on Node.js.
It abstracts lower-level APIs in Node.js by using HTTP utility methods and
middleware Before you build your first Node.js app, let’s get familiar with the IDE and
some key Node.js concepts.
You can review the documentation for the command-line tool from Getting Started in
Application Details.
To work with IBM Cloud by using the CLI, you can use ibmcloud CLI or cf CLI.
Note that IBM Cloud CLI enables you to manage applications, containers,
infrastructures, services and other resources in IBM Cloud. It also bundles cf CLI, to
manage Cloud Foundry resources on IBM Cloud. CF CLI allows you to manage only
Cloud Foundry resources on IBM Cloud.
After you specify the account, you can specify the resource group or Cloud Foundry
organization. If you are using a federated ID, use “ibmcloud login –sso”. A URL is
supplied for you.
Open this URL in a browser, sign in and paste your one-time passcode into the CLI
to authenticate.
The use of the ibmcloud target command allows you to select the cloud foundry
organization and space on which you work.
The cf CLI can be used to manage Cloud Foundry applications and services on IBM
Cloud.
Download the most recent cf installer from the Git project, which includes a list of
installers and binaries downloadable for most systems.
Generally, download an installer because they are faster and easier to use than the
raw binaries.
After you download and run the installer, open a command prompt on your system
and run the command line tool by entering cf --version.
Note that IBM Cloud CLI bundles cf CLI.
All cf commands can be used with IBM Cloud CLI by using the following syntax:
ibmcloud cf <cf_command> Log in to IBM Cloud by using the CLI.
The login command requires the following parameters: Cloud Foundry API endpoint,
username, password, organization name and space name.
You can use the command-line client with other Cloud Foundry regions by pointing
to other API endpoints; for example, api.eu-gb.bluemix.net for UK region. You can
use the flags -a, -u, and so on to specify the parameters at the command line.
If you do not specify one of the parameters, the command-line utility prompts you to
enter it later.
In the example that is shown in the slide, the password was not entered; therefore,
the command-line utility prompts the user to enter the password. If you use a
federated ID, use cf login –sso.
A URL is provided for you.
Open this URL in a browser; then, login and copy your one-time passcode and paste
it in the CLI to authenticate.
The use of the push command uploads, deploys, and starts the application in your
IBM Cloud space. When you are ready to deploy your application to IBM Cloud
complete the following steps: Browse to your application root directory where the
manifest.yml is stored then Run the cf push command. "Pushing your app" is the
terminology that is used to indicate that you are going to deploy the latest changes of
your app to IBM Cloud.
Remember that when you push your application, it overwrites the current contents of
your application in your IBM Cloud account. Write down the application route. You
can test your application with this entry point. This slide shows the command-line
utility accessing a manifest file.
You can control various aspects of the deployment, such as the amount of memory
an application receives and the route of the application, by specifying them as flags
in the command. However, you can also store these settings in a manifest.yml file to
make the command you need shorter to enter in later iterations of your application.
After the command-line utility finishes pushing your application, browse to the route
name you wrote down in the previous step to test whether the application is running.
Before DevOps, there were two teams that were responsible for code delivery: the
Development team and the Operations team.
1. The development team designed the code, delivered new features, fixed
bugs, and tested the code.
2. The Operations team deployed the code to the different environments,
maintained the uptime on production, and diagnosed failures.
With DevOps, both teams work together to support the software lifecycle, from code
design to deployment to production.
You can use DevOps processes and tools to automate the build process, code
testing, deployment to the different environments, and monitoring.
Developers actively and continuously perform tasks to keep the automation,
pipelines, and other entities in this realm up to date and even improve them, as well
as develop code.
The IBM Cloud Catalogue provides services to enable end-to-end DevOps, such as
Auto-scaling, Monitoring, and Continuous Delivery.
You can access these services from the catalogue by selecting the Developer Tools
category.
IBM Cloud Continuous Delivery Overview
Continuous Delivery is a DevOps service that you can use to build, test, and deliver
applications.
You can use toolchain to:
Create integrated DevOps open toolchains to enable tool integrations that
support your development, deployment, and operations tasks.
Edit and push your code from anywhere by using the web-based IDE.
Create, edit, run, and debug code, and complete source-control tasks in
GitHub.
Seamlessly move from editing your code to deploying it to production.
Collaborate with your team and manage your source code with a Git
repository (repo) and issue tracker.
Manage Git repos through fine-grained access controls that keep code
secure.
Deliver continuously by using automated pipelines.
Automate builds, unit tests, and deployments and
be ready to release into production at any time.
In Web IDE, you can develop code such as Node.js, Java, or other languages.
No software other than your web browser is necessary.
Web IDE saves your current work in a cloud-based file directory, which is known as
the local repository. You can also configure the build, deploy, or test scripts within
Web IDE.
IBM Cloud provides Eclipse Orion as the Web IDE. You can also use a desktop IDE
with DevOps services.
For source control management (SCM) and issue tracking, Continuous Delivery
creates a Git repo as a change management system.
The local repository is a copy of your latest edits before you submit your work to the
SCM system.
The Git repo, which is the remote repository, is hosted on the IBM Cloud DevOps
infrastructure.
The issue tracker tracks your work including defects, enhancements, and tasks.
The issue tracker is hosted by IBM and built on GitLab Community Edition.
Track issues and share ideas through the issue tracker.
Review code and enhance collaboration through merge requests.
Document projects on the wiki system.
The Delivery Pipeline tool automates the process of building and deploying your
code as an IBM Cloud application. Build, test, and deploy in a repeatable way with
minimal human intervention.
Creating IBM Cloud Continuous Delivery
Toolchains
To add Continuous Delivery to your application, complete the following steps:
1. First, in the IBM Cloud dashboard, select Continuous Delivery.
2. Select a region closest to you and select a price plan. The free Lite plan is the
default selection.
3. Optionally, update the service name.
4. Now, to create the service instance, click Create. When you create the
service, the Getting Started page appears.
5. To add your first toolchain here, click Create a Toolchain. You can also add a
toolchain from the catalogue.
6. Another way would be to add a toolchain to an existing application by
enabling Continuous Delivery.
7. You can create a toolchain from a template or build one from scratch by
enabling an application for continuous delivery. The toolchain will use the
Continuous Delivery service under the covers. Depending on how the
toolchain was created, it might contain some preconfigured tools.
8. You can add additional tools by selecting Add tool.
The user interface (UI) to create a toolchain groups the tools into the following four
phases:
1. THINK is for planning the application by creating bugs, tasks, or ideas using
the Git repo Issue Tracker.
2. CODE is for implementing the application by providing a GIT repo as an SCM
system and a Web IDE to edit your code online. In the repository, you can
specify whether to clone a repository or start from scratch by selecting New in
the repository type.
3. DELIVER: is for configuring the delivery pipeline. It allows you to specify
automatic build, deployment, and testing of your code after a developer
pushes new code to the Git repo and
4. RUN is for running the application in the IBM Cloud environment.
The collective power of a toolchain is greater than the sum of its individual tool
integrations. In the Tool Integrations section, select each tool integration that you
want to configure for your toolchain. Consider the following examples:
If you configure Sauce Labs, the toolchain is set up to enable adding Sauce
Labs, which you can use to add test jobs to the pipelines.
If you configure PagerDuty, the toolchain is set up to send alert notifications to
the specified PagerDuty service when a major issue occurs.
If you configure Slack, the toolchain is set up to send notifications to the
specified Slack channel and
if you configure GitHub for source code tool integration, the sample repo can
be cloned or forked, for example, into your GitHub account.
Web IDE Features
The Web IDE features in Continuous Delivery provide the following capabilities:
IBM Cloud uses Eclipse Orion Web IDE. No installations are required. You
can use a browser to code. It’s a full-featured environment for writing your
application code in your web browser, with rich code completion capabilities
for CSS, HTML, and JavaScript. The Edit Code feature provides a workspace
to develop source code and configuration files. From the Run bar, you can
deploy, stop, and run applications, and view the logs.
IBM Cloud Live Sync features available for Node.js applications include:
o Live Edit, which allows you to make changes to your application from
the Web IDE without the need to redeploy it.
o When a Node.js application is in Live Edit mode, you can shell into it
and debug it.
If you are building a Node.js application, you can use IBM Cloud Live Sync to quickly
update the application instance on IBM Cloud and develop without redeploying.
When you make a change, you can see that change in your running IBM Cloud
application immediately without the need to recompile and redeploy.
IBM Cloud Live Sync works from the Web IDE. Its features for Node.js applications
include Live Edit and Debug.
With Live Edit, you can change a Node.js application that is running in IBM Cloud
and test in your browser immediately.
Any changes that you make in a synchronized desktop directory or in the Web IDE
are instantly propagated to the application’s file system.
The Debug features works only in the Chrome browser. You can edit code
dynamically, insert breakpoints, step through code, restart the runtime, and perform
other debug functions.
Source Code Management (Git Repo) and
Issue Tracker
You can collaborate with your team and manage your source code with a Git
repository (repo) and issue tracker that is hosted by IBM and built on GitLab
Community Edition. The toolchain does not bind you to use Gitlab.
GitHub is also supported.
Alternatively, you can also use other version control systems by adding them as
tools in the toolchain.
The Git Repos and Issue Tracking tool integration supports teams in many ways.
You can:
Manage Git repos through fine-grained access controls that keep code
secure.
Review code and enhance collaboration through merge requests.
Track issues and share ideas through the issue tracker and
document projects on the wiki system.
Switch to the Git perspective from the navigation bar on the left side of the Web IDE.
You can review the commit history with the time and date for each commit.
You can also perform actions for each commit such as viewing the files committed
and reverting changes that were introduced by any commit.
The Working Directory Changes pane detects any updated files in the user directory
files.
Click a file to review the changes that were made in that file.
Select the files that you want to commit and add a descriptive comment about the
change.
Click Commit to commit the changes to your local repository.
The Outgoing pane lists the files that you want to commit to the remote repository.
View the outgoing changes and then click Push to push the committed changes to
the remote repository.
If another user updated the files in the remote repository, the incoming pane lists the
updated files.
You can still develop your application on your own local workstation.
If you do not have a Git client installed, download and install the latest version of the
Git client from: https://git-scm.com/downloads.
To verify that the installation is successful, issue the git --version command from the
command line.
To find the URL of the Git repo that is associated with your application, click View
toolchain from the Application Details, then click Git.
To start, retrieve a copy of the IBM Cloud application source code by using the git
clone command.
Issue git clone $git-URL on your Command Prompt.
After you have a copy of the source code, use a text editor or integrated
development environment to write and test your application.
You can get the Git repo address from the toolchain or by using the IBM Cloud
command line interface (CLI).
To check whether another developer on your team updated the source code, run the
git status command.
Save the updated source code by running the git add command to stage the files to
be committed.
Then run the git commit command and enter a message for the history log to commit
all the added files to your local repository.
Finally, run the git push command to send your committed changes to the remote
repository.
Issue Tracker is the tool for tracking items that require resolution or improvements in
a project. Issues can be bugs, tasks, or ideas to be discussed. Issues are searchable
and filterable.
To create a bug or task, complete the form.
Then click Submit issue.
Build and Deploy Automated Delivery
Pipeline
By default, Continuous Delivery automatically runs the build and deploy tasks when
you commit changes to the Git repository (repo).
The pipeline also features a "run" icon that runs a stage of the pipeline but only runs
on committed code or builds, depending on the stage.
You can access the Continuous Delivery toolchain by clicking View toolchain from
the Application Details page.
To navigate to the pipeline, click its tool card in the toolchain overview page.
Jobs are Build, Deploy, and Test.
They are grouped into stages.
You can change the order of the stages by dragging and dropping.
You can also configure a stage to include more than one job of the same type.
For example, you can have a stage that features one Build job, one Deploy job, and
two Test jobs.
In fact, the pipeline is completely customizable.
You can explicitly state what branch should trigger a build,
you can run various tests when a pipeline is triggered, and you can tell the pipeline
to create output in each stage and pass it to the next stage in the pipeline.
The default build script is simple: It takes the files that are pushed to the remote Git
repo and triggers IBM Cloud to build your code in the server runtime.
You can customize the settings for the server runtime through the manifest.yml file.
After the Build stage completes successfully, the Deploy stage runs.
Delivery Pipeline deploys the built files to your IBM Cloud space.
By default, Delivery Pipeline runs the Build stage when a client pushes any change
to the master branch in the remote Git repo.
If you do not want to automatically push your changes to your IBM Cloud account,
change the State trigger setting to Run jobs only when this stage is run manually.
You can extend the features of the Build stage by adding jobs.
Although by default Delivery Pipeline names this stage configuration the Build stage,
you can also add Test or Deploy jobs.
The LAST EXECUTION RESULT pane shows that the application was successfully
deployed to your IBM Cloud account and that the application is running on IBM
Cloud.
You can also check the build logs in the JOBS pane in the Build Stage column, the
deploy logs in the JOBS pane in the Deploy Stage column, and the runtime logs from
the LAST EXECUTION RESULT pane also in the Deploy Stage column.
You can clone the Deploy stage and deploy the application to any number of spaces
in your IBM Cloud account by clicking the settings wheel icon on top of Deploy Stage
and selecting Clone Stage.
IBM Cloud Code Engine
One of the biggest challenges the developers face is that they have to spend effort to
maintain infrastructure, learn and understand Kubernetes, update the Kubernetes
clusters and install security patches. There is also an issue of learning every different
way of deployment depending on where the code is sourced from.
IBM Cloud Code Engine is a fully managed, serverless platform that hosts all of your
cloud-native containerized workloads. The user experience is developer-centric and
designed so that you focus on writing code instead of dealing with the underlying
infrastructure complexity and its security. Cluster complexity is invisible to the
developers and there is no need for the developers to be trained on Kubernetes.
If your containers, applications or batch jobs need to scale, Code Engine takes care
of that for you, as well. The underlying cloud-scale architecture will dynamically scale
up or down to match your requirements in order to keep your apps running smoothly.
You only pay for what you actually use, including nothing if you allow Code Engine to
scale your applications down to zero.
Code Engine is more than a platform to deploy your existing container images. If you
don’t have an image, Code Engine will build one for you from your Git repository.
The build process is automated, and you choose whether to use a Dockerfile
(describing the build process), or a cloud native build packs. The deployment
experience is unified irrespective whether you are running containers or deploying
from source code through Docker files or submitting large batch of code to the IBM
Cloud.