Bazaar-NG: private repositories on shared hosting

You are a developer, software engineer, web designer, text writer… You want your files accessible from all the places (like a source for your project or a template for a website) – and you want to be sure that it is always the most up to date version…

Sure you can drag those files along on a USB stick and copy it forth and back. You have those files even if there’s no Internet access. Important? Sure but…

Not too handy. You always have to take care about updating files on the stick to the most recent versions, copy files, check dates and watch out that you don’t modify old files.

You know you are smarter than that! You have a shared hosting and use FTP, don’t you? The files are accessible where Internet access is, you don’t have to remember about taking USB stick with you. But.. but you still have to take care about copying good versions…

How about using an SCM/RCS tool? This would be great. However most of the tools require you to have a direct access to HTTP server configuration which, in case of shared hosting, is out of the question. A lost battle? Not necessarily…

This is where Bazaar-NG comes to the rescue. Bazaar is a continuously developed (and what isn’t continuously developed in open source country?) DSCM/DRCS which doesn’t require access to HTTP server configuration.

Bazaar (short: bzr) is written in Python. It is a child of Canonical, creators of Ubuntu. Bzr is a derivation of TLA and GNU Arch revision control systems.

What does it can? Well, to make long things short, please read documentation. Especially this quick tutorial for Bazaar will be a good starting point.

Now to the point: how can you use your shared hosting for repository? Moreover, how can you protect it with a password? And where you don’t have acces to shell nor python? It’s quite simple though – thanks to the fact that Bazaar does not require any fancy database nor special configurations.

Ok. Here we go. I am assuming that you have already downloaded Bazaar and have it working (it needs Python). First let’s create a shared repository on our desktop workstation:

bzr init-repo ./repo

To ease future debugging of access problems you might create an index.html file inside repo directory. The contents are not important.

Now let’s create a project inside our fresh repository:

bzr init ./repo/MyProject

That’s it! We now have a project template inside. Now let’s test it and branch it to some working copy:

bzr get ./repo/MyProject

Now you should have a directory containing only a .bzr directory inside. It’s a control/config directory of Bazaar for your project. Since Bazaar is a distributed revision control system, the is a fully blown, self-contained repository too. Any bzr operation in this project folder will now be stored inside.

If everything is working ok transfer repository to the server. Just use FTP to put whole ./repo inside public_html directory. After that you can check whether it is working by pointing your browser to http://domain.tld/repo. You should see the contents of index.html file you put inside ./repo.

Now you can use your repository just like when it was tested:

bzr get http://domain.tld/repo/MyProject

When you make any changes inside you have to synchronize local repository (Remember? The is self-contained repository) with remote one:

bzr push ftp://user@domain.tld/repo/MyProject

from inside of and assuming that FTP user‘s home directory is public_html. You have to use FTP protocol since by HTTP you can’t write anything on the server. There is a bzrWebDav plug-in in the works that will allow you to use WebDAV protocol, if server supports it, for updating files.

Of course the above commands (init-repo, init) could be done directly on the server using FTP but it was easier to test them locally first. So, if you would like to add new project to existing repository just issue:

bzr init ftp://user@domain.tld/repo/MyNewProject

You can now secure HTTP access to your repository by using authentication. If your service provider uses Apache just look at this .htaccess tutorial.

That’s all! You have your own repository now!


7 responses to “Bazaar-NG: private repositories on shared hosting

  1. Hey, do you mind if I post a link to this article? I have a new site coming up that needs articles like this that go in-depth on command line inputs. Let me know.

  2. Great Tutorial!!! I have to test this … would save me a lot of trouble 😉


  3. Pingback: Git: private repositories on shared hosting « When grass was greener

  4. Thanks for this post. It was a great guide and aide-memoire.


  5. My pleasure. Share the info!

  6. Pingback: Bazaar via ftp o de como crear un repositorio de control de versiones en un hosting compartido, sin acceso ssh… « Software Tips

  7. Pingback: – Software Tips » Bazaar via ftp o de como crear un repositorio de control de versiones en un hosting compartido, sin acceso ssh…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s