it operations for web developers

Download IT Operations for Web Developers

If you can't read please download the document

Upload: mahmoud-said

Post on 17-May-2015

381 views

Category:

Technology


4 download

DESCRIPTION

Some linux background needed for web and rails developers. Internal session for interns and new comers at eSpace

TRANSCRIPT

  • 1. IT Operations for Web Developers Mahmoud Said aka @modsaid

2. Outline Why This Session? The Shell Basics ssh & authenticating Server Anatomy Nginx, passenger Webistrano File transfer Troubleshooting (metrics, logs) Behind Closed Doors 3. Why? Administration (IT Operations) Development Team Common knowledge 4. DevOps DevOps is a software development method that stresses communication, collaboration and integration between software developers and information technology (IT) professionals. Wikipedia 5. The Shell Hides hardware and OS details Text based Command Line interface Sequence of commands are scripts 6. The Shell There is no recycle bin, and no undo.. Read before you hit Enter Realizing a wrong chown -R (http://devopsreactions.tumblr.com/) 7. The basics Everything is a file Files names are case sensitive and do not contain '/' Extensions are just conventions 8. ssh and Authentication Command line based sessions on the server apt-get install openssh-client Authentication via password or key pair .ssh/id_rsa (and .ssh/id_rsa.pub) .ssh/known_hosts Server .ssh/authorized_keys 9. ssh bookmarking .ssh/config Host myserver Hostname myserver.com User myuser Port 3022 Host ldap Hostname 66.85.165.135 User mahmoud 10. Connecting through ssh ssh [email protected] -p3022 ssh myserver 11. Server Anatomy Web Server (nginx, apache) Application Server (Passenger, thin, mod_php, tomcat,..)Other Services Memcache Solr DB Server Processes (background jobs) File system (Static Resources) 12. nginx High-performance HTTP server and reverse proxy /etc/nginx/sites-enabled/kelmetak.com server { listen 80 default; server_name kelmetak.com 2ad.kelemtak.com; root /usr/local/politwoops/current/public; } 13. Passenger Rails (and rack) nginx and apache module (like mod_php for php) server { listen 80; server_name 2ad.kelmetak.com; root /usr/local/politwoops/current/public; passenger_enabled on; } 14. More on nginx Response cache headers Memcache directly Rewrites Constraints Load balancing proxy-pass server { listen 80; server_name app.com; location ~ ^/(assets)/ { gzip_static on; expires max; add_header Cache-Control public; } } 15. webistrano Easy automated deployments Based on capistrano Let's dive together 16. File transfer Scp Rsync wget 17. WTF !! 18. Troubleshooting Troubleshooting Metrics CPU, Memory, I/O Tools top, htop, free -m, ps, iotop, iftop 19. Troubleshooting (2) Logs /var/log/nginx/access.log /var/log/nginx/error.log /usr/local/myproject/current/log/production.log Custom logs 20. Troubleshooting (3) Newrelic is your friend Debugging via rails console Debugging via separate rails server 21. Behind Closed doors 22. Firewall Allow/deny connections based on Source/destination ip Port Protocol Everything should be closed, open only what's needed 23. ssh tunneling A way to access closed ports through your ssh connection ssh myserver -L port:host:hostport ssh myserver -L 3056:localhost:3055 24. Open Discussion 25. Thank You Mahmoud said [email protected] @modsaid