Web And App Servers

1,990 views
1,921 views

Published on

What are application and web servers. What and how to configure application server. Basic fundamental and how it works for me.

Published in: Technology
1 Comment
4 Likes
Statistics
Notes
  • Looking to get up a server for Ruby on Rails with a VPS and CentOS. I hope your tutorial helps. I am missing some information and have not had any luck with setting things up.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
1,990
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
52
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

Web And App Servers

  1. 1. Application/Web Server Sapna Solutions
  2. 2. 1 Simple Rails Setup  One Rails instance handles all requests Rails is single-threaded: There is only one concurrent request Sapna Solutions
  3. 3. 2 Rails Setup Sapna Solutions
  4. 4. 3 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 Sapna Solutions
  5. 5. 4 Deployment Questions Sapna Solutions
  6. 6. 5 Deployment Questions Sapna Solutions
  7. 7. 6 SERVERS Rails Application Server Proxy/Web Server  FastCGI  Apache2  Mongrel  Nginx  mod_rails / Phussion  Lighttpd Passenger  HA-Proxy  JRuby + Glassfish & Co. Sapna Solutions
  8. 8. FastCGI 7  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
  9. 9. FastCGI 8 Sapna Solutions
  10. 10. 9 Sapna Solutions
  11. 11. 10 Mongrel Sapna Solutions
  12. 12. 11 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
  13. 13. 12 Mongrel Sapna Solutions
  14. 14. 13 Mongrel Sapna Solutions
  15. 15. 14 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
  16. 16. 15 Mod_rails a.k.a Phusion Passenger Sapna Solutions
  17. 17. Mod_rails a.k.a Phusion 16 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
  18. 18. 17 Install Phusion Passenger  Install Apache module  Load and activate in Apache Sapna Solutions
  19. 19. 18 Customized Phusion Passenger Sapna Solutions
  20. 20. 19 Control Phusion Passenger Restart after deployment: Sapna Solutions
  21. 21. 20 Phusion Passenger Sapna Solutions
  22. 22. 21 Phusion Passenger Sapna Solutions
  23. 23. 22 Phusion Passenger  Ready for production  Makes setup easier – on the single machine level  Multiple servers still require load balancer  Suitable for mass-hosting  upcoming standard way of deploying Rails Sapna Solutions
  24. 24. 23 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
  25. 25. 24 Setups Recommended Sapna Solutions
  26. 26. 25 Small Site Sapna Solutions
  27. 27. 26 Medium Site Sapna Solutions
  28. 28. 27 Sapna Solutions
  29. 29. Heavy Static Files 28 Sapna Solutions
  30. 30. 29 Sapna Solutions
  31. 31. 30 Application Server Handler Sapna Solutions
  32. 32. 31 RACK Sapna Solutions
  33. 33. 32 Rack Handler Sapna Solutions
  34. 34. 33 Rack Supports Sapna Solutions
  35. 35. 34 What 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 Sapna Solutions
  36. 36. Where our applications reside? 35 Login to VPS 214 Sudo su - deploy cd /var/www/apps/ Sapna Solutions
  37. 37. 36 How to debug? Host <domainname> Checkout ip address serving it APACHE CONF file (path to app) Sapna Solutions
  38. 38. 37 DEPLOYMENT Sapna Solutions
  39. 39. 38 Sapna Solutions
  40. 40. 39 We prefer Sapna Solutions
  41. 41. 40 How to DEPLOY? CAPISTRANO CUSTOM TASKS EASIEST AND TRUSTED WAY Sapna Solutions
  42. 42. 41 CAPISTRANO Requirements Sapna Solutions
  43. 43. 42 What does Capistrano do? Sapna Solutions
  44. 44. 43 Capistrano Deployment Cycle Sapna Solutions
  45. 45. 44 Sapna Solutions

×