def install(self): AppBackend.install(self) parms = self.get_parmameters() self.script.add_cmd("cd; %(virtualenv_cmd)s %(home)s/venv" % parms, user=self.get_user()) self.script.add_cmd("tee -a %(home)s/.bashrc" % parms, user=self.get_user(), stdin="\n\nsource ~/venv/bin/activate") self.script.add_file("%(home)s/requirements.txt" % parms, "gunicorn\n" + parms.get("virtualenv"), owner="%(user)s:%(group)s" % parms) self.script.add_cmd("%(home)s/venv/bin/pip install -r %(home)s/requirements.txt" % parms, user=self.get_user())
def update(self): AppBackend.update(self) parms = self.get_parmameters() self.script.add_file("%(home)s/requirements.txt" % parms, "gunicorn\n" + parms.get("virtualenv"), owner="%(user)s:%(group)s" % parms) self.script.add_file("%(home)s/app/app.py" % parms, parms.get("script"), owner="%(user)s:%(group)s" % parms) self.script.add_file("/etc/supervisor/apps.d/%(user)s.conf" % parms, self.gen_supervisor_config()) self.script.add_file("/etc/nginx/apps.d/%(user)s.conf" % parms, self.gen_nginx_config()) self.script.add_cmd("supervisorctl reread") self.script.add_cmd("supervisorctl update") self.script.add_cmd("sleep 6") self.script.reload_nginx()
def install(self): AppBackend.install(self) parms = self.get_parmameters() self.script.add_cmd("cd; %(virtualenv_cmd)s %(home)s/venv" % parms, user=self.get_user()) self.script.add_cmd("tee -a %(home)s/.bashrc" % parms, user=self.get_user(), stdin="\n\nsource ~/venv/bin/activate") self.script.add_file("%(home)s/requirements.txt" % parms, "gunicorn\n" + parms.get("virtualenv"), owner="%(user)s:%(group)s" % parms) self.script.add_cmd( "%(home)s/venv/bin/pip install -r %(home)s/requirements.txt" % parms, user=self.get_user())