I've started using Amazon EC2 with Aegir's multiple server setup and its sweeeet. I can add a new server to my Aegir setup in like 2 minutes.
My bash script
Here is the script: http://pastebin.com/hHnTDtzs
I've tested this script with ami-3e02f257. These are its specs:
- Ubuntu 10.04
- EBS Store (allows this to be "micro" compatable and easy to backup/clone.)
I don't see why the script wouldn't work with x64... I just didn't test that.
What it does
You can read through the script and see all the commads that it does but here is a quick summary:
- Runs apt-get update and upgrade
- Installs everything you need plus git and nano
- Forces php to be 5.2 rather than 5.3 using approach #3 here.
- Does almost everything you need to do in the manual aegir install for using the server as an slave host. Sets memory limits, comments bind-address, creates aegir user, creates aegir_root mysql user, etc...
- Installs pecl uploadprogress
- Installs Drush
What it doesn't do
It DOES NOT configure your hosts file or your rc.local file. You need to do both to get a FQDN (fully qualified domain name).
I add my ip (you will need an Elastic IP set in AWS console for your server instance) and domain name to /etc/hosts like so:
220.127.116.11 aegirslave1.mydomain.com aegirslave1 #line I added
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
You also want to add a
hostname aegirslave1.mydomain.com to your /etc/rc.local right before the exit 0.
Logging into your slave from your master
You need to copy your ssh key from your aegir master to your slave. I do that like so:
- Copy the amazon key (example: yourkeyname.pem) to your master server however you wish, via ssh or ftp.
- SSH into your to your master aegir server.... copy the id_rsa.pub file to your AMI instance:
- scp -i /path/to/amikey/yourkeyname.pem /path/to/aegirserverkey/id_rsa.pub email@example.com:~/
- Back at your ami instance terminal:
- sudo chown aegir:aegir id_rsa.pub
- sudo cp id_rsa.pub /var/aegir/.ssh/authorized_keys
- Back at your master server, test the login:
- ssh firstname.lastname@example.org
Finished and Future 2 Minute Installs...
Reboot and your done.
Now before you go and add this to your "main" aegir install (in the web ui). You should use Amazon AWS Console to clone your setup server:
- Right click on yoru console and click the "Create Image (EBS AMI)"
- Whenever you want a new server, you can create a new instance with that AMI... one that:
- already has everything you need installed
- has your aegir master ssh key (so you can instantly login to it)
- only needs the hosts and rc.local file re-setup for you new IP and FQDN
Last Quick Tip
Use drush make files for your platforms. That way, after you setup your newest Aegir slave host, you can put an Aegir platform on it AND add sites to it without touching the console again. You can do it straight from the web UI.
Here is a platform I have. It uses a make file I have located at: /var/aegir/gitdev/build/stsbase/stsbase.make in my MASTER server. I fill out the fields.. Aegir does the work :).
My notes from testing
I stuck my notes on pastebin, just so I have something to look back on. They are basically a bunch of commands I always forget and how to do stuff I always forget how to do :).