Poor Programmer's Release Script
Posted by Gene at
10:04 on Mon 26 Apr 2010
-- 0 Comments
Description
When you are coding these days, you might be using Mercurial or git for source control. Since these are distributed systems, there is no central repo. So you can't cheat and use it as your release procedure, like you could with cvs, and svn. I prefer to use Mercurial. When I'm ready to push code to a server, I put something like this my .bashrc file.
rsync_project_release()
{
rsync -vrzu --delete --exclude '/**/settings.py' --exclude '/**/*.pyc' --exclude '/**/.*' /Projects/test/test.evn/test :/releases/test
}
Brief Explanation
- This sends the Django project test (and all files subdirectories) in the virtualenv directory 'test' to the server as an update (only altered files)
- Any file that has been deleted locally, is deleted on the server.
- Exclude the setting.py, so you don't stomp on the production one which is probably different.
- Exclude .pyc files and anything that starts with .
Notes
- Fabric is a cool product, and I might start using that too to restart servers.
- Of course, if you are collaborating with a team, you probably have a git or hg hub. If so, you can still use this copy files from a testing area to a release area. So, you don't need a working directory on production.
- Of you have more than one server, you could certainly add more lines to that function.
