How I deploy static sites
We’ve all heard over and over about how we should be keeping things under source control – and for important sites, you probably do. But what about static sites? Do you keep them under source control, or do you just edit them manually?
I’ve recently been busy moving some of my own static sites from one server to another, which has given me a good opportunity to examine my own server (mis)configuration. With that in mind, I think I’ve now found the best way(for me, at least) to deploy static sites.
First off, create a source control repository for your site. I like Git, so that’s what I used:
Once that’s done, create the folders that you need for all of your site’s files(I like conf, logs, and public):
At this point I tend to create whatever configuration files I need, and store them all in conf. I also like to create empty log files and keep them in source control, so that anytime I do a fresh deploy of my site I also get blanked log files.
Once your configuration files are set up how you like them, and you’re happy with how your local version of the static site has turned out, it’s time to deploy. Commit your changes to your repository, and then log into your server so that you can check out the code for your site. Once that’s done, all you have to do is check out your code and symlink some config files:
With that done, restart your server, and…you’re good to go! And anytime you need to update your site, you can make all the changes locally, commit them, and then just update it on the server. (I wrote a script that retrieves any new changes, and then restarts the servers it needs to)
Posted by Luke on December 14, 2009 | Comments (0)

Add the first comment...