web and app servers
DESCRIPTION
What are application and web servers. What and how to configure application server. Basic fundamental and how it works for me.TRANSCRIPT
![Page 1: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/1.jpg)
Application/Web ServerSapna Solutions
![Page 2: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/2.jpg)
Sapna Solutions
2
One Rails instance handles all requests Rails is single-threaded: There is only one concurrent request
Simple Rails Setup
![Page 3: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/3.jpg)
Sapna Solutions
3
Rails Setup
![Page 4: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/4.jpg)
Sapna Solutions
4
Typical Rails Setup
A load-balancer distributes the incoming requests
Some load-balancers will deliver static requests themselves
Several Rails instances handle all requests
Number of concurrent requests equals number of Rails instances
![Page 5: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/5.jpg)
Sapna Solutions
5
Deployment Questions
![Page 6: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/6.jpg)
Sapna Solutions
6
Deployment Questions
![Page 7: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/7.jpg)
SERVERS
Rails Application Server
FastCGI
Mongrel
mod_rails / Phussion Passenger
JRuby + Glassfish & Co.
Proxy/Web Server
Apache2
Nginx
Lighttpd
HA-Proxy
Sapna Solutions
7
![Page 8: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/8.jpg)
FastCGI
Protocol to communicate with long-running CGI applications
Usage of either mod_fcgi with Apache 1.3 or mod_fcgi with Lighttpd
Proxy local and remote FastCGI instances
Oldest way of deploying Rails
Deprecated and unstable
Hard to debug (FastCGI protocol)
Sapna Solutions
8
![Page 9: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/9.jpg)
Sapna Solutions
9FastCGI
![Page 10: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/10.jpg)
Sapna Solutions
10
![Page 11: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/11.jpg)
Sapna Solutions
11
Mongrel
![Page 12: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/12.jpg)
Mongrel
Developed by Zed Shaw as an alternative to FastCGI
Complete HTTP-Server that can load arbitrary Ruby-servlets
Built-in Rails support
Sapna Solutions
12
![Page 13: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/13.jpg)
Sapna Solutions
13Mongrel
![Page 14: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/14.jpg)
Sapna Solutions
14Mongrel
![Page 15: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/15.jpg)
Mongrel
Very robust
Strict HTTP parser
Easy to debug (HTTP!)
Used to be defacto deployment setup with Apache 2.2 and mod_proxy_balancer
Can be a bit difficult to setup (mongrel_cluster, ports, Apache)
Not so easy on mass/virtual hosting
Sapna Solutions
15
![Page 16: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/16.jpg)
Mod_rails a.k.a Phusion Passenger
Sapna Solutions
16
![Page 17: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/17.jpg)
Mod_rails a.k.a Phusion Passenger
Module for Apache 2.2 (and Nginx)
Allows Apache to control Rails instances
Apache starts and stops application instances depending on the application load
Able to run any Rack-compatible Ruby application (Merb, Sinatra & Co.)
Only manages Rails on one host - no remote instances
Combine with HTTP-Proxy / balancing solution
Sapna Solutions
17
![Page 18: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/18.jpg)
Install Phusion Passenger Install Apache module
Sapna Solutions
18
Load and activate in Apache
![Page 19: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/19.jpg)
Customized Phusion Passenger
Sapna Solutions
19
![Page 20: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/20.jpg)
Control Phusion Passenger
Sapna Solutions
20
Restart after deployment:
![Page 21: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/21.jpg)
Phusion Passenger
Sapna Solutions
21
![Page 22: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/22.jpg)
Phusion Passenger
Sapna Solutions
22
![Page 23: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/23.jpg)
Phusion Passenger
Sapna Solutions
23
![Page 24: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/24.jpg)
Apache 2.2
Apache 2.2 introduced mod_proxy_balancer
mod_proxy_balancer can speak to multiple backends and balance requests
Apache can acts as a pure proxy or can also serve static files
Sapna Solutions
24
![Page 25: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/25.jpg)
Reco
mm
ended
Setu
ps
Sapna Solutions
25
![Page 26: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/26.jpg)
Small Site
Sapna Solutions
26
![Page 27: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/27.jpg)
Medium Site
Sapna Solutions
27
![Page 28: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/28.jpg)
Sapna Solutions
28
![Page 29: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/29.jpg)
Sapna Solutions
29Heavy Static Files
![Page 30: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/30.jpg)
Sapna Solutions
30
![Page 31: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/31.jpg)
Sapna Solutions
31Application Server Handler
![Page 32: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/32.jpg)
Sapna Solutions
32RACK
![Page 33: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/33.jpg)
Sapna Solutions
33Rack Handler
![Page 34: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/34.jpg)
Sapna Solutions
34Rack Supports
![Page 35: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/35.jpg)
Sapna Solutions
35What are we using?
Speedy Rails (vps213 and vps214) (Canada)
Apache2
Ruby Enterprise(1.8)
Phusion Passenger
MySql
Build, Staging and Production Environments
Every RAILS APP log maintained
![Page 36: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/36.jpg)
Sapna Solutions
36
Where our applications reside?
cd /var/www/apps/
Login to VPS 214
Sudo su - deploy
![Page 37: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/37.jpg)
Sapna Solutions
37How to debug?
APACHE CONF file (path to app)
Host <domainname>
Checkout ip address serving it
![Page 38: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/38.jpg)
DEPLOYMENT
Sapna Solutions
38
![Page 39: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/39.jpg)
Sapna Solutions
39
![Page 40: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/40.jpg)
We prefer
Sapna Solutions
40
![Page 41: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/41.jpg)
Sapna Solutions
41How to DEPLOY?
EASIEST AND TRUSTED WAY
CAPISTRANO
CUSTOM TASKS
![Page 42: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/42.jpg)
Sapna Solutions
42CAPISTRANO Requirements
![Page 43: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/43.jpg)
Sapna Solutions
43What does Capistrano do?
![Page 44: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/44.jpg)
Sapna Solutions
44Capistrano Deployment Cycle
![Page 45: Web And App Servers](https://reader033.vdocument.in/reader033/viewer/2022061303/54922787ac795934288b46ee/html5/thumbnails/45.jpg)
Sapna Solutions
45