7. cloud software development - app harbor
DESCRIPTION
AppHarbor Telerik Software Academy: http://clouddevcourse.telerik.com/ The website and all video materials are in Bulgarian What is AppHarbor?; “Control panel” overview; AppHarbor architecture; Deployment process; Runtime; Pricing; Prices; Resources; Application deployment; Git crash-course; Sample application deployment; Configuration variables and Add-ons; Configuration variables; Shared SQL Server; MailgunTRANSCRIPT
![Page 1: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/1.jpg)
AppHarbor.NET Cloud Development Made Easy
George Georgiev
Telerik Software Academyacademy.telerik.com
Technical Trainer
1
AppHarbor
Public Cloud
http://clouddevcourse.telerik.com
![Page 2: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/2.jpg)
Table of Contents What is AppHarbor?
“Control panel” overview
AppHarbor architecture Deployment process
Runtime
Pricing Prices
Resources
2
![Page 3: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/3.jpg)
Table of Contents (2) Application deployment
Git crash-course
Sample application deployment
Configuration variables and Add-ons Configuration variables
Shared SQL Server
Mailgun
3
![Page 4: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/4.jpg)
What is AppHarbor?.NET Platform as a Service
![Page 5: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/5.jpg)
What is AppHarbor? Fully hosted .NET PaaS
Supports ASP.NET (Web Forms & MVC), WCF, WWF, ADO.NET Entity Framework, etc.
Runs on Amazon EC2 Automatic load balancing Easy application deployment
Through Git
Through Bitbucket, CodePlex or GitHub 5
![Page 6: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/6.jpg)
What is AppHarbor? (2) Automatic build
Code compilation
Unit tests execution
Rich set of add-ons Provide additional functionality for
applications
Shared Microsoft SQL Server, Airbrake, MongoHQ, StillAlive, Mailgun, etc.
Forum, support and knowledgebase
6
![Page 7: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/7.jpg)
“UI” OverviewA Quick Look over the “Application
Dashboard”
![Page 8: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/8.jpg)
AppHarbor ArchitectureDeployment process, Runtime
environment
![Page 9: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/9.jpg)
AppHarbor Architecture
9
Managed SQL Server / MySQL
MongoDB, CouchDB
Vis
ual S
tud
io +
Git
Ap
pH
arb
or
Ap
plicati
on
s
Man
ag
em
en
t C
on
sole
Load Balancer (Nginx)
Background workers
Web worker instances
Managed IIS environment
C# / ASP.NET MVC / Web Forms / WCF
Managed Windows environment
C# code
IronMQ, RabitMQ
Other AppHarbor Add-On Services
![Page 10: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/10.jpg)
AppHarbor Architecture (2)
Deployment process User pushes (sends) .NET code
Code is built by a platform build server If code compiles, unit tests are run
Results appear on the application dashboard
Service hooks are called
Application deployed to the AppHarbor application servers. AppHarbor scales application when
needed
10
![Page 11: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/11.jpg)
AppHarbor Architecture (3)
Application runtime environment Load balancing is automatic
SSL connections, HTML compression, etc. are handled
Everything runs on AWS and is managed by AppHarbor
Cloud resources are consumed through add-ons
More info: https://appharbor.com/page/how-it-works
11
![Page 12: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/12.jpg)
PricingPlans and Resources
![Page 13: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/13.jpg)
Pricing and Resources AppHarbor worker
Process which can have multiple threads Limited in resources
2 workers always on different machines
Resource limit per worker (https://appharbor.com/page/programpolicy) Network Bandwidth: 100GB/month -
Soft
RAM usage: 512MB - Soft; 1024MB - Hard
Nothing mentioned about processor time
13
![Page 14: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/14.jpg)
Pricing and Resources (2)
AppHarbor background worker Still in Beta
Regular .NET console application .exe’s produced on compilation
Used for Recurring tasks
Schedules
Etc.
14
![Page 15: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/15.jpg)
Plans (Canoe) Canoe plan
0$ per month
1 worker +1 background worker
apphb.com hostname
Piggyback SSL
15
![Page 16: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/16.jpg)
Plans (Catamaran)
Catamaran plan
49$ per month
2 workers +2 background workers
Custom hostnames
SNI SSL
16
![Page 17: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/17.jpg)
Plans (Yacht) Yacht plan
199$ per month
4 workers +4 background workers
Custom hostnames
IP-based SSL
17
![Page 18: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/18.jpg)
Git Crash CourseOnly What You Need to Know to Use
AppHarbor
![Page 19: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/19.jpg)
Git Crash Course Git
Source-control system
Can work with local and remote repositories
Git Bash – command line interface for Git
Free
Has Windows version (msysgit)http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.10-preview20120409.exe&can=3&q
=19
![Page 20: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/20.jpg)
Git Crash Course (2) Installation –
“next, next, next” does the trick
Options to select (they should be selected by default) “Use Git Bash only”
“Checkout Windows-style, commit Unix-style endings”
Note: this concerns only beginners
20
![Page 21: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/21.jpg)
Git Crash Course (3) Using Git Bash
Standard command prompt with added features
Creating a local repository git init
Preparing (adding/choosing) files for a commit git add [filename] (“git add .”
adds everything)
Committing to a local repository git commit –m “[your message here]”
21
![Page 22: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/22.jpg)
Git Crash Course (4) Using Git Bash (2)
Git “remote”– name for a repository URL
Git “master” – the current local branch (think of it as “where you have committed”)
Creating a remote git add remote [remote name]
[remote url]
Pushing to a remote (sending to a remote repository) git push [remote name] master
22
![Page 23: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/23.jpg)
Using Git BashLive Demo
![Page 24: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/24.jpg)
Application DeploymentDeploying your Application to
AppHarbor
![Page 25: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/25.jpg)
Application Deployment Getting your code to AppHarbor
Through Git AppHarbor provides Repository URL
Use Git to push to that URL
Other source-control systems – commit to some integrated with AppHarbor repository
Through Bitbucket, Codeplex, GitHub Have integration with AppHarbor
Can push code to AppHarbor’s repository
25
![Page 26: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/26.jpg)
Git and AppHarbor AppHarbor “requirements”
Submit a .NET Solution with All project files
All code files, libraries, etc.
All other resources
Solution must be a web application
If there is more than ONE solution file AppHarbor compiles the one named
“AppHarbor.sln”26
![Page 27: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/27.jpg)
Git and AppHarbor First deployment to AppHarbor with Git Initialize a repository where your
solution is
Add the relevant files to be committed
Commit to local repository
Create a remote to AppHarbor repository (get the URL from your application’s “dashboard”)
Push to the remote you created for AppHarbor
…and that’s everything!
27
![Page 28: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/28.jpg)
Git and AppHarbor Next deployments to AppHarbor
Add the relevant files to be committed Either all the files from before or only
the ones you modified
Commit to local repository Repository was created in the “First
deployment”
Push to the remote for AppHarbor We created this the first time too
Your application dashboard now has a history!
28
![Page 29: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/29.jpg)
Deploying to AppHarbor
Live Demo
![Page 30: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/30.jpg)
ConfigurationVariables and Add-
onsCustomizing and Enriching Your
Application
![Page 31: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/31.jpg)
Configuration variables Configuration variables
Key-value pairs
Local to an application
Used to change the behaviour of your application on AppHarbor f.e. a variable telling your application
if it is on AppHarbor or not
Added by user
Added by add-ons
31
![Page 32: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/32.jpg)
Configuration variables Adding a configuration variable in AppHarbor Go to application dashboard >>
Configuration variables >> Create new variable
Accessing configuration variables In your application config file
<appSettings>
<add name = “[variable name]” value = “[variable value]”/>
</appSettings>32
![Page 33: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/33.jpg)
Configuration Variables
Live Demo
![Page 34: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/34.jpg)
Add-ons Add-ons
Allow you to consume cloud resources
Added from add-on catalogue
Each application has its independent add-ons
Each add-on has a “control page” Usually in the form of “Go to [add-on
name]”
Use configuration variables for interaction with your application
34
![Page 35: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/35.jpg)
Add-ons Shared SQL Server
Provides a SQL Database
Gives you a server URI, username and password
Gives you a connection string Configuration variable with alias
Free – 20 MB
10$/month – 10 GB
35
![Page 36: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/36.jpg)
SQL Server Add-OnLive Demo
![Page 37: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/37.jpg)
Add-ons Mailgun
Provides e-mail services
Analysis and statistics tools
SMTP, POP3, IMAP
Has a C# API
Gives you hostname, login, password Through configuration variables
Free – 200 messages/day, temp storage
19$/month – 50000 messages/month, 20GB
37
![Page 38: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/38.jpg)
Mailgun Add-OnLive Demo
![Page 39: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/39.jpg)
Other Add-Ons Airbrake (error logging)
Blitz (performance monitoring)
CloudAMQP (RabbitMQ)
Cloudant (CouchDB)
CloudMailin (incoming email)
Dedicated SQL Server
JustOneDB (NoSLQ database)
Logentries (log management) 39
![Page 40: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/40.jpg)
AppHarbor: Add-Ons (2) Memcacher (in-memory caching)
MongoHQ (managed MongoDB)
MongoLab (managed MongoDB)
MySQL (shared MySQL DB)
RavenHQ (NoSQL database)
Redis To Go (key-value store)
SendGrid (email delivery)
StillAlive (app monitoring) 40
![Page 41: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/41.jpg)
форум програмиране, форум уеб дизайнкурсове и уроци по програмиране, уеб дизайн – безплатно
програмиране за деца – безплатни курсове и уроцибезплатен SEO курс - оптимизация за търсачки
уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop
уроци по програмиране и уеб дизайн за ученициASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC
безплатен курс "Разработка на софтуер в cloud среда"
BG Coder - онлайн състезателна система - online judge
курсове и уроци по програмиране, книги – безплатно от Наков
безплатен курс "Качествен програмен код"
алго академия – състезателно програмиране, състезания
ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NETкурсове и уроци по програмиране – Телерик академия
курс мобилни приложения с iPhone, Android, WP7, PhoneGap
free C# book, безплатна книга C#, книга Java, книга C#Дончо Минков - сайт за програмиранеНиколай Костов - блог за програмиранеC# курс, програмиране, безплатно
?
? ? ??
?? ?
?
?
?
??
?
?
? ?
Questions?
?
AppHarbor
http://academy.telerik.com
![Page 42: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/42.jpg)
Exercises1. Create an account in AppHarbor. See
the “Support” and “Add-ons” sections of AppHarbor.
2. Create an ASP.NET application which prints the message “The quick brown fox jumps over the lazy dog”. Use GitBash to deploy that application in AppHarbor. Then change the message and deploy the application again.
3. Create an ASP.NET application with a single button and a text box. When the button is pressed, the application should print some text in the text box, indicating whether it is started locally or in AppHarbor. Use configuration variables. Use GitBash to deploy that application in AppHarbor.
![Page 43: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/43.jpg)
Exercises
4. Create an ASP.NET “Online Restaurant” application which displays a restaurant menu. Each item in the menu has a name, ingredients and a price. The menu should be visible to everyone. There should be administrators, which authenticate with a username and password and can add items to the menu. Deploy the application to AppHarbor
5. Edit the “Online Restaurant” application from exercise 4 so that it can be switched off from AppHarbor (i.e. display only a message, saying “The restaurant is on a holiday”). Hint: use configuration variables
![Page 44: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/44.jpg)
Exercises6. Edit the “Online Restaurant”
application, so that items from the menu can be ordered (purchased). When a user orders an item he should enter his name, address and e-mail address. After that, an e-mail which notifies the user he successfully made an order should be sent (the e-mail should mention the user’s order, name and address).The administrators should be able to download a text file with all of the information for all of the orders (item ordered, user name, address, e-mail).
7. Provide a text file with the AppHarbor URLs of the applications from these exercises.
![Page 45: 7. Cloud software development - app harbor](https://reader036.vdocuments.us/reader036/viewer/2022062514/558524f1d8b42ae4748b4f34/html5/thumbnails/45.jpg)
Free Trainings @ Telerik Academy
“Cloud Development" course @ Telerik Academy clouddevcourse.telerik.com
Telerik Software Academy academy.telerik.com
Telerik Academy @ Facebook facebook.com/TelerikAcademy
Telerik Software Academy Forums forums.academy.telerik.com