Exemplo n.º 1
0
    def install_graphite_web(self):
        data = self.data

        Package('pycairo').install()
        Package('cairo-devel').install()
        Package('bitmap-fonts-compat').install()
        Package('httpd').install()
        Package('mod_wsgi').install()
        Package('MySQL-python').install()

        python.setup()
        sudo('pip install django==1.6.8')
        python.install_from_git('graphite-web',
                                'https://github.com/graphite-project/graphite-web.git')

        log_dir = '/opt/graphite/storage/log/webapp/'
        owner = '{0[user]}:{0[group]}'.format(data)
        filer.mkdir(log_dir, owner=owner)
        log_files = ['access.log', 'error.log', 'exception.log', 'info.log']
        for log_file in log_files:
            log_file = os.path.join(log_dir, log_file)
            filer.touch(log_file, owner=owner)

        manage_py = os.path.join(conf.REMOTE_TMP_DIR, 'git/graphite-web.git/webapp/manage.py')
        sudo('cp {0} /opt/graphite/webapp/'.format(manage_py))

        is_updated = filer.template('/opt/graphite/webapp/graphite/local_settings.py',
                                    data=data)

        is_updated = filer.template('/opt/graphite/webapp/graphite/settings.py',
                                    data=data) or is_updated

        is_updated = filer.template('/opt/graphite/conf/graphite.wsgi') or is_updated

        is_updated = filer.template('/etc/httpd/conf.d/graphite-vhost.conf', data={
            'user': data['user'],
            'group': data['group'],
        }) or is_updated

        return is_updated
Exemplo n.º 2
0
 def setup(self):
     python.setup()
     python.install_from_git("ceres", "https://github.com/graphite-project/ceres.git")
Exemplo n.º 3
0
    def install_carbon(self):
        data = self.data
        python.setup()
        python.install_from_git("carbon", "https://github.com/graphite-project/carbon.git -b megacarbon")

        graphite_dir = "/opt/graphite"
        storage_dir = os.path.join(graphite_dir, "storage")
        storage_files = os.path.join(storage_dir, "*")
        sudo("chown {0}:{1} {2}".format(data["user"], data["group"], storage_dir))
        sudo("chown {0}:{1} {2}".format(data["user"], data["group"], storage_files))

        daemons_dir = "/opt/graphite/conf/carbon-daemons/"
        daemon_confs = [
            "daemon.conf",
            "relay.conf",
            "aggregation.conf",
            "amqp.conf",
            "filter-rules.conf",
            "relay.conf",
            "storage-rules.conf",
            "aggregation-filters.conf",
            "daemon.conf",
            "listeners.conf",
            "relay-rules.conf",
            "writer.conf",
            "aggregation-rules.conf",
            "db.conf",
            "management.conf",
            "rewrite-rules.conf",
        ]

        is_updated = False
        for name, daemon in data["daemons"].items():
            daemon_dir = os.path.join(daemons_dir, name)
            filer.mkdir(daemon_dir)

            for daemon_conf in daemon_confs:
                is_updated = (
                    filer.template(
                        os.path.join(daemon_dir, daemon_conf),
                        data={"user": data["user"], "daemon": daemon},
                        src_target=daemon_conf,
                    )
                    or is_updated
                )

            is_updated = (
                filer.template(
                    "/etc/init.d/carbon-{0}".format(name),
                    "755",
                    data={
                        "description": "Carbon Daemon: {0}".format(name),
                        "name": name,
                        "user": data["user"],
                        "exec": os.path.join(graphite_dir, "bin/carbon-daemon.py"),
                        "initscript": data["initscript"],
                    },
                    src_target="carbon-initscript",
                )
                or is_updated
            )

        return is_updated