1. Benoit C
  2. fabulator

Wiki

Clone wiki

fabulator / Home

fabulator

Fabulator provides a few fonctions, class, decorators and configuration to quickly write a fabfile.

Using mercurial, fabulator aims at deploying a django project onto your servers using fabric. For the moment, it supports debian (well, ubuntu), mysql, memcached, nginx, gunicorn.

You can specify a yaml configuration files depending on which kind of servers you're deploying your projects.

Examples

This, will install your project using fooproject.yaml. The install will clone your mercurial repos, create the database, install your vhost on nginx, restart nginx, restart memcached, start gunicorn.

$> fab prod:fooproject.yaml install

Here is the list of the supported tasks :

  • copy_vhost
  • delete_database
  • delete_repos
  • distro_
  • django_settings
  • install for the first install onto the machines
  • install_database
  • install_httpd_vhost
  • load_yaml
  • nginx_logs
  • preprod Preprod tasks
  • prod Prod tasks
  • pwd
  • reset
  • services_reload
  • services_restart
  • uname
  • update updates the code and everything else
  • update_database
  • update_hg
  • virtualenv
  • wsgi_restart

Configuration

I want the configuration file to be succint, and to have one file for one projet (with, "staging", "preprod" and "prod")

Here is an example :

--- #YAML:1.1


#can be "prod" or "preprod"
prod:
    distro:
        name: debian
        packages: [python-virtualenv, libmysqlclient15-dev]
    project:
        name: project_name
        normal_user: user
        sudo_user: sudo_user
        logs: project_name.log
        root_dir: /home/web/django/
        doc_root: /home/web/django/project_name/
    hosts:
        web: [inventeev.com]
    database:
        type: mysql
        host: 
        port: 
        user: 
        db: 
        pw: 
        backup: /path/to/database/backup
    hg:
        url: 
        repos: 
        dest: 
        user: 
        pw: 
    django:
        doc_root: /path/to/projet_root
        src_dir: /path/to/django/project/dir
        apps: [app,list]
    virtualenv:
        dir: /path/to/desired/folder/for/your/virtualenv
        bin_dir: /path/to/desired/folder/for/your/virtualenv/bin
        
    wsgi:
        type: gunicorn
        bin_name: gunicorn_django
        path: /path/to/desired/folder/for/your/virtualenv/bin
        pidfile: /where/to/store/your/pidfile
        logfile: /where/to/store/your/wsgi/logfile
        host: 127.0.0.1
        port: [9111]
        workers: 2
    httpd:
        type: nginx
        en: /etc/nginx/sites-enabled/
        av: /etc/nginx/sites-available/
        
    services:
        restart:
            [memcached]
        reload:
            [nginx]

Updated