def create_configuration(self, config): sup = SupervisorConfig(path="/etc/supervisor/supervisord.conf") sup.load() for p in sup.tree.programs: if p.command.startswith("puma") or p.command.startswith("bundle exec puma"): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == "ruby-puma": self.__generate_website(website) p = ProgramData() p.name = location.backend.id bundler = location.backend.params.get("bundler", True) workers = location.backend.params.get("workers", 4) environment = location.backend.params.get("environment", 4) p.command = "puma -e %s -t %i -b unix:///var/run/puma-%s.sock" % ( environment, workers, location.backend.id, ) if bundler: p.command = "bundle exec " + p.command p.environment = 'HOME="%s"' % website.root p.directory = website.root sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command.startswith('puma') or p.command.startswith('bundle exec puma'): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'ruby-puma': self.checks.append(PumaServerTest(location.backend)) p = ProgramData() p.name = location.backend.id bundler = location.backend.params.get('bundler', True) workers = location.backend.params.get('workers', 4) environment = location.backend.params.get('environment', 4) p.command = 'puma -e %s -t %i -b unix:///var/run/puma-%s.sock' % ( environment, workers or 4, location.backend.id ) if bundler: p.command = 'bundle exec ' + p.command p.environment = 'HOME="%s"' % website.root p.directory = website.root sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command.startswith('puma') or p.command.startswith( 'bundle exec puma'): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'ruby-puma': self.__generate_website(website) p = ProgramData() p.name = location.backend.id bundler = location.backend.params.get('bundler', True) workers = location.backend.params.get('workers', 4) environment = location.backend.params.get( 'environment', 4) p.command = 'puma -e %s -t %i -b unix:///var/run/puma-%s.sock' % ( environment, workers, location.backend.id) if bundler: p.command = 'bundle exec ' + p.command p.environment = 'HOME="%s"' % website.root p.directory = website.root sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] node_bin = 'node' try: subprocess.call(['which', 'node']) except: node_bin = 'nodejs' sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command and p.command.startswith('node '): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'nodejs': self.checks.append(NodeServerTest(location.backend)) p = ProgramData() p.name = location.backend.id command = location.backend.params.get('script', None) if command.find("npm ") == -1: command = '%s %s' % (node_bin, location.backend.params.get( 'script', None) or '.') p.user = location.backend.params.get( 'user', None) or 'www-data' p.directory = location.path or website.root p.environment = location.backend.params.get( 'environment', None) or '' virtualenv = location.backend.params.get('venv', None) if virtualenv: p.environment = '; '.join([ p.environment, 'PATH="%s:%s"' % (os.path.join( virtualenv, 'bin'), os.environ['PATH']) ]) p.command = os.path.join(virtualenv, 'bin') + '/' + command else: p.command = command sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] node_bin = 'node' try: subprocess.call(['which', 'node']) except: node_bin = 'nodejs' sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command and p.command.startswith('node '): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'nodejs': self.checks.append(NodeServerTest(location.backend)) p = ProgramData() p.name = location.backend.id command = location.backend.params.get('script', None) if command.find("npm ") == -1 : command = '%s %s' % ( node_bin, location.backend.params.get('script', None) or '.' ) p.user = location.backend.params.get('user', None) or 'www-data' p.directory = location.path or website.root p.environment = location.backend.params.get('environment', None) or '' virtualenv = location.backend.params.get('venv', None) if virtualenv: p.environment = '; '.join([p.environment, 'PATH="%s:%s"' % (os.path.join(virtualenv, 'bin'), os.environ['PATH'])]) p.command = os.path.join(virtualenv, 'bin') + '/' + command else: p.command = command sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in list(sup.tree.programs): if p.comment and p.comment == self.COMMENT: sup.tree.programs.remove(p) for website in config.websites: if website.enabled: cfg = website.extension_configs.get(ProcessesExtension.classname) or {} for process in cfg.get('processes', []): p = ProgramData() p.comment = self.COMMENT p.name = '%s-%s' % (website.slug, process['name']) p.command = process['command'] p.environment = process['environment'] p.directory = process['directory'] or website.root p.user = process['user'] or 'www-data' p.stopasgroup = True p.killasgroup = True sup.tree.programs.append(p) self.checks.append(ProcessTest(p.name)) sup.save()
def create_configuration(self, config): if os.path.exists(self.config_dir): shutil.rmtree(self.config_dir) os.mkdir(self.config_dir) sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command and p.command.startswith('unicorn'): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'ruby-unicorn': self.__generate_website(website) p = ProgramData() p.name = location.backend.id p.command = 'unicorn_rails -E production -c %s/%s.rb' % (self.config_dir, location.backend.id) sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command and p.command.startswith('node '): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: i = 0 for location in website.locations: if location.backend.type == 'nodejs': i += 1 location.backend.id = website.slug + '-nodejs-' + str( i) p = ProgramData() p.name = location.backend.id p.command = 'node %s' % location.backend.params.get( 'path', '/') sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] node_bin = 'node' try: subprocess.call(['which', 'node']) except: node_bin = 'nodejs' sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command and p.command.startswith('node '): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'nodejs': self.checks.append(NodeServerTest(location.backend)) p = ProgramData() p.name = location.backend.id p.command = '%s %s' % ( node_bin, location.backend.params.get('script', None) or '.' ) p.user = location.backend.params.get('user', None) or 'www-data' p.environment = location.backend.params.get('environment', None) or '' p.directory = location.path or website.root sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in list(sup.tree.programs): if p.comment and p.comment == self.COMMENT: sup.tree.programs.remove(p) for website in config.websites: if website.enabled: cfg = website.extension_configs.get( ProcessesExtension.classname) or {} for process in cfg.get('processes', []): p = ProgramData() p.comment = self.COMMENT p.name = '%s-%s' % (website.slug, process['name']) p.command = process['command'] p.environment = process['environment'] p.directory = process['directory'] or website.root p.user = process['user'] or 'www-data' p.stopasgroup = True p.killasgroup = True sup.tree.programs.append(p) self.checks.append(ProcessTest(p.name)) sup.save()
def create_configuration(self, config): self.checks = [] if os.path.exists(self.config_dir): shutil.rmtree(self.config_dir) os.mkdir(self.config_dir) for website in config.websites: if website.enabled: self.__generate_website(website) sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() COMMENT = 'Generated by Ajenti-V' for p in sup.tree.programs: if p.comment == COMMENT: sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'python-wsgi': self.checks.append(GUnicornServerTest( location.backend)) self.__generate_website(website) p = ProgramData() p.name = location.backend.id p.comment = COMMENT p.command = 'gunicorn -c %s/%s "%s"' % ( self.config_dir, location.backend.__config_name, location.backend.params['module']) p.directory = location.path or website.root virtualenv = location.backend.params.get('venv', None) if virtualenv: p.environment = 'PATH="%s:%s"' % (os.path.join( virtualenv, 'bin'), os.environ['PATH']) p.command = os.path.join(virtualenv, 'bin') + '/' + p.command sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] if os.path.exists(self.config_dir): shutil.rmtree(self.config_dir) os.mkdir(self.config_dir) for website in config.websites: if website.enabled: self.__generate_website(website) sup = SupervisorConfig( path=platform_select(debian="/etc/supervisor/supervisord.conf", centos="/etc/supervisord.conf") ) sup.load() COMMENT = "Generated by Ajenti-V" for p in sup.tree.programs: if p.comment == COMMENT: sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == "python-wsgi": self.checks.append(GUnicornServerTest(location.backend)) self.__generate_website(website) p = ProgramData() p.name = location.backend.id p.comment = COMMENT p.command = 'gunicorn -c %s/%s "%s"' % ( self.config_dir, location.backend.id, location.backend.params["module"], ) p.directory = location.path or website.root virtualenv = location.backend.params.get("venv", None) if virtualenv: p.environment = 'PATH="%s"' % os.path.join(virtualenv, "bin") p.command = os.path.join(virtualenv, "bin") + "/" + p.command sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] if os.path.exists(self.config_dir): shutil.rmtree(self.config_dir) os.mkdir(self.config_dir) for website in config.websites: if website.enabled: self.__generate_website(website) sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() COMMENT = 'Generated by Ajenti-V' for p in sup.tree.programs: if p.comment == COMMENT: sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'python-wsgi': self.checks.append(GUnicornServerTest(location.backend)) self.__generate_website(website) p = ProgramData() p.name = location.backend.id p.user = location.backend.params.get('user', None) or 'www-data' p.comment = COMMENT p.command = 'gunicorn -c %s/%s "%s"' % (self.config_dir, location.backend.__config_name, location.backend.params['module']) p.directory = location.path or website.root virtualenv = location.backend.params.get('venv', None) if virtualenv: p.environment = 'PATH="%s"' % os.path.join(virtualenv, 'bin') p.command = os.path.join(virtualenv, 'bin') + '/' + p.command sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): sup = SupervisorConfig(path='/etc/supervisor/supervisord.conf') sup.load() for p in sup.tree.programs: if p.command.startswith('node '): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: i = 0 for location in website.locations: if location.backend.type == 'nodejs': i += 1 location.backend.id = website.slug + '-nodejs-' + str(i) p = ProgramData() p.name = location.backend.id p.command = 'node %s' % location.backend.params.get('path', '/') sup.tree.programs.append(p) sup.save()
def create_configuration(self, config): self.checks = [] node_bin = 'node' try: subprocess.call(['which', 'node']) except: node_bin = 'nodejs' sup = SupervisorConfig(path=platform_select( debian='/etc/supervisor/supervisord.conf', centos='/etc/supervisord.conf', )) sup.load() for p in sup.tree.programs: if p.command and p.command.startswith('node '): sup.tree.programs.remove(p) for website in config.websites: if website.enabled: for location in website.locations: if location.backend.type == 'nodejs': self.checks.append(NodeServerTest(location.backend)) p = ProgramData() p.name = location.backend.id p.command = '%s %s' % (node_bin, location.backend.params.get( 'script', None) or '.') p.user = location.backend.params.get( 'user', None) or 'www-data' p.environment = location.backend.params.get( 'environment', None) or '' p.directory = location.path or website.root sup.tree.programs.append(p) sup.save()