Beispiel #1
0
    def setup(self, operator):

        if self.monitor_server:
            operator.setup_file_from_string('deb http://apt.newrelic.com/debian/ newrelic non-free',
                                            '/etc/apt/sources.list.d/newrelic.list',
                                            owner='root', mode='644')

            sudo('wget -O- http://download.newrelic.com/548C16BF.gpg | apt-key add -')
            # sudo('aptitude update')
            operator.setup_packages(packages=['newrelic-sysmond'])
            sudo('nrsysmond-config --set license_key=%(license_key)s' % {'license_key': self.license_key})


        for project in self.projects:

            username = project['user']

            Python.install_packages(operator, username, ['newrelic'])

            context = {'username': username,
                       'app_name': project['app_name'],
                       'license_key': self.license_key}

            with cd('/home/%(username)s' % {'username': username}):
                operator.setup_template_file('newrelic/newrelic.ini', './conf/newrelic.ini', owner=username, mode='640', context=context)
Beispiel #2
0
 def __init__(self, license_key, monitor_server=True, projects=[], before=[], after=[]):
     _after = ['user']
     for project in projects:
         _after.append(Python.get_uuid(username=project['user']))
     super(Newrelic, self).__init__(before=before, after=after + _after)
     self.license_key = license_key
     self.projects = projects
     self.monitor_server = monitor_server
Beispiel #3
0
    def __init__(self, username,
                 static_data_version,
                 project_name,
                 domain_name,
                 apache_workers,
                 newrelic=False,
                 admins=[],
                 presetup_operations=(),
                 postsetup_operations=(),
                 postopen_operations=(),
                 before=[],
                 after=[],
                 ssl=False,
                 www_redirect=True,
                 nginx_access_log=False,
                 nginx_error_log=True,
                 apache_access_log=False,
                 apache_error_log=True):
        _after = ['apache', 'nginx', 'user', Python.get_uuid(username=username)]
        super(DjangoProject, self).__init__(before=before, after=after + _after)
        self.username = username
        self.static_data_version = static_data_version
        self.project_name = project_name
        self.presetup_operations = presetup_operations
        self.postsetup_operations = postsetup_operations
        self.postopen_operations = postopen_operations
        self.domain_name = domain_name
        self.admins = admins
        self.newrelic = newrelic
        self.www_redirect = www_redirect
        self.ssl = ssl
        self.apache_workers = apache_workers

        self.nginx_access_log = nginx_access_log
        self.nginx_error_log = nginx_error_log
        self.apache_access_log = apache_access_log
        self.apache_error_log = apache_error_log

        self.state_before_setup = {}