Declare independence from your it department  sysadmin skills for symfony developers
Upcoming SlideShare
Loading in...5
×
 

Declare independence from your it department sysadmin skills for symfony developers

on

  • 5,062 views

A Symfony/web developer is not complete without knowing server administration. When looking for a job, it is quite likely that you will be required to know about systtem administration.

A Symfony/web developer is not complete without knowing server administration. When looking for a job, it is quite likely that you will be required to know about systtem administration.

Statistics

Views

Total Views
5,062
Views on SlideShare
4,917
Embed Views
145

Actions

Likes
4
Downloads
44
Comments
1

5 Embeds 145

http://www.symfony.es 141
http://www.sfexception.com 1
http://symfony.es 1
http://www.php-talks.com 1
http://www.scoop.it 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Hi Pablo.
    I like your slides about this important subject.

    Some of the subjects in your slides are really interesting and I could to know some of the current technologies.

    Greetings from Ecuador
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Declare independence from your it department  sysadmin skills for symfony developers Declare independence from your it department sysadmin skills for symfony developers Presentation Transcript

  • Declare Independence from your IT department Sysadmin skills for Symfony developers June 8, 2012 - Symfony Live Paris Pablo Godel @pgodelFriday, June 8, 2012
  • Agenda - Why SysAdmin Skills - Introduction to LAMP - Hosting options - Linux distributions - Installing PHP options - Deploying PHP - Various production tips - Monitoring - BackupsFriday, June 8, 2012
  • Who Am I? ⁃ Born in Argentina, living in the US since 1999 ⁃ PHP & Symfony developer ⁃ Founder of the original PHP mailing list in spanish ⁃ Master of the parrillaFriday, June 8, 2012
  • Who Am I? ⁃ Born in Argentina, living in the US since 1999 ⁃ PHP & Symfony developer ⁃ Founder of the original PHP mailing list in spanish ⁃ Master of the parrillaFriday, June 8, 2012
  • Friday, June 8, 2012
  • ServerGrove! ⁃ Founded ServerGrove Networks in 2005 ⁃ Provider of web hosting specialized in PHP, Symfony, ZendFramework, and others ⁃ Now with servers in Europe (and USA) ⁃ Mongohosting.com under beta!Friday, June 8, 2012
  • Community is our teacher ⁃ Very active open source supporter through code contributions and usergroups/conference sponsoringFriday, June 8, 2012
  • Who needs them? Sysadmin SkillsFriday, June 8, 2012
  • Text IT is busy / Different PrioritiesFriday, June 8, 2012
  • !Rocket ScienceFriday, June 8, 2012
  • Lack of controlFriday, June 8, 2012
  • Less downtimeFriday, June 8, 2012
  • Better PerformanceFriday, June 8, 2012
  • What do you prefer?Friday, June 8, 2012
  • Or this?Friday, June 8, 2012
  • I     s. I ’   s  L. E     Cs ,        . An example...Friday, June 8, 2012
  • What is LAMPFriday, June 8, 2012
  • Friday, June 8, 2012
  • Friday, June 8, 2012
  • Friday, June 8, 2012 LAMP
  • Friday, June 8, 2012 LAMP
  • Friday, June 8, 2012 LAMP
  • Scott BealeFriday, June 8, 2012 LAMP
  • Friday, June 8, 2012 LNMP
  • Friday, June 8, 2012 LAMP
  • Friday, June 8, 2012 LAPP
  • Friday, June 8, 2012 LANMMPP
  • Why? LANMMPPFriday, June 8, 2012
  • Why LANMMPP ProvenFriday, June 8, 2012
  • Why LANMMPP StableFriday, June 8, 2012
  • Why LANMMPP SecureFriday, June 8, 2012
  • Why LANMMPP FreeFriday, June 8, 2012
  • Why LANMMPP Free*Friday, June 8, 2012
  • Why LANMMPP InexpensiveFriday, June 8, 2012
  • Why LANMMPP Easily AvailableFriday, June 8, 2012
  • Hosting OptionsFriday, June 8, 2012
  • Hosting Options Shared Hosting + - - Inexpensive - Shared resources - Widely available - No/Limited Shell - Easy to use - Many restrictions - No maintenance - No control - No updates - Fixed versions - Instant provisioning - Multitude of CPs - DNS/Email servicesFriday, June 8, 2012
  • Hosting Options Dedicated Servers + - - Full control - Hard to plan - No sharing - Software updates - Best performance - SysAdmin skills - Software / Hardware - Expensive to start to specs - Parts replacements - Control Panel licensesFriday, June 8, 2012
  • Hosting Options Virtual Servers / VPS - - Shared resources - Software updates - SysAdmin skills - Limited/No CP - Lack of emailFriday, June 8, 2012
  • Hosting Options Virtual Servers / VPS + + - Inexpensive - Custom configurations - Widely available - Snapshots - Choice of OS - Multiple Envs - Root access - Full shell - Fast provisioning - Custom softwareFriday, June 8, 2012
  • Hosting Options Cloud Hosting + - Depends on implementationFriday, June 8, 2012
  • Hosting Options Cloud Hosting Some are a shared hosting with a fancy new nameFriday, June 8, 2012
  • Hosting Options Cloud Hosting Some are a shared hosting with a fancy new name Others let you start small and scale easilyFriday, June 8, 2012
  • Hosting Options Cloud Hosting Some are a shared hosting with a fancy new name Others let you start small and scale easily Gets really expensive at scaleFriday, June 8, 2012
  • Hosting Options Cloud Hosting Most suffer from some of the shared hosting problems: - vendor lock-in - lack of control - high learning curve - limited environmentFriday, June 8, 2012
  • Hosting Options Which one to choose?Friday, June 8, 2012
  • Hosting Options Which one to choose? IT DEPENDSFriday, June 8, 2012
  • Linux DistributionsFriday, June 8, 2012
  • Distributions RedHat based - Fedora - RedHat Enterprise Linux (RHEL) - CentOS - Scientific LinuxFriday, June 8, 2012
  • Distributions Debian based - Debian - UbuntuFriday, June 8, 2012
  • Distributions Others - Gentoo - Slackware - OpenSuse - Archlinux - any many many more! http://distrowatch.com/ http://en.wikipedia.org/wiki/Linux_distributionFriday, June 8, 2012
  • Distributions Key differences - Configuration files - Package Manager - Managing Services - Software versions - UpdatesFriday, June 8, 2012
  • Distributions Key differences - Configuration files CentOS /etc/sysconfig/network-scripts/ifcfg-eth0 Ubuntu /etc/network/interfacesFriday, June 8, 2012
  • Distributions Key differences - Package Manager CentOS yum install php-cli Ubuntu apt-get install php5Friday, June 8, 2012
  • Distributions Key differences - Package Manager CentOS yum search php-cli Ubuntu apt-cache search phpFriday, June 8, 2012
  • Distributions Key differences - Managing Services CentOS service restart httpd chkconfig --list httpd chkconfig httpd on Ubuntu service restart apache2 sudo update-rc.d apache2 enableFriday, June 8, 2012
  • Distributions Key differences - Software versions CentOS httpd-2.2.3 Ubuntu apache-2.2.17Friday, June 8, 2012
  • Distributions Key differences - Updates CentOS 5.x PHP 5.1.6 Ubuntu 11 PHP 5.3.5Friday, June 8, 2012
  • Distributions Key similarities - Based on Linux Kernel - Screwed up or ancient PHP - Lack of PHP extensionsFriday, June 8, 2012
  • Distributions Which one to choose? IT DEPENDSFriday, June 8, 2012
  • Distributions Which one to choose? - Best feeling - Previous experience - Workplace selection - Coworker / friend knowledgeFriday, June 8, 2012
  • Distributions Test Drive Virtual Machines: - VirtualBox - Parallels - VMware - VPSFriday, June 8, 2012
  • Installing PHPFriday, June 8, 2012
  • Installing PHP CentOS yum install php php-cli yum install php-libxmlFriday, June 8, 2012
  • Installing PHP CentOS Third Party Repositories - Remi RPM http://blog.famillecollet.com/ - Webtatic http://www.webtatic.com/ - ServerGrove: PHP 5.3.13 / 5.4.3 (always latest) http://repos.servergrove.comFriday, June 8, 2012
  • Installing PHP CentOS Third Party Repositories cd /etc/yum.repos.d/ wget http://repos.servergrove.com/servergrove-centos-5/ servergrove-centos-5.repo yum install php53 # or php54Friday, June 8, 2012
  • Installing PHP Ubuntu apt-get install php5 libapache2-mod-php5 apt-get install php5-libxmlFriday, June 8, 2012
  • Installing PHP Ubuntu Third Party Repositories PHP 5.3.13 / 5.4.3 - Dotdeb: http://www.dotdeb.org/ - ServerGrove: (always latest) http://repos.servergrove.comFriday, June 8, 2012
  • Installing PHP Ubuntu Third Party Repositories echo “deb http://repos.servergrove.com/servergrove-ubuntu- natty natty main” >> /etc/apt/sources.list.d/servergrove.list apt-get install php53 # or php54Friday, June 8, 2012
  • Installing PHP From Source wget http://us2.php.net/get/php-5.4.3.tar.bz2/from/ www.php.net/mirror tar jxvf php-5.4.3.tar.bz2 cd php-5.4.3 ./configure make && make installFriday, June 8, 2012
  • Installing PHP Recompiling php -i |grep configure ./configure --with-apxs2=/usr/sbin/apxs --prefix=/usr/local/ php53 --with-config-file-scan-dir=/etc/php53/conf.d -- enable-bcmath --enable-ctype --enable-exif --enable- mbstring --enable-ftp --enable-intl --enable-sockets -- enable-sysvmsg --enable-pcntl --with-bz2 --with-curl -- with-gettext --with-gd --enable-gd-native-ttf --enable-exif -- with-freetype-dir=/usr --with-jpeg-dir=/usr --with-t1lib=/usr --with-mcrypt --with-openssl --with-kerberos --with-iconv --with-xsl --with-xmlrpc --with-zlib --with-mysql=mysqlnd -- with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd make && make installFriday, June 8, 2012
  • Installing PHP Compiling for Apache ./configure --with-apxs2=/usr/sbin/apxs make && make installFriday, June 8, 2012
  • Installing PHPCompiling for Nginx / PHP-FPM ./configure --enable-fpm make && make installFriday, June 8, 2012
  • Installing PHP Compiling extension ./configure --with-curl --enable-ftp make && make installFriday, June 8, 2012
  • Installing PHP Compiling extension (dynamic) cd ext/curl phpize ./configure make && make install echo “extension=curl.so” >> php.iniFriday, June 8, 2012
  • Installing PHP Compiling extension http://pecl.php.net/Friday, June 8, 2012
  • Installing PHP Compiling extension (PECL) pecl install apc # or pecl download apc tar zxvf APC-3.1.9.tgz cd APC-3.19 phpize ./configure make && make install echo “extension=apc.so” >> php.iniFriday, June 8, 2012
  • Installing PHP Automate! - Chef - Puppet - ...Friday, June 8, 2012
  • Installing PHP Configuration Default location /usr/local/lib/php.ini Other common locations /etc/php/php.ini /etc/php5/cli/php.ini /etc/php5/apache2/php.iniFriday, June 8, 2012
  • Installing PHP Configuration php -i | grep php.ini Configuration File (php.ini) Path => /usr/local/php5/lib Loaded Configuration File => /usr/local/php5-20110426-093151/ lib/php.ini Scan this dir for additional .ini files => /usr/local/php5/php.d Additional .ini files parsed => /usr/local/php5/php.d/10- extension_dir.ini,Friday, June 8, 2012
  • Installing PHP Configuration php -i | grep mongo /usr/local/php5/php.d/50-extension-mongo.ini, mongo mongo.allow_empty_keys => 0 => 0 mongo.allow_persistent => 1 => 1 mongo.auto_reconnect => 1 => 1 mongo.chunk_size => 262144 => 262144 mongo.cmd => $ => $ mongo.default_host => localhost => localhost mongo.default_port => 27017 => 27017Friday, June 8, 2012
  • Installing PHP Configuration php -m [PHP Modules] apc bcmath bz2 Core ctype curl date dom eregFriday, June 8, 2012
  • Installing PHP Configuration php.ini extension_dir=/usr/lib/php/extensions/no- debug-non-zts-20090626 extension=apc.so extension=mongo.soFriday, June 8, 2012
  • Installing PHP Configuration php.ini php -i | grep extension_dir extension_dir => /usr/local/php5/lib/php/extensions/no-debug- non-zts-20090626Friday, June 8, 2012
  • Installing PHP Configuration php.ini date.timezone=UTC display_errors = off log_errors = on error_log = /var/log/php.logFriday, June 8, 2012
  • Installing PHP Configuration Security memory_limit = 128M max_execution_time = 30 display_errors = off expose_php = off mail.log = /var/log/phpmails.log disable_functions = exec allow_url_fopen = offFriday, June 8, 2012
  • Installing PHP Configuration File uploads on .htaccess php_value memory_limit 128M php_value max_file_uploads 20 php_value max_input_time -1 php_value post_max_size 8M php_value upload_max_filesize 2M php_value max_execution_time 0 AllowOverride=All in Apache!Friday, June 8, 2012
  • Installing PHP Configuration Apache php_value date.timezone UTC php_flag display_errors 1 php_value memory_limit 128M php_value max_execution_time 0 Donʼt forget to restart ApacheFriday, June 8, 2012
  • Installing PHP Web Server User Permissions issues with clear cache and uploads, Anyone? Possible users - apache - nobody - www-data - ftp / ssh user (sometimes)Friday, June 8, 2012
  • Installing PHP Web Server User Permissions issues with clear cache and uploads, Anyone? Fix: rm -rf app/cache/* rm -rf app/logs/* sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs http://symfony.com/doc/current/book/installation.htmlFriday, June 8, 2012
  • Deploying PHPFriday, June 8, 2012
  • Deploying PHP Before going live Make sure ntpd is installed and running to ensure accurate server time yum install ntp chkconfig ntpd on ntpdate pool.ntp.orgFriday, June 8, 2012
  • Deploying PHP Before going live - Limit access by IP <Location /admin> Order Deny,Allow Deny from all Allow from 1.2.3.4 </Location>Friday, June 8, 2012
  • Deploying PHP Before going live - Add HTTP Authentication <Location /admin> Require valid-user AuthType Basic AuthName "SG" AuthUserFile /path/users </Location>Friday, June 8, 2012
  • Deploying PHP Before going live - Quiet down Apache ServerTokens ProdFriday, June 8, 2012
  • Deploying PHP Before going live Move document root with .htaccess RewriteEngine On RewriteRule ^.htaccess$ - [F] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^.*$ - [NC,L] RewriteCond %{REQUEST_URI} !^/web/.*$ RewriteRule ^(.*)$ /web/$1Friday, June 8, 2012
  • Deploying PHP Before going live - Case senstive filesystem IPCheck_Form_Index_Login != IpCheck_Form_Index_Login /path/to/file/IpCheck_Form_Index_Login.php <?php class IPCheck_Form_Index_Login { ...Friday, June 8, 2012
  • Deploying PHP - server-side vi - plain old FTP - SFTP - scp - rsync + ssh - git - tar / gzip - rpm / deb packages - capistrano / capifonyFriday, June 8, 2012
  • Deploying PHP - server-side vi - plain old FTP - SFTP - scp - rsync + ssh - git - tar / gzip - rpm / deb packages - capistrano / capifonyFriday, June 8, 2012
  • Deploying PHP Effing Package Management Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity. fpm -s dir -t rpm -n "sfapp" -v 1.0 /var/www/sfapp fpm -s dir -t deb -a all -n sfapp -v 1.0 /etc/apache2/ conf.d/my.conf /var/www/sfapp https://github.com/jordansissel/fpmFriday, June 8, 2012
  • Deploying PHP Capifony - multiple servers - multiple environments - setup shared folders (vendors, cache, logs, etc) - copy files - update vendors - multi versions - rollback - restart apacheFriday, June 8, 2012
  • Deploying PHP Automate!Friday, June 8, 2012
  • DNS Tips The Power of the hosts fileFriday, June 8, 2012
  • DNS Tips The Power of the hosts file /etc/hosts 10.0.1.1 www.lottery.comFriday, June 8, 2012
  • DNS Tips The Power of the hosts file /etc/hosts 10.0.1.1 example1.com example2.comFriday, June 8, 2012
  • DNS Tips Virtual Document Root UseCanonicalName Off VirtualDocumentRoot /var/www/vhosts/%0/web <Location /var/www/vhosts> AllowOverride All Options +FollowSymLinks </Location> example.com => /var/www/vhosts/example.com/web example2.com => /var/www/vhosts/example2.com/webFriday, June 8, 2012
  • DNS Tips Nameservers/Expiration whois servergrove.com ... Name Servers: ns1.servergrove.com ns2.servergrove.com ns3.servergrove.com Creation date: 19 May 2005 23:34:36 Expiration date: 19 May 2014 23:34:00Friday, June 8, 2012
  • DNS Tips DNS records dig -t A google.com ;; ANSWER SECTION: google.com. 184 IN A 74.125.230.227 google.com. 184 IN A 74.125.230.228 google.com. 184 IN A 74.125.230.229 google.com. 184 IN A 74.125.230.230 google.com. 184 IN A 74.125.230.231 google.com. 184 IN A 74.125.230.232 google.com. 184 IN A 74.125.230.233 google.com. 184 IN A 74.125.230.238 google.com. 184 IN A 74.125.230.224 google.com. 184 IN A 74.125.230.225 google.com. 184 IN A 74.125.230.226Friday, June 8, 2012
  • DNS Tips DNS records dig -t A servergrove.eu @ns1.servergrove.com ;; ANSWER SECTION: servergrove.eu. 3600 IN A 149.5.47.100Friday, June 8, 2012
  • DNS Tips traceroute traceroute google.com traceroute to google.com (173.194.37.33), 30 hops max, 40 byte packets 1 2.69-195-222.static.servergrove.com (69.195.222.2) 0.360 ms 0.365 ms 0.432 ms 2 t0-1-0-5.br2.mia.terremark.net (66.165.161.45) 1.558 ms 1.546 ms 1.532 ms 3 core1-1-0-0.mia.net.google.com (198.32.124.133) 0.238 ms 0.224 ms 0.230 ms 4 209.85.253.74 (209.85.253.74) 0.266 ms 0.283 ms 0.312 ms 5 209.85.254.252 (209.85.254.252) 12.764 ms 12.757 ms 12.749 ms 6 64.233.175.92 (64.233.175.92) 14.177 ms 14.257 ms 14.359 ms 7 atl14s07-in-f1.1e100.net (173.194.37.33) 13.653 ms 13.606 ms 13.618 msFriday, June 8, 2012
  • DNS Tips http://whereisitup.comFriday, June 8, 2012
  • DNS Tips mtrFriday, June 8, 2012
  • MonitoringFriday, June 8, 2012
  • Monitoring Apache Requests <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from .your_domain.com </Location> ExtendedStatus OnFriday, June 8, 2012
  • Monitoring Apache RequestsFriday, June 8, 2012
  • Monitoring - Cacti - Ganglia - Zabbix - collectd - statsd / StatsDBundle - graphiteFriday, June 8, 2012
  • Monitoring statsd / StatsDBundle / GraphiteFriday, June 8, 2012
  • Monitoring CPU / Memory / IO topFriday, June 8, 2012
  • Monitoring IO iotopFriday, June 8, 2012
  • Monitoring Network iptrafFriday, June 8, 2012
  • Monitoring Handling logs - Centralize logs with syslog error_log = syslog - Monolog supports syslog - logstash, logster, loggly, logioFriday, June 8, 2012
  • Speeding upFriday, June 8, 2012
  • Speeding up - nginx/php-fpm - APC - Memcache - nginx reverse proxy cache - VarnishFriday, June 8, 2012
  • BackupsFriday, June 8, 2012
  • Backups - rsync - rdiff-backup - Unison - Bacula - AmandaFriday, June 8, 2012
  • Backups Donʼt forget to backup your DB!Friday, June 8, 2012
  • Reading List - Automating UNIX and Linux Administration - Running Linux - Learning the bash Shell: Unix Shell ProgrammingFriday, June 8, 2012
  • The End Questions? Sysadmin skills for Symfony developersFriday, June 8, 2012
  • Feedback Please! https://joind.in/6605 Sysadmin skills for Symfony developers Pablo Godel @pgodel Thank you!Friday, June 8, 2012