Zend Framework provides cloud support

In a recent release announcement (for ZF 1.11.0 beta 1) I noticed that they now have Zend_Cloud which is, based on their description:

Zend Framework 1.11.0 markes the first official, stable release of Zend_Cloud, Zend Framework’s PHP version of the SimpleCloud API.

It offers support for some of the Amazon and Windows cloud solutions like S3/SQS and BLOB(spelled wrong Windows Azure’s blog storage)/Queue Service. While I didn’t work with Microsoft’s Azure, the S3 from Amazon is commonly used for all kinds of file storage. I believe it is great to be able to save files on S3, never having to fear about hard disk limitations and to some degree about their safety. While for small applications it might not be an obvious better solution, for applications that deal with a lot of files(like image storage for example) it is a big plus.

Although at the moment only S3 is interesting for me they stated they will be adding new features in the near future. Can’t wait that!

Switching to WordPress

I have decided to move from Blogger(Google service) to WordPress engine today. While Blogger is a very good blogging platform I got bored with the limited selection of themes they have available. Plus I have been working a lot with WordPress lately so it’s normal to start using it for my blog 🙂

You may notice that some of the posts got trashed, since I didn’t consider them of any value. The old blog with all the posts is still available at http://getasysadmin.blogspot.com if you are interested.

vWorker(RentACoder) is using cloud infrastructure

Astonishing! Who would have thought they are so advanced in this domain?

Stop reading here if you don’t want to read a rant!

Although this is hardly news there are bits that still puzzle me. For example why did the choose the VMWare and not the Microsoft solution? They are Microsoft fans since forever, even using IIS as web server. I remember the `good old days’ when they were struggling with a very performant MSSql server that wasn’t able to use 8 cores(or it was 8GB RAM? who cares) and they had to upgrade to Gold Membership to patch it.

Another thing I have noticed is that they are using blogger as platform for their blog. But but … Microsoft is going to use WordPress as I found out in this article.

Is the marriage between Ian and Microsoft going through a hard time? Who knows …

On an ending note I find the site interface one of the worst and is it just me or the whole site moves very slow?
P.S.Don’t close my vWorker account!!!

mEgo is sky high

Yes ladies and gents, it is true! mEgo Inc, my former company where I have worked for the last 2 years as sysadmin, made the move to Amazon Elastic Compute Cloud (aka EC2) today!!!11oneone It’s a moment of great joy to see this thing happening now at the beginning of 2010.

Best wishes to the mEgo team!

LE: Proof

PING mego.com (67.202.39.53) 56(84) bytes of data.
64 bytes from ec2-67-202-39-53.compute-1.amazonaws.com (67.202.39.53): icmp_seq=1 ttl=48 time=10.6 ms

ISPConfig3 running on Ubuntu 9.10 on AWS

This is an idea on how to set ISPConfig 3 on Amazon EC2 for web hosting. It’s still work in progress and I await for any constructive feedback. Since English is not my first language there might be some grammatical errors.

Prerequisites:

  • AWS Account
  • Some Linux experience

Part I – Setting up AWS

I have done all the setup of instance and ebs from the Amazon Management Console. It has a very intuitive interface and it’s so easy to work with.

Optional: You can purchase reservation for an instance if you are planing to run it 24/7. To do so go to Instances -> Reserved Instances and click on Purchase Reserved Instance. For example a c1.medium instance reservation for 1 year costs 455$ one time fee and the hourly cost of the instance goes to 0.06$/hour. It’s your decision, do the math if it’s worth it or not to go with reserved instances.

  1. From the Management Console go to Volumes and Create Volume. I created a 40 GB volume in us-east-1a zone, choose an appropriate value for your needs.
  2. Next step which is also optional is to get an Elastic IP for your instance. Go to Elastic IPs and click Allocate New Address.
  3. You will need a keypair to access your instance. You can create one before launching the instance or create one when you also setup the new instance. Your choice. I created one before by going to Key Pairs -> Create Key Pair.

Part II – Launching the instance

Instance type used was c1.medium, the AMI for it was Ubuntu 9.10 Karmic 32bit ami-1515f67c from Canonical Images for Amazon EC2.

Go to Instances and press Launch Instance and make sure you set it to use ami-1515f67c. If you need to use a different zone or a 64 bit instance you can check the alestic page which is a wonderful resource for Ubuntu images for EC2. I would also suggest to join their EC2 Ubuntu Google Grup if you are serious about AWS + Ubuntu.

After the instance is up and running attach the Elastic IP and the Volume you have created to it. To attach the IP go to Elastic IPs and select Associate, for the EBS go to Volumes. I attached the EBS as /dev/sdb to the instance.

Later Edit: You will need to also modify the Security Groups and permit access on ports 22(SSH), 80(HTTP), 8080(ISPConfig 3), 20-21(FTP) -> still need more work to support PASV.

Part III – Install ISPConfig 3

Before proceeding with ISPConfig 3 setup connect to your instance and update the packages.

sudo su
apt-get update
apt-get upgrade

Note: You will have to connect to your instance using the ubuntu username and the key pair you generated for that instance. It won’t allow you to connect directly as root.

To install the ISPConfig 3 I followed the HowtoForge excellent tutorial with a small exception: I skipped the part of setting up the quota since I was planning to use the EBS as storage for sites and MySQL databases. The rest of the tutorial was just perfect.

Part IV – Setting up the EBS and ISPConfig to work with it

Most of the stuff and talk about EBS and MySQL snapshots is discussed on Amazon developer forums in the thread called Tutorial: Running MySQL on Amazon EC2 with EBS (Elastic Block Store). Make sure you read the discussion before or after you are done with this post.

apt-get install dmsetup
modprobe dm_mod
modprobe dm_mirror
modprobe dm_snapshot
mkdir /dev/.static/dev/mapper -pv

Create ext3 filesystem:

mkfs.ext3 /dev/sdb

Setup it with dmsetup

echo 0 `blockdev --getsize /dev/sdb` linear /dev/sdb 0 | dmsetup create ebs

Add the records to fstab

echo "/dev/mapper/ebs /ebs ext3 noatime,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0 0" >> /etc/fstab

Setup quota

touch /ebs/aquota.user /ebs/aquota.group
chmod 600 /ebs/aquota.*
mount -o remount /ebs

Enable quota on ebs

quotacheck -avugm -F vfsv0 /ebs
quotaon -avug /ebs

For websites:

mkdir /ebs/sites
ln -s /ebs/sites /var/www/clients

Jailkit:

Set Jailkit chroot home: /ebs/home/[username]

mkdir /ebs/home

MySQL:

/etc/init.d/mysql stop
mkdir /ebs/mysql/data /ebs/mysql/log -pv
mv /var/lib/mysql /ebs/mysql/data
ln -s /ebs/mysql/data/mysql /var/lib/mysql
mv /var/log/mysql /ebs/mysql/log
ln -s /ebs/mysql/log/mysql /var/log/mysql

To make a snapshot of the database, go to the mysql console (msqyl -p)

FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
SYSTEM dmsetup suspend /dev/mapper/ebs

Take your snapshot of the EBS

SYSTEM dmsetup resume /dev/mapper/ebs
UNLOCK TABLES;

Note:This is still work in progress, any advices on how to improve it are greatly appreciated and any constructive criticism also.

WordPress Reflection Theme plus YAPB and Watermark Plugin

One of my clients required a photo blog created in no time so I decided to go with WordPress and YAPB plugin.

I will not tell you how to install WordPress (2.8.6 atm) since it’s pretty straight forward and there are many sites that provide such info.

Adding themes and plugins to WordPress is pretty easy, just unpack the themes in wp-content/themes and plugins in wp-content/plugins. No big deal.

After installing both YAPB and Reflection theme go to your Admin Dashboard at Appearance / Themes and activate Reflection. Also make sure you visit Plugins and you activate Yet Another PhotoBlog.

There is not much to customize after you are done installing and activating the theme and plugin. Just go to Settings / YAPB and uncheck everything at Automatic Image Insertion or you will get some weird results(double picture showing in Reflection photo blog).

Of course the client also wanted watermark on all his precious photos. So I found this plugin called Marekki’s Watermark. Just download it and unpack in the plugins directory of the blog. As usual go to Admin Dashboard and activate it from Plugins. You have a few settings for it, no doubt you can figure on your own what they do.

Because of the YAPB plugin of course the installation instructions for watermark plugin didn’t work. Instead of changing the file they recommend just go to wp-content/plugins/yet-another-photoblog/lib and edit the file “Yapb.class.php”. Look for a line containing:

 $image = new YapbImage(null, $post_id, $uri);

and add before it this line:

 MM_Execute_WM(ABSPATH . $uri,'');

Voila, you have a cool looking photo blog and all the pictures you upload to it have a watermark. All in less than half an hour which is very nice!

If you are really interested in seeing the blog you can check the result here: Photo Revolution.

Postfixadmin errors executing /usr/local/bin/postfixadmin-*

If you have followed the tutorials on howtoforge to install Postfixadmin and Postfix + CourierIMAP + Maildrop on a CentOS server for virtual domains you may have stumbled upon this problem when trying to add a new mailbox for a virtual domain:

[DATE] [error] [client XX.XX.XX.XX] Running sudo -u vmail /usr/local/bin/postfixadmin-mailbox-postcreation.sh 'user@domain.tld' 'domain.tld' 'domain.tld/user/' '0' yielded return value=1, first line of output=, referer: http://server/postfixadmin/create-mailbox.php?domain=domain.tld

Above this error message you may or you may have not noticed(like I did) this error message:

sudo: sorry, you must have a tty to run sudo

The solution is simple, just run visudo and comment the line containing:

Defaults    requiretty

Hope it will help someone!

ISPConfig3: Updating to myDNS-ng

If you have followed the tutorials “the perfect setup” for installing ISPConfig 3 chances are that you have an older myDNS version (1.1.0 or so). Since I had a few problems with that version I decided to update to myDNS-ng, the latest version.

In this article I will refer to rpmbuilder user, a user I create to compile and/or make RPMs. For more information on how to set it up check this link.

Also the instructions are for CentOs 5.4(but will probably work for any other 5.x version).

su - rpmbuilder
cd /tmp
wget http://downloads.sourceforge.net/project/mydns-ng/mydns/1.2.8.27/mydns-1.2.8.27.tar.gz?use_mirror=garr
tar zxvf mydns-1.2.8.27.tar.gz
cd mydns-1.2.8
./configure
make

Everything should be ok untill now. I had no problems to compile it. Then I decided to use checkinstall.

sudo yum install checkinstall
checkinstall

It will ask you a few questions, answer them and you should have a rpm package in /usr/src/redhat/RPMS. It will tell you anyway where he created the rpm.
After that I removed the old mydns packages and installed the new one as root:

service mydns stop
yum remove mydns mydns-mysql
yum install /usr/src/redhat/RPMS/i386/mydns-1.2.8-1.i386.rpm --nogpgcheck

After that I needed to create mydns start script:

vi /etc/init.d/mydns
chmod +x /etc/init.d/mydns

I used the script posted by rukus77 on howtoforge. Make sure you read all the comments on that forum (especially the one containing [ -f /usr/sbin/mydns ] || exit 1).
The last step is to run ISPConfig 3 setup:

cd ispconfig3_install/
cd install
php -q update.php

When asked if to reconfigure services answer yes, the rest you can answer no.

That would be all, thanks for reading.

Install Postfix, Courier-IMAP on CentOS 5

Platform: CentOS 5.4 i386
Extra repositories used: utterramblings and rpmforge
You will end up with Postfix 2.6.5, Courier IMAP 4.6.0, authlib 0.62.4 and maildrop 2.2.0

First of all you will need to install gcc++:

yum install gcc-c++ redhat-rpm-config

Create a user to compile packages if you don’t have one already. I used rpmbuilder for the account name.

useradd -m -s /bin/bash rpmbuilder
passwd rpmbuilder

It will need some privileges so type visudo and add this line somewhere (I added it after root):

rpmbuilder ALL=(ALL) ALL

Create the directory structure:

su - rpmbuilder
mkdir $HOME/rpm
mkdir $HOME/rpm/SOURCES
mkdir $HOME/rpm/SPECS
mkdir $HOME/rpm/BUILD
mkdir $HOME/rpm/SRPMS
mkdir $HOME/rpm/RPMS
mkdir $HOME/rpm/RPMS/i386
echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

Start downloading the needed courier packages(under the user rpmbuilder):

cd /tmp
wget http://sourceforge.net/projects/courier/files/maildrop/2.2.0/maildrop-2.2.0.tar.bz2/download
wget http://sourceforge.net/projects/courier/files/imap/4.6.0/courier-imap-4.6.0.tar.bz2/download
wget http://sourceforge.net/projects/courier/files/authlib/0.62.4/courier-authlib-0.62.4.tar.bz2/download

These were the latest versions when I wrote the article, feel free to browse sourceforge and get what version you want.
Start building and installing the RPMs:

sudo rpmbuild -ta courier-authlib-0.62.4.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh courier-authlib-0.62.4-1.i386.rpm courier-authlib-mysql-0.62.4-1.i386.rpm courier-authlib-devel-0.62.4-1.i386.rpm
cd /tmp
rpmbuild -ta courier-imap-4.6.0.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh courier-imap-4.6.0-1.i386.rpm
cd /tmp
sudo rpmbuild -ta maildrop-2.2.0.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh maildrop-2.2.0-1.i386.rpm

Done with Courier. Moving to postfix…

Download source RPM from this location:

cd /tmp
wget http://ftp.wl0.org/official/2.6/SRPMS/postfix-2.6.5-1.src.rpm
rpm -ivh postfix-2.6.5-1.src.rpm

I’ve made a few changes to the postfix.spec file (enabled mysql_redhat, vda patch) and also installed the required dependencies:

sudo yum install db4-devel mysql-shared mysql-devel

Building the postfix-2.6.5 rpm:

cd $HOME/rpm/SPECS
rpmbuild -ba postfix.spec

You should have the rpm in $HOME/rpm/BUILD so cd there and type:

sudo rpm -ivh postfix-2.6.5-1.rhel5.i386.rpm

In the end enable required services as root user:

chkconfig --levels 235 courier-authlib on
chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
chkconfig --levels 235 saslauthd on
chkconfig --levels 235 courier-imap on
service sendmail stop
service postfix start
service saslauthd start
service courier-authlib start
service courier-imap start

If everything went ok when telneting on port 25 of localhost you should get something similar to this:

Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 lightbringer.inno-solutions.ro ESMTP Postfix (2.6.5)
ehlo localhost
250-lightbringer.inno-solutions.ro
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

NOTE 1:
If you already have any of the packages install use rpm -Uvh instead of rpm -ivh.

Tools for S3

Recently I’ve been experiencing problems with S3Fox add-on when I tried to set ACL or delete files from a bucket. I was getting this error: “The request signature we calculated does not match the signature you provided. Check your key and signing method.” for each and every file. I tried to update to the latest version which 0.4.8(not available via FF check updates) but with no luck. The AWS credentials were fine.

So I decided to look for a new tool and I found CloudBerry Explorer for Amazon S3. It looks good enough and it works!

Feel free to let me know if you have used this tool and if you had any kind of problems with it!