def bootstrap(self, force=False): super(PylonsUwsgiDeployment, self).bootstrap(force) #uwsgi was installed in UWSGIDeployment, so we can proceed to installing pylons virtualenv( self.get_config_value('virtualenv/path'), "pip install Pylons" )
def bootstrap(self, force=False): vassals_dir = self.get_config_value('uwsgi/vassals_dir') uwsgi_dir = self.get_config_value('uwsgi/workdir') virtualenv_dir = self.get_config_value('uwsgi/env') virtualenv_bin = self.get_config_value('virtualenv/bin', 'virtualenv') if not exists(virtualenv_dir) or force: run("%s %s" % (virtualenv_bin, virtualenv_dir)) virtualenv(virtualenv_dir, "pip install uwsgi") for p in (uwsgi_dir, vassals_dir): if not exists(p) or force: run('mkdir %s' % p)
def start(deployment): #we need to check whether uwsgi is started in emperor mode or not. emperor = deployment.get_config_value('uwsgi/emperor', True) uwsgi_dir = deployment.get_config_value('uwsgi/workdir') vassal = deployment.vassal if emperor: #in emperor mode, we create the vassal file. vassals_dir = deployment.get_config_value('uwsgi/vassals_dir') if not exists(vassals_dir): run("mkdir -p %s" % vassals_dir) with cd(vassals_dir): if not exists(vassal[0]): if vassal[1]: run("ln -s %s %s" % (vassal[1], vassal[0])) else: scp( deployment.get_config_value('uwsgi/launcher'), vassals_dir + "/" + vassal[0] ) if not is_running(deployment): #let's start main uwsgi instance. virtualenv( deployment.get_config_value('virtualenv/path'), "LANG=pl_PL.UTF-8 LC_ALL=pl_PL.UTF-8 uwsgi --master \ --emperor %(vassals)s --daemonize %(log)s --pidfile %(pid)s --fastrouter %(sock)s \ --fastrouter-subscription-server 127.0.0.1:3032" % { "log": uwsgi_dir + "/uwsgi.log", "pid": uwsgi_dir + "/uwsgi.pid", "vassals": vassals_dir, "sock": uwsgi_dir + "/uwsgi.sock" } ) else: #not emperor mode - start uwsgi process. virtualenv( deployment.get_config_value('virtualenv/path'), "LANG=pl_PL.UTF-8 LC_ALL=pl_PL.UTF-8 uwsgi \ --daemonize %(log)s --pidfile %(pid)s --socket %(sock)s %(def)s" % { "log": project_path + "/uwsgi.log", "pid": project_path + "/uwsgi.pid", "def": vassal[1], "sock": project_path + "/uwsgi.sock" } )