This document provides an overview of application deployment on cloud platforms. It begins with an introduction to cloud computing and comparisons of SAAS, PAAS and IAAS models. The document then discusses benefits and challenges of cloud deployment. It also covers business and architectural considerations for moving applications to the cloud. Finally, it demonstrates several popular platform as a service providers like Firebase, AWS, Heroku and Cloud Foundry and provides guidance on deploying applications on each.
2. www.tothenew.com
Agenda
● Introduction to cloud computing
● SAAS, PAAS and IAAS - A quick comparison
● Benefits of deploying on cloud
● Challenges while deploying on cloud
● Things to consider when moving to cloud - Business and Architectural aspects
● A thing about clustering
● Comparison between various Platform as a Service (PAAS) providers.
● Demo using:
○ Firebase - https://firebase.google.com/
○ AWS - https://aws.amazon.com/
○ Heroku - http://heroku.com/
○ Cloud Foundry - https://www.cloudfoundry.org/
4. www.tothenew.com
Cloud Computing
In the simplest terms,
cloud computing means
storing and accessing data and programs over
the Internet instead of your computer's hard drive.
7. www.tothenew.com
A Few More Reasons to Use Cloud
● Scalability
● Availability
● No need for DevOps expertise
● If a pre-packaged service is not suitable for one’s need, you can get a custom solution with added cost
8. www.tothenew.com
Challenges While Deploying on the Cloud
• Dependency on the Internet connection
• Legal issues (ownership of data)
• Data transfer can be time consuming
• Dependency on the service provider
• Limited control and reliability
• May require new training
• Security and privacy of the data as per rules and regulations
• Security measures against a cyber attack
• App structure may require changes
9. www.tothenew.com
Even with all of the above challenges associated with Cloud computing, the environment has immense
potential for many business models. As platforms mature and the economies of scale continue to grow, costs
will continue to fall and reliability and security standards will improve further.
Immense Potential of the Cloud Environment
10. www.tothenew.com
Things to Consider When Moving to Cloud - Business Aspects
● Implementation & Integration
○ Planning
○ Compatibility
○ Flexibility
● Cost
○ Cost Variations
○ Hardware Costs
○ System Complexity
● Availability & Performance
○ Bandwidth
○ Uptime
○ Support & Maintenance
● Data Security & Protection
○ Data Protection
○ Hardware Security
○ Backup & Disaster Recovery
● Standards & Regulations
○ Compliance
○ Confidentiality
○ Policies and Procedures
11. www.tothenew.com
Things to Consider When Moving to Cloud - Architectural Aspects
● Single Instance vs Clustered
● Deployment
● Green-blue deployment
● Rescaling
● Auto-scaling
○ RPM, Swap Utilization, Message Queue, CPU Utilization
● Restarting
● Rollback
● Config
○ Changing config requires restart of all servers
● Logs - Logstash, Logentries, Papertrail, etc.
● Performance monitoring - New relic, Airbrake
12. www.tothenew.com
A Thing About Clustering
● A way to provide high-availability by replicating your system
● Handles hardware/software failure
● Traffic is not always high
● Provides for horizontal scaling
● Overcomes CPU/RAM limitations
13. www.tothenew.com
Setting up a Local Cluster
/etc/nginx/sites-available/default
------------------------
server {
listen 80;
location / {
proxy_pass http://intellimeetservers;
}
}
upstream intellimeetservers {
server 127.0.0.1:7070;
server 127.0.0.1:8080;
}
● nginx Load Balancing - http://goo.gl/78uu8O
● Apache Load Balancing - http://goo.gl/c5seF2
16. www.tothenew.com
● Firebase is known primarily as a PaaS
● It is deeply integrated with Google Cloud Platform, allowing you to use Google's Infrastructure-as-a-Service directly within your Firebase
project.
Key Features:
It's more than capable of handling real-time data updates between devices. Provides
cross platform API if you are using firebase DB with an app.
Limitations:
Storage format is entirely different to that of SQL, (Firebase uses JSON) so you won’t
be able to migrate that easily. Reporting tools won't be anywhere near to the ones of
standard SQL.
Pricing:
It has a free plan for hobbyists along with a fixed price plan of $25/Month for
predictable pricing for growing apps and a pay as you go plan for commodity
pricing.
Bonus:
New users can get real time db with up to 1GB of database storage, 5GB of file
storage to handle file uploads and 1GB of hosting space to upload your static site
content. This is more than enough to launch a small website.
Few Insights
17. www.tothenew.com
Hosting Your Web-app on Firebase
• Setup Firebase CLI for ubuntu - here
• Visit Firebase website - here
• Create a web-app on Firebase console
• Set auth to access database
• Sign-in to Google
– firebase login
• Initialize Firebase on your development machine
– firebase init
• Check your application
– firebase serve
• Deploy your application
– firebase deploy
19. www.tothenew.com
● AWS is primarily known as an IaaS
● Many of the services available in AWS are comparable to services available in PaaS offerings
Key Features:
Since AWS is largely an IaaS, there is virtually no limit to the languages,
databases or server side technologies you can install and run.
Limitations:
AWS services may require more management overhead than other PaaS
options.
Pricing:
Pricing is based on instances, storage, application services and data egress
charges. Amazon, however, offers a monthly calculator to help you estimate your
costs.
Bonus:
New users can get 750 hours, 30GB storage, and 15GB bandwidth for free with
AWS's Free Usage Tier.
Few Insights
20. www.tothenew.com
Hosting Your Web-app on AWS
• Launch an EC2 instance
• Select an AMI- preferably Linux
• Choose instance type
• Configure instance (can be left alone and the default settings will be applied)
• Add Storage
• Tag instance
• Configure the Security Group by adding rules - Create new or use existing
• Review and launch
• Create a new key and download or use an existing key that is listed
• After the instance is up and running, you can set it up as you want
21. www.tothenew.com
Deploying Your Grails App on AWS
• Create a new EC2 instance from the AWS dashboard. Please ensure that the Security Group is configured to allow SSH on port 22 and HTTP
on port 80
• Login to the system using ssh and run the following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install nginx tomcat7 unzip git oracle-java7-installer
• Install "sdkman" to manage your Grails version
curl -s http://get.sdkman.io | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install grails <grails version>
22. www.tothenew.com
Deploying Your Grails App on AWS (contd.)
• Modify the default nginx site to redirect all traffic to the tomcat instance running on port 8080
default
----------
server {
listen 80;
server_name 127.0.0.1;
location / {
proxy_pass http://localhost:8080;
proxy_redirect default;
}
}
Restart nginx and check if your site is showing the default tomcat page
23. www.tothenew.com
Deploying Your Grails App on AWS (contd.)
● Generate a new ssh key for your instance and add the public key (id_rsa.pub) as a deploy key to your app. This will allow the instance to
clone the code repository every time you want to deploy
ssh-keygen -t rsa
● Once you have cloned the code repository on the instance, run the "grails war" command to create a new WAR file
sudo service tomcat7 stop
rm -rf /var/lib/tomcat7/webapps/*
grails war
sudo mv target/*.war /var/lib/tomcat7/webapps/ROOT.war
sudo service tomcat7 start
● Check if the site is working correctly
25. www.tothenew.com
Key Features:
One of the early PaaS providers, Heroku is ideal for quick deployments and fits a
wide range of distributed applications.
Limitations:
Cost of add-ons varies and estimating costs can be challenging as the number of
add-ons increases and loads vary across application components.
Pricing:
Based on the number and size of dynos deployed ($0.05/hour - $0.10/hour), the
size of Postgres database and add-ons used.
Bonus:
Starter databases with up to 10,000 rows are free. It has a huge marketplace and
one can find a lot of add-ons and support.
● Provides abstract computing environments called dynos
● Dynos are classified as: Web dynos or worker dynos; the former respond to HTTP requests and the latter to task requests in a queue
● Ideal for quick deployments
Few Insights
26. www.tothenew.com
Hosting Your Web-app on Heroku
• Setup Heroku toolbelt for ubuntu- link
• Deployment
– git push heroku master
• Rescaling
– heroku ps:scale web=2
– heroku ps:scale web+2
• Restarting
– heroku restart
• Rollback to old deployment version
– heroku rollback v46
• Config // automatic restarts all dynos/instances
– heroku config:set KEY=VALUE
• Logs
– heroku logs –t
– heroku logs –t –p web
28. www.tothenew.com
● You can deploy apps written in 8 languages to your private infrastructure of choice
● 5 frameworks are also available at your disposal
Key Features:
Cloud Foundry is extensible, so you can add more functionality via buildpacks or
similar mechanisms.
Limitations:
You cannot specify command line parameters like JAVA_OPTS and auto-scaling is
not provided.
Pricing: 0.03$/hr after 60 days free trial
Bonus: First class support for Grails.
Few Insights
29. www.tothenew.com
Deploying Your Grails App on Cloud Foundry
● Register a new account at https://run.pivotal.io/
● Install their CLI tool and run the following command:
cf login -a https://api.run.pivotal.io
● Add a manifest.yml file to be read by Cloud Foundry
manifest.yml
---
applications:
- name: im-todo
memory: 2G
instances: 1
path: target/AngularJS-0.1.war
buildpack: java_buildpack
services:
- mysql
30. www.tothenew.com
Deploying Your Grails App on Cloud Foundry (contd.)
● Provision a new mysql service using the following command:
cf create-service cleardb spark mysql
Read more about services here: https://docs.cloudfoundry.org/devguide/services/
● Modify the DataSource.groovy file to use the DATABASE_URL environment variable
Sample code:
https://github.com/cloudfoundry-samples/pong_matcher_grails/blob/master/grails-app/conf/DataSource.groovy
● Create the war file using the "grails war" command. This will create a war file in the target folder of your application
● Create a new app in your cloud foundry account
● To deploy, just run the command:
cf push im-todo
32. www.tothenew.com
● Microsoft eventually added Infrastructure-as-a-Service (IaaS) functionality to Azure and included Linux servers in the IaaS line-up as well as
Windows operating systems.
● 5 frameworks are also available at your disposal.
● If current deployment fails, it automatically deploys the last known successful war.
Key Features:
Since Windows Azure is an IaaS and PaaS in one, developers can mix and match
IaaS components with PaaS offerings giving you more control.
Limitations: Minimalist administration portal.
Pricing:
Based on size of instances running; prices range from $0.02/hour (768MB of RAM &
1 shared virtual core) to $0.64/hour (14GB of RAM & 8 virtual cores). Pricing for high
memory machines is also available.
Bonus: Free 30-day trial with a limit of up to $200 is available for new users.
Few Insights
34. www.tothenew.com
● You can deploy apps written in 6 languages to 2 different infrastructures.
● You can scale your applications vertically , horizontally or let OpenShift Online automatically scale your instances
Key Features:
It has a large number of component options spanning the application stack from
frontend to backend services. Developers can interface with OpenShift through a web
console, the command line or through an integrated development environment.
Limitations: It works well with Git, but non-Git deployments might require additional steps.
Pricing:
OpenShift Online pricing is based on the number and types of components (called
gears) you deploy. Gear prices range from $0.02/hour to $0.10/hour, depending on the
size: 512MB (small), 1GB (medium), or 2GB (large). The Silver support plan is $20/month
plus usage costs.
Bonus:
A limited number of resources are available as a trial; 3 small gears and 1GB of storage
per gear are free.
Few Insights