def setup(self, config_file=None): puts('Add Gunicorn init script') if not config_file: config_file = os.path.join(scripts.__path__[0], 'gunicorn_django_server') files.upload_template(filename=config_file, destination="/etc/init.d/gunicorn_django", use_sudo=True) sudo('chmod +x /etc/init.d/gunicorn_django') self.nginx.setup_server()
def setup_server(self, config_file=None): puts('installing NGINX') if not config_file: config_file = os.path.join(scripts.__path__[0], 'nginx_server.conf') install_packages([ 'nginx', ]) puts('adding base HTTP Server config files') files.upload_template(filename=config_file, destination="/etc/nginx/nginx.conf", use_sudo=True)
def setup(self): puts("setup new project") server_upgrade() self.install_pil() install_packages( self.extra_packages + [ 'git-core', 'curl', ] )
def deploy(self): if not files.exists('/usr/bin/git'): puts('new fresh server :D', m_type='warn') self.setup() puts("deploying your project") self.create_folder() self.create_python_enviroment() self.upload() self.install_pip_dependancies() self.django.deploy()
def deploy(self, config_file=None): puts('transferring gunicorn configurarion and restart') if not config_file: config_file = os.path.join(scripts.__path__[0], 'gunicorn_django_site') files.upload_template(filename=config_file, destination="/etc/default/gunicorn_django-%s" % env.project_name, context=env, use_sudo=True) sudo('/etc/init.d/gunicorn_django restart %s' % env.project_name, pty=False) self.nginx.setup_site()
def setup_site(self, config_file=None): puts('adding HTTP Server config files for project') if not config_file: config_file = os.path.join(scripts.__path__[0], 'nginx_site.conf') sudo("rm -f /etc/nginx/sites-enabled/%s" % env.project_name) files.upload_template(filename=config_file, destination="/etc/nginx/sites-enabled/%s.conf" % env.project_name, context=env, use_sudo=True) restart_service('nginx')
def deploy(self, config_file=None): if not files.exists('/etc/init.d/gunicorn'): puts('gunicorn init script not found, running setup', m_type='warn') self.setup() puts('transferring gunicorn configurarion and restart') if not config_file: config_file = os.path.join(scripts.__path__[0], 'gunicorn_project.conf') files.upload_template(filename=config_file, destination="/etc/gunicorn.d/%s" % env.project_name, context=env, backup=False, use_sudo=True) restart_service('gunicorn') self.nginx.setup_site()
def setup_site(self, config_file=None): if not files.exists('/etc/init.d/nginx'): puts('nginx not found, running setup', m_type='warn') self.setup_server() puts('adding HTTP Server config files for project') if not config_file: config_file = os.path.join(scripts.__path__[0], 'nginx_site.conf') sudo("rm -f /etc/nginx/sites-enabled/%s" % env.project_name) files.upload_template(filename=config_file, destination="/etc/nginx/sites-enabled/%s.conf" % env.project_name, context=env, use_sudo=True) restart_service('nginx')
def collect_static(self): puts("Collecting static files") run('{0}/bin/python {1}/manage.py collectstatic --noinput'.format(env.remote_virtualenv_path, env.remote_current_path))
def deploy(self): puts("Deploying Project...") self.collect_static() self.gunicorn.deploy()
def setup(self): puts("setup new project...") server_upgrade() install_packages(["git-core"]) self.django.setup() self.deploy()
def setup(self): puts('Installing Gunicorn') install_packages([ 'gunicorn=0.13.4-1', ])
def deploy(self): puts("running django deploy") self.collect_static() self.gunicorn.deploy()