I haven’t been updating this site or the software running it very much for the last year and a half. Time sure flies. In the mean time, ideas evolve and mature. So after reading about Toto, a tiny Ruby + git blog software, I resolved to update nnmc and finally implement a few idea I had at the beginning. Here is what I did today:
I now use git (via github) for the version control of the software. You can now peek at the ugly php code behind this site.
I also use git for the content. Unlike Toto, I use a separate repository for the content of the website. I don’t have templates but I have a few different categories of content, not just a blog. As the content is easily scrapable from the web, I just made the raw source available on GitHub (also, it will not count toward my private repo quotas).
I finally created a setup script to handle the different configuration between the local (dev) version and the production (remote) sites. You can peek at it.
One nice idea of Toto that I like very much is to not have a component to edit the content from the web. I didn’t create that much content via the web interface anyway. That sure simplifies the security aspect, especially when you can’t have ssl on your host. I’ll see when I have time to remove it.
To migrate this website from being a set of files to being a checkout off github, I had to do a bit of research to find a way around using
git clone. The problem was that I wanted to checkout the content of the repository in the public directory from where files are served, not create a ‘nnmc’ dir and symlinking that. So here is what I did, after ssh-ing into my account. I ran the following commands from
/home/public directory that serves the files.
To get the software :
git init git remote add origin git://github.com/nicolasH/nnmc.git git fetch origin
The following command will actually make the files appear in the directory. I use the
-f to overwrite the files that are both in the repository and on the website.
git checkout -f -t origin/master -b master
Then just symlinks the .htaccess and config.php to the prod_ files:
bash setup.sh prod
To get the content is much simpler, as it was already in a separate directory:
git clone git://github.com/nicolasH/content_nnmc.git
And “that’s it”. I can update either the content or the software with a
git pull. Which I will have done to update this post.