/aegir_ci

Libcloud/Aegir continuous integration scripts for use with Jenkins

Primary LanguagePython

The code I'm giving you uses Libcloud API, but it is very much designed for the Rackspace Cloud driver implementation. I know for a fact, through building other tools, that other provider drivers such as Linode have differing requirements (Linode, for example, requires you to also specify a datacentre to build in). Please don't contact me complaining that it didn't work with Provider X, because I'm just showing you how we use it with Rackspace. Since there's a good chance you're smarter than me, you're welcome to take the code and abstract it properly :)

The code is far from perfect because I'm rather crap at such things. The error handling is extremely crude.


1) Create a new Rackspace server (lucid lynx 10.04 for example)
2) ssh root@xx.xx.xxx.xxx (where xx.xx.xxx.xxx is the ip number of the server you just created).

3) Copy and paste this whole line as root:

apt-get install -y git-core ; git clone git://github.com/apache/libcloud.git ; apt-get -y install python-setuptools ; git clone git://github.com/sarapis/aegir_ci.git ; cd libcloud ; python setup.py install ; apt-get install -y fabric ; cd ..

4) Edit the aegir_ci_config.ini file:

a) email - this is your personal email from which you will control aegir
b) your rackspace username that you normally log into rackspace with
c) your rackspace API key which can be found at:

https://manage.rackspacecloud.com/APIAccess.do
click Show key to unhide the key

It's at this point that you want to edit the aegir_6.x-1.1_install.py file and define what to build. In my example that I'm giving you, I'm fetching three Drush make stub or 'build' files from my github repo, named drupal6, drupal7 and openatrium .build respectively.

The code that does this is the function fab_install_platform().

Thus, this code is very much specific to building your project from a makefile, the fact that the makefile is fetchable over HTTP (per the ini config file, it fetches from my github repo) and also makes some assumptions on what install profile to use when installing the site.

The code that installs the site is the function fab_install_site(), and takes two arguments: the platform per the above (e.g drupal6, drupal7 or openatrium), and the install profile name (default, standard or openatrium in this example). So this is where you want to change the install profile name and only install whatever platforms you want, based on the name of your makefile.

5) python aegir_6.x-1.1_install.py

Aegir should should send you an email with a one-time login, at which point you may choose to enable more Aegir features such as:

migration (move the site with its database either to a new domain with the same codebase or to another platform altogether)
cloning (create an exact copy of the database on the same codebase as a site)
aliasing (multiple aliases for sites)
cron queue (manage cron on all your sites)

You can do that here: http://xx-xx-xxx-xx.static.cloud-ips.com/admin/hosting/features

Don't forget that to make domain names work properly you should create A records (at Rackspace) and site aliases (in Aegir) as well as get your registrar stuff sorted out in advance or else you'll have to wait through the DNS propagation time

Assuming the DNS has propagated and you have sites hosted in Aegir that are up and working, it would be helpful to set up Drush:

As per the Drush README (in /var/aegir/drush), you will see:

ln -s /path/to/drush/drush /usr/local/bin/drush

which means on our new Aegir server

ln -s /var/aegir/drush/drush /usr/local/bin/drush

-----------------

OwnCloud

to install owncloud 
1) find the mysql root password like so: cat /var/aegir/.drush/server_localhost.alias.drushrc.php
the line will say something like   'master_db' => 'mysql://root:thispartisthepassword@localhost',
2) mysql -uroot -p
steps 3-5 are at the mysql prompt:
3) create database owncloud;
4) grant all privileges on owncloud.* to 'owncloud'@'localhost' identified by 'yourownclouddatabasepassword';
5) exit
6) go to http://xx.xx.xxx.xxx/owncloud
7) give your admin username, password and fill out the database credentials
8) to see how to mount a drive locally click the gear button in the bottom left corner of the browser and go to 'Personal'