#!/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='database') # class Database(<): # def create(self): # host = settings.DATABASES['default'] # # Создаём группу безопасности # security_group = self._ec2_mysql_security_group() # # Создаём группу параметров # # Запускаем инстанс # self._rds_create_instance( # 'database', # host['NAME'], # host['USER'], # host['PASSWORD']) @map_roles(host='web') class Application(DjangoDeployment): def configure_base(self): self._configure_instance(tasks.common_configure) def hello(self): self.hosts.run('echo hello world') def update(self): self.checkout() self.pull() 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): self.Application.hello() # Если созданы — удалить # # Предварительно спросить # self.Frontend.create() # self.Engine.create() def deploy(self): pass # self.Application.update() # self.Application.python_packages_install() # self.update_hosts() # self.Engine.migrate() # self.Frontend.restart() # self.Engine.restart()