Month: January 2010

  • Tips for beginners with Puppet (server automation)

    Since Puppet is written in Ruby, some of its syntax are Ruby-specific (I would not know for sure since I have not learned about Ruby yet). I’ll try to update this post so beginners to Puppet and strangers to Ruby can get pass the unwanted headache. Case-sensitivity Case-changing is one of the source of confusions.…

  • DIsplay return code of a shell command

    If you need to determine the return code for shell scripting, you can use “$?” # ifconfig | grep eth0 >/dev/null 2>&1 # echo $? 0 => good/found # ifconfig | grep eth1111 >/dev/null 2>&1 # echo $? 1 => bad/not found

  • Bandwidth cost for EC2/cloud computing

    Cloud computing often advertises on the per hour instance cost (like 10 cents per hour). Cheap right? Not necessarily. There are many additional charges (bandwidth, IO, etc. etc.) that can become much much more expensive than the cost of running the instance. Any wise company that want to invest their time in any cloud must…

  • haproxy and stunnel

    This quick reference to install haproxy, stunnel to support SSL forwarding (with IP forwarding patch) wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.22.tar.gz tar -zxf haproxy-1.3.22.tar.gz cd haproxy-1.3.22 make TARGET=linux26 cp haproxy /usr/sbin/haproxy vi /etc/haproxy.cfg … vi /etc/init.d/haproxy … chmod +x /etc/init.d/haproxy useradd haproxy mkdir -p /var/chroot/haproxy chown haproxy:haproxy /var/chroot/haproxy chmod 700 /var/chroot/haproxy service haproxy start chkconfig –add haproxy vi /etc/sysconfig/syslog…

  • Install APC automatically via script

    If you try to install APC via scripting, you might experience the interactive prompt asking about “apxs”. How to by pass that? Use expect (“yum install expect”). This script will solve your problem: #!/usr/bin/expect spawn pecl install apc expect “Use apxs to set compile flag” send “yes\r” expect “install ok” expect eof

  • Auto Scaling

    The idea is really cool and cost efficient. However, actual implementation is not easy as it should be. There are vendors trying to bridge the gap and I believe it will be much easier in the future. Problem at 2AM For many services, usage fluctuates during any day (and also week). For example, we see…