Sloecode is a simple Bazaar hosting project.
Last year I tried to set up my home server to offer a place for three people to have shared, private access to a bazaar repository for a project. I found it really ackward. I felt that there had to be a simpler way.
Launchpad is an awesome place to host Bazaar branches. However Launchpad is for open source projects and personal branches are public.
I was approached towards the end of last year by Thomi who suggested we create a simple Bazaar hosting project for Otago Polytechnic to provide a place for the students to host their senior year projects. Since it was something I also cared about, and hadn't found a reasonable solution elsewhere, I agreed to help.
Our initial requirements went something like this:
- Users defined in a database and no local login needed on the hosting server
- Private repositories for the students to host personal branches
- Lecturers should be able to see the repositories of the students
- Projects have private repositories only visible to the members of the project team, and the Lecturers
- Simple URLs for getting access to the branches
- Scalability isn't a priority
In the end we went with the new pyramid libraries for the web application. We tried briefly with django, but I found the framework blocked me whenever I tried to do something. I had worked a lot with zope, and repoze.bfg was something we looked at. When repoze.bfg and turbogears merged into pyramid we felt that we had found a good match for us.
Installing and running the sloecode server is still a bit messy. We'd love to get it to the stage we you can just run an installer and magic happens. But we are not there yet.
The application server runs on the same machine as the filesystem hosting the branches and repositories. Shared repositories are created for each user as they are added. When a project is created so is its shared repository, and trunk branch which is set to append only.
Users log in and add their public SSH key. Users should also install the bzr-sloecode client plugin. Initially the plugin had hard coded site names for the Otago Polytechnic. But looking forward I decided that we should just use an environment variable. This allows access to the sloecode server using a short hand url.
- sc:my-project - gets access to the trunk branch of the project called my-project
- sc:my-project/trunk - also gets access to the trunk branch
- sc:my-project/some-branch - gets access to the branch some-branch of my-project
- sc:~myid/personal-branch - gets access to the branch personal-branch on my repository
The sc translation is done client-side, like the lp expansion for Launchpad.
We run a custom twisted SSH server on the hosting machine. This does the SSH key lookup against our user database, and doesn't allow password login. It also restricts the commands that can be executed on the server side to what it expects Bazaar to ask for. No shells are given. The server then launches a subprocess that uses a wrapped smart server that has a virtual filesystem to translate the requested paths to the underlying filesystem. This operates in a similar way to Launchpad, but much more trivially. The repository hosting configuration just needs two paths: one for the project repositories, and one for the personal repositories. The smart server code also handles the privacy aspect, not allowing unauthorized users access to repositories they shouldn't see.
The future
We'd like to have some form of code browsing functionality added. Whether we use loggerhead, or something else is still up in the air. We'd also like to integrate wikis for the projects. Wikkid would be a good fit (another of my personal projects) and could spur on some of the stalled development.
Ease of installation and configuration is another aspect we'd like to tidy up.
If you are interested in getting involved join the sloecode-dev team on Launchpad as it handles the development mailing list.
2 comments:
It sounds awesome. I'd recommend using loggerhead - I integrated it into another project hosted site quite easily (well, I just pointed my urls there, and used the existing apache config for authentication).
+1 for getting wikkid on the road again, hopefully launchpad can use it for its wikis soon!
It might be worth mentioning that we all hang out in #sloecode on Freenode. We're all currently in the awkward +1300 timezone, so catching us when we're awake may be problematic.
Post a Comment