def deploy_project(tagname, force=False): """ Deploys project on prepared server. """ make_src_dir() tag_dir = os.path.join(fabric.api.env.conf['SRC_DIR'], tagname) if fabric.contrib.files.exists(tag_dir): if force: fabric.api.warn(fabric.colors.yellow('Removing directory %s and all its contents.' % tag_dir)) fabric.api.run('rm -rf %s' % tag_dir) else: fabric.api.abort(fabric.colors.red('Tagged directory already exists: %s' % tagname)) if tagname == 'trunk': vcs.push(tagname) else: fabric.api.local('rm -rf %s' % os.path.join('/tmp', tagname)) with fabric.api.lcd('/tmp'): vcs.export(tagname, local=True) fabric.contrib.project.rsync_project( local_dir = os.path.join('/tmp', tagname), remote_dir = fabric.api.env.conf['SRC_DIR'], exclude = fabric.api.env.conf['RSYNC_EXCLUDE'], extra_opts='--links --perms') fabric.api.local('rm -rf %s' % os.path.join('/tmp', tagname)) virtualenv_create(dir=tag_dir) pip_install(dir=tag_dir) fabric.api.sudo('chown -R ubuntu:ubuntu /srv')
def deploy_project(tagname, force=False, username="******"): """ Deploys project on prepared server. """ make_src_dir(username=username) tag_dir = os.path.join(fabric.api.env.conf['SRC_DIR'], tagname) if fabric.contrib.files.exists(tag_dir): if force: fabric.api.warn(fabric.colors.yellow('Removing directory %s and all its contents.' % tag_dir)) fabric.api.run('rm -rf %s' % tag_dir) else: fabric.api.abort(fabric.colors.red('Tagged directory already exists: %s' % tagname)) if tagname == 'trunk': vcs.push(tagname) else: #fabric.api.local('rm -rf %s' % tmp_tag)) #with fabric.api.lcd('/tmp'): # vcs.export(tagname, local=True) tmp_tag = os.path.join('/tmp', '%s' % (tagname)) if not os.path.isdir(tmp_tag): fabric.api.puts(fabric.colors.green('Exporting tag %s to %s' % (tagname, tmp_tag))) vcs.export(tagname, export_dir=tmp_tag, local=True) else: fabric.api.warn(fabric.colors.yellow('Using existing export of tag %s at %s' % (tagname, tmp_tag))) fabric.contrib.project.rsync_project( local_dir=tmp_tag, remote_dir=fabric.api.env.conf['SRC_DIR'], exclude=fabric.api.env.conf['RSYNC_EXCLUDE'], extra_opts='--links --perms') #fabric.api.local('rm -rf %s' % tmp_tag) virtualenv_create(dir=tag_dir) pip_install(dir=tag_dir) fabric.api.sudo('chown -R %s:%s /srv' % (username, username))
def deploy_project(tagname, force=False): """ Deploys project on prepared server. """ make_src_dir() tag_dir = os.path.join(fabric.api.env.conf['SRC_DIR'], tagname) if fabric.contrib.files.exists(tag_dir): if force: fabric.api.warn( fabric.colors.yellow( 'Removing directory %s and all its contents.' % tag_dir)) fabric.api.run('rm -rf %s' % tag_dir) else: fabric.api.abort( fabric.colors.red('Tagged directory already exists: %s' % tagname)) if tagname == 'trunk': vcs.push(tagname) else: fabric.api.local('rm -rf %s' % os.path.join('/tmp', tagname)) with fabric.api.lcd('/tmp'): vcs.export(tagname, local=True) fabric.contrib.project.rsync_project( local_dir=os.path.join('/tmp', tagname), remote_dir=fabric.api.env.conf['SRC_DIR'], exclude=fabric.api.env.conf['RSYNC_EXCLUDE'], extra_opts='--links --perms') fabric.api.local('rm -rf %s' % os.path.join('/tmp', tagname)) virtualenv_create(dir=tag_dir) pip_install(dir=tag_dir) fabric.api.sudo('chown -R ubuntu:ubuntu /srv')
def deploy_project(): """ Deploys project on prepared server. """ virtualenv.virtualenv_create() deploy.make_clone() virtualenv.pip_install(env.conf.PIP_REQUIREMENTS, restart=False) setup_web_server() dj_cmd.syncdb() dj_cmd.migrate() dj_cmd.collectstatic() dj_cmd.manage('compress')
def deploy_project(): """ Deploys project on prepared server. """ virtualenv.virtualenv_create() make_clone() virtualenv.pip_install(env.conf.PIP_REQUIREMENTS, restart=False) setup_web_server() update_django_config() dj_cmd.syncdb() dj_cmd.migrate()