You can see Fabric ; the documentation describes it as
... a Python library (2.5 or higher) and a command-line tool to optimize the use of SSH for application deployment or system administration tasks.
He is able to do whatever you want.
Your βdeployβ task will probably have several subtasks ( _upload_tar_from_hg() , _migrate() , etc.), but the overall picture will look something like this:
from fabric.api import * env.release_name = 'foo_bar-1.0' env.deployment_path = '/var/www/django/%s' % env.release_name def deploy(): local('hg archive -t tgz $s.tar.gz' % env.release) put('%s.tar.gz' % env.release, env.deployment_dir) run('cd %s && tar -xzvf %s.tar.gz' % (env.deployment_path, env.release)) local('rm %s.tar.gz' % env.release) run('cd %s/%s && ln -s settings_production.py settings.py' % (env.deployment_path, env.release))
This depends on having a separate settings_production.py control in the source, which may not be acceptable. The fabric can find and replace in text files, or you can combine parameters using a local_settings.py .
Go to the Fabric tutorial to fill in the blanks (for example, specify connection details for your server. Once you are configured, just run
fab deploy
and the process should run automatically.
NB creating an archive from Mercurial without hg metadata is done in one step with the hg archive command)
source share