misterdoak / sauron

Drupal monitoring
8 stars 1 forks source link

/!\ Sauron v2 developpment is launch see https://github.com/drupal-sauron/monitoring /!\

Sauron logo Sauron

  • You are a Drupal developer and you need to be aware of modules and core updates? Sauron can help you!

  • You maintain a bunch of Drupal Web sites and need to get updates reports? Sauron can help you!

  • You only have the source code of a Drupal project and need to get a summary of modules and core version? Sauron can help you!

  • ...

About

Sauron is a python 2.7 application built on top of Fabric framework. It provides a few tasks to deal with Drupal :

Example of HTML report

Capture-1

Install

On Debian based distribution

#>sudo aptitude install python2.7 python2.7-dev python-pip build-essential
#>sudo pip install fabric pyyaml requests HTML.py
#>git clone git@github.com:misterdoak/sauron.git

After installing Sauron, you need to copy main settings file : config/sauron_example.yml into config/sauron.yml and then edit it.

{
    "administrator": {
        "mail": "<sender email reports>",
        "mail_signature": {
            "html": "<em>-- This email is automatically generated by sauron.<em>",
            "text": "This email is automatically generated by sauron."
        }
        "mail_server": "localhost"
    },
    "application": {
        "projects_path": "<path where projects files are stored>",
        "sandbox_path": "<path where projects are checkout>",
        "report_path": "<path where reports will be stored>"
    }
}

The mail_server is optional. Its default value is localhost. You can specify the address of any SMTP server or the path to your sendmail binary if you want to use it instead of an SMTP server.

Using Sauron for your project(s)

For each project, you will need to create a .yml file. This contains information about your project :

For example :

{
    "project": "My project",
    "mail": ["<email>"],

    "vcs": {
        "type": "svn",
        "url": "https://github.com/misterdoak/sauron/trunk",
        "extra_args": ""
    },

    "drupal": {
        "drupal_root": "examples/no_makefile/drupal-7.32",
        "contrib_paths": ["sites/all/modules/contrib"],
        "dev_paths": ["sites/all/themes/custom"],
        "code_style":{
          "phpcs_standard":"/home/almor/phpqa/codesniffer/Drupal",
          "phpmd_rules_file":"/home/almor/phpqa/phpmd/phpmd.xml",
        }
    }
}

Here is an example of a git project using a makefile :


{
        "project": "My project",
        "mail": ["<email>"],

        "vcs": {
            "type": "git",
            "url": "git@github.com:misterdoak/sauron.git",
            "extra_args": "-b master"
        },

        "drupal": {
            "drupal_makefile": "examples/makefile/sauron.make"
        }
}

Launch tasks

Tasks must be launched through Fabric fab command in the same folder of fabfile.py.

List available tasks

#>fab -l
Available commands:

    code_style.check_codestyle  Check code style via PHPMess Detector and PHP...
    settings.load_settings      Load main settings and given project specific...
    update.check_update         Check contrib modules and core updates from s...
    versionning.checkout        Checkout project sources according to vcs con...

Launch Drupal updates check

#>fab settings.load_settings:project=myproject_git versionning.checkout update.check_update:send_mail=True

Launch Drupal code style check

#>fab settings.load_settings:project=myproject_git versionning.checkout code_style.check_codestyle:email=True

Schedule Drupal updates check every Thursday morning

Security issues are published every Wednesday, you can check every Thursday, early in the morning, modules updates availability. To do that, edit your crontab :

0 1 * * 4 <user> cd /path/to/sauron && fab settings.load_settings:project=myproject_git versionning.checkout update.check_update:send_mail=True > /dev/null 2>&1

Roadmap