def get_new_version(project_name, target, repository, tag): ''' Fetches selected tag and puts it under the selected directory ''' dir_name = '%s-%s' % (project_name, datetime.today().strftime('%Y%m%d%H%M')) with cd('/tmp'): # remove junk dirs if exists(project_name): run('rm -rf %s' % project_name) if exists(dir_name): run('rm -rf %s' % dir_name) # fresh clone run('git clone %s --quiet' % repository) with cd(project_name): try: # archive tag run('git archive --format=tar --prefix=%s/ %s | (cd /tmp/ && tar xf -) ' % (dir_name, tag)) except: abort('Make sure %s exists in the repository.' % tag) # rm cloned code run('rm -rf %s' % project_name) # move into the proper dir if exists(os.path.join(target, dir_name)): sudo('rm -r %s' % os.path.join(target, dir_name)) sudo('mv %s %s' % (dir_name, target)) return os.path.join(target, dir_name)
def deploy(): with prefix('source $(which virtualenvwrapper.sh) && workon remote'): settings_file = '--settings=haxclub.settings.base' env_vars = config.get('env_vars') if not exists('~/haxclub'): with cd('~/'): run('git clone https://github.com/jsalva/haxclub') with cd('~/haxclub/haxclub'): if not exists('logs'): run('mkdir logs') run('git pull origin master') with shell_env(**env_vars): prompts = [] prompts += expect("Type 'yes' to continue","yes") with expecting(prompts): erun('python manage.py collectstatic %s' % settings_file) erun('python manage.py migrate %s' % settings_file) erun('python manage.py syncdb %s' % settings_file) if exists('supervisord.pid'): erun('python manage.py supervisor reload %s' % settings_file) else: erun('python manage.py supervisor --daemonize %s' % settings_file) if not exists('/tmp/nginx'): run('mkdir /tmp/nginx') put('nginx.conf','/etc/nginx/nginx.conf',use_sudo=True) put('nginx_haxclub.conf','/etc/nginx/conf.d/nginx_haxclub.conf',use_sudo=True) put('ssl/haxclub.key.nopass','/etc/ssl/certs/haxclub.key.nopass',use_sudo=True) put('ssl/haxclub.crt','/etc/ssl/certs/haxclub.crt',use_sudo=True) put('nginx_haxclub.conf','/etc/nginx/conf.d/nginx_haxclub.conf',use_sudo=True) sudo('service nginx stop; service nginx start;')
def deploy(project = "", restart=False): ## if no project is specified deploy all of them if project == "": for p in PROJECTS: print(p) prepare_deploy(p) if confirm(red("Do you wish to proceed?")): upload(p) deploy_shared_static() # Restart jetty if confirm(red("Do you wish to restart jetty?")): sudo('service jetty restart') else: ## deploy only the specified project print(project) prepare_deploy(project) if confirm(("Do you wish to proceed?")): upload(project) deploy_shared_static() # Restart jetty if confirm(red("Do you wish to restart jetty?")): sudo('service jetty restart')
def flask_manage(instance, command): dirname = "/srv/www/%s" % instance cmd = "export MAPROULETTE_SETTINGS=%s/config.py &&\ source %s/virtualenv/bin/activate && python\ manage.py %s" % (dirname, dirname, command) with cd("%s/htdocs/maproulette" % dirname): sudo(cmd, user="******")
def version_state(name, prefix=False, no_content=False): """ If the server state exists return parsed json as a python object or True prefix=True returns True if any files exist with ls [prefix]* """ if env.project_fullname: full_name = "-".join([env.project_fullname, name]) else: full_name = name current_state = False state = State(full_name) state_path = "/var/local/woven/%s" % full_name if not prefix and not no_content and exists(state_path): content = int(sudo("ls -s %s" % state_path).split()[0]) # get size if content: fd, file_path = tempfile.mkstemp() os.close(fd) get(state_path, file_path) with open(file_path, "r") as f: content = f.read() object = json.loads(content) current_state = object else: current_state = True elif not prefix and no_content and exists(state_path): current_state = True elif prefix: with settings(warn_only=True): # find any version current_state = sudo("ls /var/local/woven/*%s" % name) if not current_state.failed: current_state = True return current_state
def dump_db(dumpfile="pootle_DB_backup.sql"): """Dumps the DB as a SQL script and downloads it""" require('environment', provided_by=[production, staging]) if ((isfile(dumpfile) and confirm('\n%s already exists locally. Do you ' 'want to overwrite it?' % dumpfile, default=False)) or not isfile(dumpfile)): remote_filename = '%s/%s' % (env['project_path'], dumpfile) if ((exists(remote_filename) and confirm('\n%s already exists. Do you ' 'want to overwrite it?' % remote_filename, default=False)) or not exists(remote_filename)): print('\nDumping DB...') with settings(hide('stderr')): sudo('mysqldump -u %s -p %s > %s' % (env['db_user'], env['db_name'], remote_filename)) get(remote_filename, '.') else: print('\nAborting.') else: print('\nAborting.')
def XXXX_cleanup_logs (): """ Cleanup all the logs """ with cd(env.admin.prefix): with settings(warn_only = True): sudo('[ -d logs ] && rm -rf logs/*')
def create_db(): """Creates a new DB""" require('environment', provided_by=[production, staging]) with settings(hide('stderr')): sudo("mysql -u %(db_user)s -p -e 'CREATE DATABASE %(db_name)s DEFAULT " "CHARACTER SET utf8 COLLATE utf8_general_ci;'" % env)
def load_db(dumpfile=None): """Loads data from a SQL script to Pootle DB""" require('environment', provided_by=[production, staging]) if dumpfile is not None: if isfile(dumpfile): remote_filename = '%(project_path)s/DB_backup_to_load.sql' % env if (exists(remote_filename) and confirm('\n%s already exists. Do you want to overwrite it?' % remote_filename, default=False)) or not exists(remote_filename): print('\nLoading data into the DB...') with settings(hide('stderr')): put(dumpfile, remote_filename, use_sudo=True) sudo('mysql -u %s -p %s < %s' % (env['db_user'], env['db_name'], remote_filename)) else: print('\nAborting.') else: print('\nERROR: The file "%s" does not exist. Aborting.' % dumpfile) else: print('\nERROR: A dumpfile must be provided. Aborting.')
def _prompt_display(display_output): env.password = None env.no_agent = env.no_keys = True env.key_filename = CLIENT_PRIVKEY output.output = display_output with password_response( (CLIENT_PRIVKEY_PASSPHRASE, PASSWORDS[env.user]), silent=False ): sudo('oneliner') if display_output: expected = """ [%(prefix)s] sudo: oneliner [%(prefix)s] Login password for '%(user)s': [%(prefix)s] out: sudo password: [%(prefix)s] out: Sorry, try again. [%(prefix)s] out: sudo password: [%(prefix)s] out: result """ % {'prefix': env.host_string, 'user': env.user} else: # Note lack of first sudo prompt (as it's autoresponded to) and of # course the actual result output. expected = """ [%(prefix)s] sudo: oneliner [%(prefix)s] Login password for '%(user)s': [%(prefix)s] out: Sorry, try again. [%(prefix)s] out: sudo password: """ % { 'prefix': env.host_string, 'user': env.user } eq_(expected[1:], sys.stdall.getvalue())
def test_consecutive_sudos_should_not_have_blank_line(self): """ Consecutive sudo() calls should not incur a blank line in-between """ env.password = None env.no_agent = env.no_keys = True env.key_filename = CLIENT_PRIVKEY with password_response( (CLIENT_PRIVKEY_PASSPHRASE, PASSWORDS[USER]), silent=False ): sudo('oneliner') sudo('twoliner') expected = """ [%(prefix)s] sudo: oneliner [%(prefix)s] Login password for '%(user)s': [%(prefix)s] out: sudo password: [%(prefix)s] out: Sorry, try again. [%(prefix)s] out: sudo password: [%(prefix)s] out: result [%(prefix)s] sudo: twoliner [%(prefix)s] out: sudo password: [%(prefix)s] out: result1 [%(prefix)s] out: result2 """ % {'prefix': env.host_string, 'user': env.user} eq_(sys.stdall.getvalue(), expected[1:])
def setup_web(): require.deb.packages(['git', 'npm', 'nodejs-legacy', 'python3-dev', 'libxml2-dev', 'libxslt1-dev', 'libpq-dev']) require.nginx.server() require.nginx.site(env.server_name, template_source='nginx-site', port=80, server_alias='', static_path=env.static_path) # require.nginx.disabled('default') with settings(warn_only=True): if run('type bower').return_code: sudo('npm install -g bower') update_source() require.directory(env.home + '/logs') require.python.packages(['uwsgi', 'virtualenv', 'ipython', 'celery'], use_sudo=True) require.file('/etc/init/uwsgi.conf', source='uwsgi.conf', use_sudo=True) # require.file('/etc/init/celery.conf', source='celery.conf', use_sudo=True) require.directory('/etc/uwsgi', use_sudo=True) require.files.template_file('/etc/uwsgi/%s.ini' % env.project_name, template_source='uwsgi.ini', context=env, use_sudo=True) require.service.started('uwsgi') require.directory(env.home + '/bin') require.files.template_file(env.home + '/bin/djangorc', template_source='bin/djangorc', context=env) require.files.template_file(env.home + '/bin/loadenv', template_source='bin/loadenv', context=env) run('chmod +x ' + env.home + '/bin/loadenv')
def test_password_memory_on_user_switch(self): """ Switching users mid-session should not screw up password memory """ def _to_user(user): return join_host_strings(user, env.host, env.port) user1 = 'root' user2 = USER with settings(hide('everything'), password=None): # Connect as user1 (thus populating both the fallback and # user-specific caches) with settings( password_response(PASSWORDS[user1]), host_string=_to_user(user1) ): run("ls /simple") # Connect as user2: * First cxn attempt will use fallback cache, # which contains user1's password, and thus fail * Second cxn # attempt will prompt user, and succeed due to mocked p4p * but # will NOT overwrite fallback cache with settings( password_response(PASSWORDS[user2]), host_string=_to_user(user2) ): # Just to trigger connection run("ls /simple") # * Sudo call should use cached user2 password, NOT fallback cache, # and thus succeed. (I.e. p_f_p should NOT be called here.) with settings( password_response('whatever', times_called=0), host_string=_to_user(user2) ): sudo("ls /simple")
def copy(): # make sure the directory is there! sudo('mkdir -p /opt/local/codeflow') sudo('chown mbjerkness /opt/local/codeflow') # our local 'testdirectory' - it may contain files or subdirectories ... put('index.html', '/opt/local/codeflow/') put('media', '/opt/local/codeflow/')
def _git_clone(): with cd(env.projects_path): if not exists(join(env.code_root, '.git')): sudo('git clone %s' % env.repository, user=env.django_user) # pass else: _wrap_with(yellow)('Django source dir already exists. Not cloning repo!')
def _remove_config(): """Removes server configuration files""" print('\n\nRemoving server configuration...') sudo('rm -rf %(vhost_file)s' % env) run('rm -rf %(wsgi_file)s' % env) run('rm -rf %(project_settings_path)s/90-%(environment)s-local.conf' % env)
def apply_bundle(self, bundle, *args, **kwargs): uploaded = put(builder.build(bundle), '~/payload.pex', mode=755) if uploaded.failed: utils.error("Could not upload fuselange bundle to target. Aborting.") return command = [uploaded[0]] if kwargs.get("simulate", "false").lower() in ("true", "y", "yes", "on", "1"): command.append("--simulate") if "loglevel" in kwargs: if kwargs['loglevel'].lower() not in ("info", "debug", ): utils.error("Invalid loglevel") return command.extend(["-v"] * {"info": 0, "debug": 1}[kwargs['loglevel'].lower()]) try: with settings(warn_only=True): result = sudo(" ".join(command)) if not result.return_code in (0, 254): utils.error("Could not apply fuselage blueprint. Aborting.") return finally: sudo("rm %s" % uploaded[0])
def fix_solr(): """ Fix solr work in progress """ with cd('/var/tmp'): print blue('pulling new code...') sudo('/etc/init.d/jetty stop') sleep(5) # run('rm -rf /opt/deploy/solr/collection1') print blue('copying new code...') # run('mkdir -p /opt/deploy/solr/collection1') # run("cp -r oclapi/solr/collection1/conf /opt/deploy/solr/collection1") with cd("/opt/deploy/ocl_api/ocl"): # there is no need for this, settings.py.eploy is actually wrong? # run("cp settings.py.deploy settings.py") with prefix('source /opt/virtualenvs/ocl_api/bin/activate'): with prefix('export DJANGO_CONFIGURATION="Production"'): with prefix('export DJANGO_SECRET_KEY="blah"'): # this is really slow because it pull down django-norel run('./manage.py build_solr_schema > ' + '/opt/deploy/solr/collection1/conf/schema.xml') sleep(5) sudo('/etc/init.d/jetty start')
def test_systemd_config_changes(self): self.is_ubuntu_18 = True if self.bundle_type == 'remote_jar': state.env.user = '******' state.env.password = '******' state.env.host_string = 'localhost:2223' self.do_deploy(host='stage') pre_config_status = operations.run("ps aux | grep {0} | grep verbose | grep -v grep".format(self.service_name), warn_only=True) self.assertTrue(pre_config_status.failed) # Emulate chef change to systemd config operations.sudo( "sed -i 's/\/usr\/bin\/java -jar/\/usr\/bin\/java -verbose -jar/;' /etc/systemd/system/{0}.service".format( self.service_name) ) # Have to reload systemd when source config changes on disk reload = operations.sudo("systemctl daemon-reload") self.assertTrue(reload.succeeded) self.do_deploy(host='stage') config_status = operations.run("ps aux | grep {0} | grep verbose | grep -v grep".format(self.service_name), warn_only=True) self.assertTrue(config_status.succeeded) else: pass
def rebuild_index(): """ Rebuild search index """ with prefix("source /opt/virtualenvs/ocl_api/bin/activate"): with prefix('export DJANGO_CONFIGURATION="Production"'): sudo('/etc/init.d/jetty restart') sleep(5) run("/opt/deploy/ocl_api/ocl/manage.py rebuild_index")
def full_restart(): """ Restart everything """ sudo('/etc/init.d/apache2 stop') sudo('/etc/init.d/nginx restart') sudo('/etc/init.d/supervisor restart') sudo('/etc/init.d/mongod restart') sudo('/etc/init.d/jetty restart')
def bind10 (host, cmd): """ Start/kill bind10 """ with settings(host_string=host, user=USERNAME, password=PASSWORD): with hide('running', 'stdout', 'stderr'): sudo(cmd, pty=True)
def docker_restart(service, should_recreate=False): with cd("myapp"): if should_recreate: docker_start(service, should_recreate=True) sudo("docker-compose up -d {0}".format(service)) else: sudo("docker-compose restart {0}".format(service))
def fetch(): """ --> [REMOTE] Align DB/migrations/media from target """ with ensure_target(): from importlib import import_module settings_remote = import_module(name='%s.%s' % (settings.SETTINGS_PATH, env.target_stage)) db_remote = settings_remote.DATABASES['default'] media_dirname = os.path.split(settings.MEDIA_ROOT)[-1] print local('rsync --delete -azvvo ' '--exclude documenti ' # TODO '--exclude documenti_store ' # TODO '--exclude referenza_datafeed ' # TODO '--exclude CACHE ' '-e "%s" %s:/srv/www/%s/%s/ %s/' % (get_ssh_command(), env.host_string, settings.PROJECT_NAME, media_dirname, media_dirname)) with cd('/srv/www/%s/' % settings.PROJECT_NAME): print run('pg_dump --username=%s --host=%s -Fc %s > temp.dump' \ % (db_remote['USER'], db_remote['HOST'], db_remote['NAME'])) print local('scp -P %s -i %s -r -q %s:%s/temp.dump .' % (env.port, env.key_filename, env.host_string, settings.PROJECT_NAME)) print sudo('rm -f temp.dump') print drop() print create() print restore('temp.dump') print local('rm temp.dump')
def headless(): # How do I enable the "multiverse" repository? # http://askubuntu.com/questions/89096/how-do-i-enable-the-multiverse-repository sudo('sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list') timezone() execute(ntpd) require_deb_packages( ''' sudo screen htop nmap iotop mc ssh nano cpuid curl wget nfs-kernel-server nfs-common ''') require.directory('bin') require.file('.profile', contents=cfg('profile.conf'))
def do(*args, **kwargs): use_sudo = kwargs.pop('use_sudo', env.use_sudo) if use_sudo: sudo(*args, **kwargs) else: run(*args, **kwargs)
def run_chmod(self, project_slug, developer): sudo('chown -R {user}:{group} {project}'.format( user=developer, group=env.DEVELOPERS_USERGROUP, project=project_slug) ) sudo('chmod -R 755 {project}'.format(user=developer, project=project_slug))
def setup_ufw_rules(): """ Setup ufw app rules from application templates and settings UFW_RULES """ #current rules current_rules = server_state('ufw_rules') if current_rules: current_rules = set(current_rules) else: current_rules = set([]) role = env.role_lookup[env.host_string] firewall_rules = set(env.firewall_rules[role]) if not env.overwrite and firewall_rules == current_rules: return if env.verbosity: print 'CONFIGURING FIREWALL' delete_rules = current_rules - firewall_rules for rule in delete_rules: with settings(warn_only=True): if env.verbosity: print 'ufw delete', rule sudo('ufw delete %s'% rule) new_rules = firewall_rules - current_rules for rule in new_rules: with settings(warn_only=True): if env.verbosity: print 'ufw', rule sudo('ufw %s'% rule) set_server_state('ufw_rules',list(firewall_rules)) output = sudo('ufw reload') if env.verbosity: print output
def install_python_dependencies(instance, upgrade=False): dirname = "/srv/www/%s" % instance cmd = 'source {basepath}/virtualenv/bin/activate && pip\ install {upgrade}-r {basepath}/htdocs/maproulette/requirements.txt'.format( basepath=dirname, upgrade='--upgrade' if upgrade else '') sudo(cmd, user="******")
def _fix_perms(folder): """ Fixe permissions for a specified folder: $ chgrp authorized-group some-folder $ chmod -R g+w,o-rwx some-folder """ sudo('chgrp -R {} {}'.format(env.server_group, folder)) sudo('chmod -R g+sw,o-rwx {}'.format(folder))
def reboot(): sudo('reboot')
def setup_cron(): echo('# Setup cron') crontab_path = path.join(config.config_path, 'crontab.txt') upload('crontab.txt', crontab_path) sudo('crontab {0}'.format(crontab_path), user=config.user)
def install_python(): echo('# Install python') ver = config.python_version ver_path = path.join(config.python_home, ver) arch_path = path.join(config.python_home, 'Python-{0}.tar.xz'.format(ver)) mkdir(config.python_home) if not exists(ver_path) or exists(arch_path): with cd(config.python_home): sudo( 'wget --no-verbose https://www.python.org/ftp/python/{0}/Python-{0}.tar.xz' .format(ver)) with hide('stdout'): sudo('tar xJf Python-{0}.tar.xz'.format(ver)) with cd(path.join(config.python_home, 'Python-{0}'.format(ver))): sudo('./configure --prefix={0}'.format(ver_path)) sudo('make && sudo make install') sudo('rm -rf Python-{0}'.format(ver)) sudo('rm -rf Python-{0}.tar.xz'.format(ver))
def deploy(confs, remote_dir): _LOGGER.info("Deploying configurations for " + str(confs.keys())) sudo("mkdir -p " + remote_dir) for name, content in confs.iteritems(): write_to_remote_file(content, os.path.join(remote_dir, name))
def write_to_remote_file(text, filename): sudo("echo '%s' > %s" % (escape_single_quotes(text), filename))
def tomcat_shutdown(self, verbose=False): """ shut down tomcat instance. """ sudo('service tomcat7 stop', pty=True)
def tomcat_startup(self, verbose=False): """ startup tomcat instance. """ sudo('service tomcat7 restart', pty=True)
def install_ambari_agents(): apt_update() sudo('apt-get install -y ambari-agent')
def apt_upgrade(): sudo('apt-get -qy upgrade')
def start_ntp(): sudo('service ntp restart')
def apt_clean(): sudo('sudo dpkg --configure -a')
def install_ntp(): sudo('apt-get install -y ntp') start_ntp
def ambari_status(): sudo('ambari-server status')
def apt_update(): sudo('apt-get update')
def install_ambari_server(): sudo('apt-get install -qy ambari-server') sudo('ambari-server setup --silent') stop_firewall() install_ntp()
def ambari_restart(): sudo('ambari-server restart')
def insvsftpd(): """ 安装 vsftpd """ # 更新配置文件 run('cd %s && git pull' % repo_folder) # 安装 sudo('yum install -y vsftpd') # 复制、更新配置文件 sudo('cp -rf /home/bpzj/linux.conf/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf') sudo('cp -rf /home/bpzj/linux.conf/vsftpd/vsftpd.chroot_list /etc/vsftpd/vsftpd.chroot_list') # 重启服务 sudo('service vsftpd restart') # 新建ftp文件夹 sudo('mkdir /home/bpzj/ftp') # 新建这个文件夹 sudo('mkdir /var/run/vsftpd') sudo('mkdir /var/run/vsftpd/empty')
def ambari_start(): sudo('ambari-server start')
def insss(): """ 安装shadowsshocks """ sudo('pip install shadowsocks') sudo('cp -rf /home/bpzj/linux.conf/shadowsocks/shadowsocks.json /etc/shadowsocks.json') sudo('ssserver -c /etc/shadowsocks.json -d start')
def init(): put('ambari.list', '/etc/apt/sources.list.d/', use_sudo=True) sudo( 'apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD' ) apt_update()
def insgit(): # 安装ftp sudo('yum install git')
def centinsmysql5720(): """ 安装 mysql5.7.20 """ # # 更新配置文件 run('cd %s && git pull' % repo_folder) # 下载 mysql 源安装包 run('curl -LO http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm') # 安装 mysql 源 sudo('yum localinstall mysql57-community-release-el7-11.noarch.rpm') # 检查 yum 源是否安装成功 # sudo("""yum repolist enabled | grep "mysql.*-community.*"""") # 安装 sudo('yum install mysql-community-server') # 复制配置文件 sudo('cp -rf /home/bpzj/linux.conf/mysql/my.cnf /etc/my.cnf') # 安装服务 sudo('systemctl enable mysqld') # 启动服务 sudo('systemctl start mysqld') # 重新启动 sudo('systemctl restart mysqld')
def _rubix_op(cls, args): sudo("cp -a /usr/lib/rubix/lib/* /usr/lib/presto/plugin/hive-hadoop2/") sudo("cp -a /usr/lib/rubix/lib/* /usr/lib/hadoop/lib/") sudo("mkdir -p /mnt/rubix/") sudo("mkdir -p /var/lib/rubix/cache") with settings(warn_only=True): sudo("ln -s /var/lib/rubix/cache /mnt/rubix/") count = 0 while count < 5: sudo("mkdir -p /var/lib/rubix/cache/data%s" % count) count += 1 sudo("mkdir -p /etc/presto/conf/catalog") sudo("chmod +x /usr/lib/rubix/bin/configure.sh") sudo("/usr/lib/rubix/bin/configure.sh") sudo("restart presto-server")
def inspip2(): # 安装pip ( python2.7 的 pip ) sudo('yum install python-setuptools') sudo('easy_install pip')
def _reload_supervisorctl(): sudo('%(supervisorctl)s reread' % env)
def instomcat(): """安装Tomcat 8.0 """ # 更新配置文件 run('cd %s && git pull' % repo_folder) # 下载 tomcat sudo('wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.0.49/bin/apache-tomcat-8.0.49.tar.gz') # 删除原有的tomcat sudo('rm -rf /usr/local/tomcat') # 解压 sudo('tar -xvzf apache-tomcat-8.0.49.tar.gz') # 注意这个mv命令,直接重名了,要保证local文件下没有tomcat才能重命名 # 所以上面删除了原有的 tomcat 文件夹 sudo('mv /home/bpzj/apache-tomcat-8.0.49 /usr/local/tomcat') # 复制配置文件:profile、setenv.sh、catalina.sh、tomcat.service sudo('cp -rf /home/bpzj/linux.conf/profile /etc/profile') sudo('cp -rf /home/bpzj/linux.conf/tomcat/8.0.48-catalina/catalina.sh /usr/local/tomcat/bin/catalina.sh') # 配置环境变量,这一句执行不成功,暂时未解决 run('source /etc/profile', pty=False) # 更新 catalina.sh 配置文件 sudo('/usr/local/tomcat/bin/startup.sh', pty=False)
def _git_clone(): sudo('git clone %s %s' % (env.repository, env.code_root))
def _prepare_media_path(): path = env.django_media_path.rstrip('/') sudo('mkdir -p %s' % path) sudo('chmod -R 775 %s' % path)
def _hg_clone(): sudo('hg clone %s %s' % (env.repository, env.code_root))
def _reload_nginx(): sudo('nginx -s reload')