You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
1.7 KiB

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# from django.db import connection
from deployer.node import Node, map_roles
from deployer.utils import esc1
from app.deploy.service import *
from app.deploy.django import *
import app.deploy.tasks as tasks
import os.path
from app import settings
class ZuykovWebSystem(Node):
"""
The base definition of our web system.
roles: web, engine, database
"""
@map_roles(host='web')
class Application(DjangoDeployment):
def configure_base(self):
self._configure_instance(tasks.common_configure)
self._configure_instance(tasks.web_configure)
def restart(self):
self._configure_instance(tasks.reload_nginx + tasks.reload_uwsgi)
def update(self):
self.checkout()
self.pull()
def collect_static(self):
self.run_management_command('collectstatic --noinput')
def checkout(self, commit="."):
with self.hosts.cd(settings.PROJECT_DIR, expand=True):
self.hosts.run("git checkout '%s'" % esc1(commit))
def pull(self):
with self.hosts.cd(settings.PROJECT_DIR, expand=True):
self.hosts.run('git pull')
def create(self):
# Если созданы — удалить
# TODO: Предварительно спросить
self.Frontend.create()
self.Engine.create()
def deploy(self):
self.Application.update()
self.Application.python_packages_install()
self.Application.collect_static()
self.Application.restart()
def update(self):
self.Application.update()
self.Application.collect_static()
self.Application.restart()