Running your Website with BitKeeper
Revision control for software is not a new concept. Neither is the concept of running a website using revision control, however it is not a very common practice. Wyome is running directly off the the stable Xaraya tree, with the modules running from the modules tree. This theme is also running directly out of BitKeeper and everything is symlinked into the www folder. What this allows me to do is, is revert changes to a known stable version as well as ease my upgrading to more recent versions of Xaraya. Likewise, Xaraya.com and all of the sub-sites are also running off the same system.
I will tell you off the bat, this is not for the weak of heart. I know when things are working in the repository, and my needs are not that great. However, it is a very easy and efficient way of running a website if you have the requirements:
- BitKeeper Installed: If you run your own dedicated server, then this requirement should be relatively easy. However, if you are using a hosting company and are on a shared server, this could be a more difficult item. If you run a hosting company, and have BitKeeper installed, I would love to recommend you to any Xaraya user.
- Shell access. You need to be able to SSH into the server. If you do not have SSH access, then finding a company that has BitKeeper installed is not going to give you much of a benefit because you will not be able to clone the repositories.
- Space. You need to have enough web space to hold both the stable and modules repositories from Xaraya. In some cases your maximum web space includes your database, so this needs to be taken into account. The clones eventually could be well over 100 meg of file space, so this needs to be taken into consideration before attempting this at home.
- *Nix style server. We want to be able to symlink, and as far as I know, Windows servers do not have this functionality.
Getting Started
You first need to create a folder off below your root directory. Generally, when you log in either with FTP or SSH, you will see a few directories. WWW, Public_HTML, FTP are all very common directories to see. What we need to do is create a new directory. "Clones" will work for our purposes:
mkdir clones
You should now have a clones directory. Once we have the directory, we need to move to it, so we can create our clones from BK. This action is performed by:
cd clones
And we are now ready to clone the repositories. Your clones will be kept in a separate directory from the HTML root because we want to be able to symlink our clones into our HTML root. To clone the repositories for our needs, we have two actions to perform:
bk clone http://www.xaraya.com:15000/stable
When that is complete:
bk clone http://www.xaraya.com:15000/modules
What we are doing is grabbing the stable tree and the module tree from Xaraya, and creating a new anonymous clone on our web server. The clone sets up the RCS on our server which allows us to now grab updates directly from the stable and anonymous tree. Anytime that we want to update our website now, we do a pull rather than extract a tar.gz file or upload the website directly from FTP. It is a time saver. In addition, we are using BitKeeper to track the changes that are made on the website, so we are able to downgrade the website to a known usable condition if we need to do so (minus any database changes).
Final Steps
We have created the clones out of the web root. It is now time to link those directly to the web root so they are able to be used. We simply need to symbolically link the stable clone into our web root, and then link each module that we are going to use to our modules folder. This is done by:
ln -sf clones/stable/html public_html
Where public_html is your web root. Likewise, we need to get the modules from the module clone to be linked into the modules folder in the our new clone just move the modules folder inside your web root and do the following:
ln -sf clones/modules/*modulename *modulename
Where *modulename is the name of the module that you are linking. Once this is done, you should be ready to run your site normally. When you are ready to update your website, it is simply done by moving into the individual clone and performing:
bk pull