• Facepunch server setup
    49 replies, posted
[QUOTE=andersonmat;25451111]:hurr: More like nginx is baller and apache likes big dicks in its asshole along with IIS. It's one huge gay fest with apache and IIS. Although, I admit that IIS is good, just not with PHP.[/QUOTE] IIS is good for larger sites, NginX is good for smaller sites. Apache is a good middle ground that can handle either one just as well.
nginx scales perfectly well to larger sites
[QUOTE=compwhizii;25451773]No. I've used linode before, they're great but not for scalability. Keep in mind we're using 6 instances. [/QUOTE] What's wrong with Linode for scalability? The project I'm working on is balanced over 7 Linode 2048s, and runs beautifully.
[QUOTE=Turki Azamat;25458087]What's wrong with Linode for scalability? The project I'm working on is balanced over 7 Linode 2048s, and runs beautifully.[/QUOTE] anything would run beautifully over 7 powerful boxes. [editline]17th October 2010[/editline] [QUOTE=ButtsexV3;25456468]IIS is good for larger sites,[/QUOTE] Pretty much this. Leave an IIS site alone for a while and the worker process will be shut down, which means the next request takes about 20 seconds while the worker process spins back up.
[QUOTE=comeng;25458222]anything would run beautifully over 7 powerful boxes.[/QUOTE] Google would take a tad more than 7 boxes to run beautifully.
[code]rm /etc/init.d/apache2 rm /etc/init.d/zend-server /usr/sbin/update-rc.d -f apache2 remove /usr/sbin/update-rc.d -f zend-server remove [/code] Disable Zend Server from starting up [code]cd /etc/apache2/sites-available/ rm default* cd ../sites-enabled rm 000-d*[/code] Remove default sites from apache Comment out everything in [i]/etc/apache2/ports.conf[/i]. Verify that the Zend Panel still works.
[QUOTE=thelinx;25457601]nginx scales perfectly well to larger sites[/QUOTE] NginX scales really well but it really shines on smaller sites.
PHP-FPM is still vastly better than spawn-fcgi
[b]Memcached[/b] [url]http://scottbarr.blogspot.com/2009/12/install-memcached-from-source-on-debian.html[/url] [code]apt-get install sysv-rc-conf cd /usr/local/src/ wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz tar xzf libevent-1.4.13-stable.tar.gz cd libevent-1.4.13-stable mkdir /opt/libevent-1.4.13-stable ./configure --prefix=/opt/libevent-1.4.13-stable make make install ln -s /opt/libevent-1.4.13-stable/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2p[/code] Setup libevent [code]cd /usr/local/src wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz tar xzf memcached-1.4.5.tar.gz cd memcached-1.4.5 ./configure --prefix=/opt/memcached-1.4.5 --with-libevent=/opt/libevent-1.4.13-stable make make install[/code] Build memcached [code]cd ~ wget http://gist.github.com/raw/255825/ecffba4bf23d080d3f472595f62ec9d6e2897769/start-memcached mkdir -p /usr/share/memcached/scripts mv start-memcached /usr/share/memcached/scripts/ chmod o+x /usr/share/memcached/scripts/start-memcached wget http://gist.github.com/raw/255826/54b1694d296c81d71ee89f6358aafd560870563b/memcached mv memcached /etc/init.d/memcached chmod o+x /etc/init.d/memcached wget http://gist.github.com/raw/255828/53e1924d6845d6a90b86a4c5cf3ac81ef9c56af6/memcached.conf mv memcached.conf /etc/memcached.conf /etc/init.d/memcached start sysv-rc-conf --level 2345 memcached on[/code] Install his config files. Fix the paths in the init script and the startup script. [editline]17th October 2010[/editline] [QUOTE=Darkimmortal;25467647]PHP-FPM is still vastly better than spawn-fcgi[/QUOTE] Got a guide for how to do it now that it's built into PHP? [editline]17th October 2010[/editline] My magic configuration updating scripts: [code]#!/bin/bash cd ~/config STATUS=`svn status -u` if [[ "$STATUS" =~ \* ]]; then echo "Configuration changed" else echo "Configuration up to date" exit 0 fi svn up chmod +x update_config.sh ./update_config.sh[/code] This runs on a cron, when there's a new SVN rev it pulls it and runs the updater script [code]#!/bin/bash PHP_REBOOT=0 NGINX_REBOOT=0 MEM_REBOOT=0 cd ~/config function rebootset { if [ "$1" = "php" ]; then PHP_REBOOT=1 elif [ "$1" = "nginx" ]; then NGINX_REBOOT=1 elif [ "$1" = "memcached" ]; then MEM_REBOOT=1 fi } function checkfile { cmp -s $1 $2 if [ $? -ne 0 ]; then echo "Updating $2" cp $1 $2 rebootset $3 if [ "$4" = "chmod" ]; then chmod +x $2 fi else echo "$2 is up to date" fi } function checkdir { mkdir tmp mv $1/.svn tmp/ diff $1 $2 &> /dev/null if [ $? -ne 0 ]; then echo "Updating $2" rm -rf $2 mv $1 $2 rebootset $3 else echo "$2 is up to date" fi mv tmp/.svn $1 rm -rf tmp } ## General stuff checkfile check_config.sh ../check_config.sh "-" "chmod" checkfile crontab /etc/crontab ## PHP checkfile php/php.ini /usr/local/zend/etc/php.ini "php" checkfile init.d/init-fastcgi /etc/init.d/init-fastcgi "php" "chmod" checkdir php/ext.d /usr/local/zend/etc/ext.d "php" ## NGINX checkfile init.d/nginx /etc/init.d/nginx "nginx" "chmod" checkdir nginx /etc/nginx "nginx" ## memcached checkfile init.d/memcached /etc/init.d/memcached "memcached" "chmod" checkfile memcached/start-memcached /usr/share/memcached/scripts/start-memcached "memcached" checkfile memcached/memcached.conf /etc/memcached.conf "memcached" if [ $NGINX_REBOOT -eq 1 ] then echo "Rebooting nginx..." /etc/init.d/nginx restart fi if [ $PHP_REBOOT -eq 1 ] then echo "Rebooting PHP..." /etc/init.d/init-fastcgi stop sleep 5 /etc/init.d/init-fastcgi start fi if [ $MEM_REBOOT -eq 1 ]; then echo "Rebooting memcached..." /etc/init.d/memcached restart fi[/code] So for a commit that reduces the memory for memcached... [code]ip-10-122-218-156:~# ./check_config.sh Configuration changed U memcached/memcached.conf Updated to revision 105. ../check_config.sh is up to date /etc/crontab is up to date /usr/local/zend/etc/php.ini is up to date /etc/init.d/init-fastcgi is up to date /usr/local/zend/etc/ext.d is up to date /etc/init.d/nginx is up to date /etc/nginx is up to date /etc/init.d/memcached is up to date /usr/share/memcached/scripts/start-memcached is up to date Updating /etc/memcached.conf Rebooting memcached... Restarting memcached: memcached. [/code] Awesome. [editline]17th October 2010[/editline] Add the php command line to the php executable [code]ln -s /usr/local/zend/bin/php /usr/bin/php[/code]
[b]Monit[/b] [code]apt-get install flex bison wget http://mmonit.com/monit/dist/monit-5.2.1.tar.gz tar xvf monit-5.2.1.tar.gz cd monit-5.2.1 ./configure make make install[/code]
I was going to use Monit once, but I figured out how to do the same thing with /etc/inittab.
Detach the volume [img]http://grab.by/grabs/cc247b4147caac2252b9525a57d10be1.png[/img] Make a snapshot [img]http://grab.by/grabs/896149cca1193e04bb7b7f54c45362ac.png[/img] [img]http://grab.by/grabs/d6d7d6c3e588d351169469781d537670.png[/img] [editline]24th October 2010[/editline] Wait for it to build [img]http://grab.by/grabs/9704047455d80eb052535c1939982c4c.png[/img] [editline]24th October 2010[/editline] Register an AMI via the command line [code]./ec2-register -n FpWeb2Test -s snap-XXXXXXXX[/code] [editline]24th October 2010[/editline] Launch an instance using the AMI [img]http://grab.by/grabs/7c65b7ce25b5d1abc4f71ce40375c66a.png[/img] [editline]24th October 2010[/editline] Micro instances perform like shit. Let's try a small [editline]24th October 2010[/editline] [b]Add the init-fastcgi init.d script to start on bootup[/b] [editline]24th October 2010[/editline] Munin works (Tested via telenet) [b]Get rid of the crap in the home folder that I left behind. Clear out all the revisions and reset the counter[/b]
I don't get any of this server hosting stuff but it looks promising, somehow :v:
You're doing a good job Compwhizii
I think it's very nice of you to put a warning on top of the site.
[code]chroot /mnt/build umount -t proc none /proc chroot /mnt/build umount -t devpts none /dev/pts umount /mnt/build[/code] Unmount the EBS
I wish I understood more of what was going on here... How do the instances work? Is each one basically just a copy of the same PHP running on a different machine?
As of last night avatars are being hosted by a server running Varnish. [QUOTE=adamjon858;25808333]I wish I understood more of what was going on here... How do the instances work? Is each one basically just a copy of the same PHP running on a different machine?[/QUOTE] pretty much
[QUOTE=compwhizii;25878643]As of last night avatars are being hosted by a server running Varnish. pretty much[/QUOTE] Could you prehaps share some serverload stats? Hits + DB Queries + Bandwidth usage per month. I think that'd be quite interesting.
[QUOTE=eXeC64;25880941]Could you prehaps share some serverload stats? Hits + DB Queries + Bandwidth usage per month. I think that'd be quite interesting.[/QUOTE] He shared them on twitter once, but it's passworded now.
Sorry, you need to Log In to post a reply to this thread.