Skip to content
robinhouston edited this page Sep 28, 2012 · 20 revisions

We try to maintain an up-to-date, out-of-the-box version of the software as an AMI (Amazon Machine Image).

This means you can use Amazon's EC2 service to get started very quickly with hosting the software. For new users, you can get a "micro" EC2 instance free for a year. However, you should note that a micro instance will only be suitable for running the lowest-traffic of sites; and there are cheaper hosting options than EC2's larger instances.

The id of the most recent AMI is ami-4d0ebc24 (in the US-East (Virginia) region). To get started with EC2, follow one of the many online tutorials, such as this one. We provide one such brief tutorial below. (Note that you won't necessarily need a static IP address to start with; they cost you (a tiny amount of) money).

Once you have set up and started an instance, you can log in as user ubuntu. The software is owned by a user alaveteli and lives in /home/alaveteli/alaveteli/. It is set up following the "develop" branch, which means it's the latest, bleeding-edge code (and may contain bugs!) If you want to upgrade to the latest stable version of Alaveteli, you should:

$ sudo su - alaveteli
$ cd ~/alaveteli
$ git checkout master
$ git pull
$ ./script/rails-post-deploy

When you log into the server, it automatically calls (via /etc/rc.local) a script at /home/alaveteli/ec2-update-domain.sh. It looks up the current domain name for this instance (usually something like ec2-50-19-48-171.compute-1.amazonaws.com) and sets that as the hostname in various configuration files, in order to make the software work correctly.

Once the instance is booted, you should be able to access it at its Amazon host name (e.g. http://ec2-50-19-48-171.compute-1.amazonaws.com). By default all the ports are locked down, so make sure you open the ports for SSH (22), web (80) and mail (25). You can do this from the Security Groups screen in the EC2 management console (link).

It is set up using Varnish listening on port 80 on the external interface (see /etc/varnish/default.vcl, forwarding to Apache + Passenger listening on port 80 on localhost (see /etc/apache2/sites-enabled/alaveteli), memcached, and exim for local delivery.

When testing, you should probably check your spam folder if you're expecting to receive emails (and see below for notes about SPF and deliverability -- some domains reject all email originating from Amazon Web Services).

If you were to use it as the basis for a live host, you would want to:

  • Set up the instance with a static IP
  • Create DNS records pointing to that IP
  • Disable the ec2-update-domain.sh script and set up your new domain name in the places that script goes
  • Set up SPF records for the domain
  • Use an external SMTP server, rather than the local one, because email from within the AWS infrastructure has low deliverability rates. For example, trying to send to Gmail from AWS will result in your mail being rejected. One reasonable way of dealing with this is to set up your local MTA to use Amazon's SES (Simple Email Service); there's no official documentation for Exim, but someone has written a guide here.

Setting up a new AWS account

If don't have experience with AWS servers, here's a quick-step guide. It may not be up to date, but it might help you get going:

  1. Sign up for a free Amazon Web Services account. You'll need to enter a credit card, but Amazon's free tier has generous limits, which you are unlikely to exceed if you're only using it for demonstration purposes. You may need to confirm your account before the next step .

  2. Once you're signed up and confirmed, access the administrative interface. You can also get here by clicking "AWS Management Console" under the "My Account / Console" tab at the top-right of the screen, switching to the EC2 tab, and setting "Region" in the left-hand sidebar to "US East (Virginia)".

  3. Click "Launch Instance" then "Continue" to use the Classic Wizard. On the "Choose an AMI step", click the "Community AMIs" tab and enter the id of the most recent AMI (see above) into the search box. Click "Select" once the AMI appears. On the next screen, "Instance type" should default to "Micro". Then, click "Continue" three times.

  4. Create and download a new key pair to advance to the next step.

  5. Create a new security group. Under inbound rules, select and create rules for SSH, SMTP and HTTP. You should see your three rules in the right-hand table. Then, click "Continue" and "Launch"!

There are a couple more commands you need to run before you can use your new Alaveteli instance. If you select "Instances" under the "Instances" group in the left-hand sidebar, and then select your new instance, you'll see an address like ec2-23-20-237-136.compute-1.amazonaws.com in the bottom window. You can now run these commands with ssh:

ssh -i path/to/keypair.pem [email protected]
sudo su - alaveteli
cd ~/alaveteli
git checkout master
git pull
./script/rails-post-deploy

Then, visit your EC2 address and you should see Alaveteli! Add "/admin" to the URL to get to the admin interface (it is not secured in the demo). If you have any questions or stumble into any problems, please do not hesitate to reach out on the mailing list.

Clone this wiki locally