XP-Dev.com

XP-Dev.com Documentation - User Gude - Direct File Hosting

As of 9th Feb 2009, a new feature has been added to XP-Dev.com

All subversion repositories can support direct file hosting from a subdomain in the following format:

repository name.node.xpdev-hosted.com

Disclaimer

All Direct File Hosting enabled repositories are served on the public internet. Please do not enable it if your repository contains data that you don’t want internet viewers to visit.

If your repository contains a section that you want published (for e.g. /trunk/website/public) please create a new repository for the public website and use Subversion Externals to link from your private repository. That way you won’t need to turn on Direct File Hosting on your private repository

What is Direct File Hosting ?

Direct File Hosting is just a simple way to publish a website from one of your Subversion repositories hosted on XP-Dev.com

You create a new subversion repository, check-in (commit) your website to it, and we’ll host it for you under your repository name.node.xpdev-hosted.com

Whenever you commit any changes to the Subversion repository, it will automatically be reflected on the published website.

The advantages over traditional web site hosting are:

  • Keep your whole website revisioned under Subversion
  • Allow any number of people/collaborators to update the website
  • Make changes from anywhere (you’ll need a Subversion client installed)
  • Use Jekyll to publish your website and avoid writing HTML and repetitive templating code

Advantages over Web DAV

This provides a number of advantages over the regular web DAV that is exposed for all subversion repositories:

  • Performance, performance, performance
    Direct File Hosting runs under a web server, and serves only static files.
  • Mime content types
    Normal Web DAV does not have mime type support (it can be enabled). So, all your HTML documents will be served as text/plain under Web DAV
  • Welcome files
    Just add a new file called index.html at the root of your repository and it will be served as the welcome file whenever anyone visits repository name.node.xpdev-hosted.com

Enabling Direct File Hosting

Enabling direct file hosting can be done in a few easy steps:

  • Create a project and enable source control.
  • Head to your project’s Source Control tab and click on Edit Repository
  • Turn on the box next to Enable File Hosting.
  • Click on Save and it should be turned on almost instantaneously.

  • Your default website domain name will be displayed under your project’s Source Control tab

Check-in a New Website

  • Start with checking out the repository
    (I’ve used a command line subversion client in this example, but you’re free to use anything that you’re like!)
rs@laptop:/tmp$ svn co http://svn.xp-dev.com/svn/rs-myrepo/
Checked out revision 0.

  • Check in some content:
rs@laptop:/tmp$ cd rs-myrepo/
rs@laptop:/tmp/rs-myrepo$ svn add index.html 
A         index.html
rs@laptop:/tmp/rs-myrepo$ svn commit -m "initial welcome page"
Adding         index.html
Transmitting file data .
Committed revision 1.

Go visit http://rs-myrepo.1.xpdev-hosted.com/ and have a look at the web page that has just been checked in.

At this point any other changes that are made to the repository, i.e. committing changes, will be reflected immediately on the website.

The demo project used in the example above has been open sourced. You can browse the repository here.

Mapping a Domain

  • Once you have enabled Direct File Hosting on your repository, click on Map a New Domain

  • Enter the fully qualified domain name that you wish to host on XP-Dev.com
  • Click on Save

  • The new mapped domain should be displayed under Domains mapped

  • There is one final step you need to perform to ensure that your mapped domain works perfectly. You will need to point your domain that you used above to XP-Dev.com servers. This is usually done via your Domain Name Server provider (most of the time its where you have registered your domain).
  • You can either:
    • Add a CNAME record and point it to your *.xpdev-hosted.com subdomain, or
    • Add a A record and point it to the IP Address 95.154.193.230
  • In the example above, I have added a new A record for example-dfh.xp-dev.com and pointed it to 95.154.193.230. Head over to http://example-dfh.xp-dev.com/ to see it working

Using Jekyll with XP-Dev.com Direct File Hosting

Nothing needs to be done to your repository settings to be able to use Jekyll. All repositories are enabled with Jekyll.

All you have to ensure is that your repository contents is what Jekyll’s expects it to be.

There are some instructions on Jekyll’s home page at http://wiki.github.com/mojombo/jekyll/usage that outlines the steps needed to get started. The only difference is that you commit all your website’s contents into your repository at the top (root) level without using the “trunk”, “branches” and “tags” directories which is common to Subversion.

For example, this documentation site uses Jekyll and you can browse the contents of the repository at http://xp-dev.com/sc/browse/64051/