puppet files and modules for vm provisioning
authorNicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
Wed, 10 Sep 2014 16:14:03 +0200
changeset 129 3a7a8607d395
parent 128 7b1c3253250c
child 134 d66eff309d8e
puppet files and modules for vm provisioning
.hgignore
.hgsub
.hgsubstate
dev/Vagrantfile
dev/custom.yaml
dev/custom.yaml.tmpl
dev/hiera.yaml
dev/manifests/site.pp
dev/modules/sysconfig/manifests/config.pp
dev/modules/sysconfig/manifests/django_init.pp
dev/modules/sysconfig/manifests/init.pp
dev/modules/sysconfig/manifests/packages.pp
dev/modules/sysconfig/manifests/params.pp
dev/modules/sysconfig/manifests/postgresql.pp
dev/modules/sysconfig/manifests/sys_upgrade.pp
dev/modules/sysconfig/manifests/virtualenv.pp
dev/modules/sysconfig/templates/config.py.erb
dev/modules/sysconfig/templates/settings.py.erb
--- a/.hgignore	Thu Sep 04 12:32:29 2014 +0200
+++ b/.hgignore	Wed Sep 10 16:14:03 2014 +0200
@@ -16,4 +16,7 @@
 syntax: regexp
 ^web/static/media/cache$
 syntax: glob
-.vagrant/
\ No newline at end of file
+.vagrant/
+src\spel\settings_local.py
+src\spel\settings_bu.py
+log.txt
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgsub	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,5 @@
+dev/modules/stdlib = [git]https://github.com/puppetlabs/puppetlabs-stdlib.git
+dev/modules/apt = [git]https://github.com/puppetlabs/puppetlabs-apt.git
+dev/modules/postgresql = [git]https://github.com/puppetlabs/puppetlabs-postgresql.git
+dev/modules/concat = [git]https://github.com/puppetlabs/puppetlabs-concat.git
+dev/modules/elasticsearch = [git]https://github.com/elasticsearch/puppet-elasticsearch.git
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgsubstate	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,5 @@
+0e804448a9c59b0f253dad5b56c52aa719157ef0 dev/modules/apt
+8c7fe1b076e3dfe40324e2dc6bf1a36e21f5a325 dev/modules/concat
+594776ee70075285b3a492eabbe03af84145a9ca dev/modules/elasticsearch
+a1edd262d84f97a33ff64b8c542cffc5fa6d98c1 dev/modules/postgresql
+9e8127bb64421f8476c32ba971a375c9c82fd7f0 dev/modules/stdlib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/Vagrantfile	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,147 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+require 'yaml'
+
+custom_file_path = File.join(__dir__, (ENV['SYSCONFIG'] || 'custom.yaml'))
+
+context = (File.exist?(custom_file_path)?YAML::load_file(custom_file_path):{}) || {}
+
+ROOT_PATH = context.fetch("root_path","../")
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  # All Vagrant configuration is done here. The most common configuration
+  # options are documented and commented below. For a complete reference,
+  # please see the online documentation at vagrantup.com.
+
+  # Every Vagrant virtual environment requires a box to build off of.
+  config.vm.box=context.fetch("vm_box","puppetlabs/ubuntu-14.04-64-puppet")
+
+  # Disable automatic box update checking. If you disable this, then
+  # boxes will only be checked for updates when the user runs
+  # `vagrant box outdated`. This is not recommended.
+  # config.vm.box_check_update = false
+
+  # Create a forwarded port mapping which allows access to a specific port
+  # within the machine from a port on the host machine. In the example below,
+  # accessing "localhost:8080" will access port 80 on the guest machine.
+  config.vm.network "forwarded_port", guest: 8000, host: 8001
+
+  # Create a private network, which allows host-only access to the machine
+  # using a specific IP.
+  # config.vm.network "private_network", ip: "192.168.33.10"
+  config.vm.network :private_network, ip: (ENV['VM_IP'] || context['vm_ip'] || "172.16.1.3")
+
+  # Create a public network, which generally matched to bridged network.
+  # Bridged networks make the machine appear as another physical device on
+  # your network.
+  # config.vm.network "public_network"
+
+  # If true, then any SSH connections made will enable agent forwarding.
+  # Default value: false
+  # config.ssh.forward_agent = true
+
+  # Share an additional folder to the guest VM. The first argument is
+  # the path on the host to the actual folder. The second argument is
+  # the path on the guest to mount the folder. And the optional third
+  # argument is a set of non-required options.
+  # config.vm.synced_folder "../data", "/vagrant_data"
+    config.vm.synced_folder ROOT_PATH, "/srv/spel"
+    vmname = (ENV['VM_NAME'] || context['vm_name'] || "spel_dev")
+    config.vm.define :"#{vmname}" do |spel_dev|
+    end
+    
+  # Provider-specific configuration so you can fine-tune various
+  # backing providers for Vagrant. These expose provider-specific options.
+  # Example for VirtualBox:
+  #
+  # config.vm.provider "virtualbox" do |vb|
+  #   # Don't boot with headless mode
+  #   vb.gui = true
+  #
+  #   # Use VBoxManage to customize the VM. For example to change memory:
+  #   vb.customize ["modifyvm", :id, "--memory", "1024"]
+  # end
+    config.vm.provider :virtualbox do |vb|
+      vb.name = vmname
+    end
+  #
+  # View the documentation for the provider you're using for more
+  # information on available options.
+  
+
+   
+
+  # Enable provisioning with CFEngine. CFEngine Community packages are
+  # automatically installed. For example, configure the host as a
+  # policy server and optionally a policy file to run:
+  #
+  # config.vm.provision "cfengine" do |cf|
+  #   cf.am_policy_hub = true
+  #   # cf.run_file = "motd.cf"
+  # end
+  #
+  # You can also configure and bootstrap a client to an existing
+  # policy server:
+  #
+  # config.vm.provision "cfengine" do |cf|
+  #   cf.policy_server_address = "10.0.2.15"
+  # end
+
+  # Enable provisioning with Puppet stand alone.  Puppet manifests
+  # are contained in a directory path relative to this Vagrantfile.
+  # You will need to create the manifests directory and a manifest in
+  # the file default.pp in the manifests_path directory.
+  #
+  
+    config.vm.provision :puppet do |puppet|
+        puppet.manifests_path = "manifests"
+        puppet.manifest_file  = "site.pp"
+        puppet.module_path    = "modules"
+        puppet.options        = "--hiera_config /vagrant/hiera.yaml"
+        puppet.facter = {
+          "vagrant_base_path" => File.dirname(__FILE__)
+    }
+    end
+
+  # Enable provisioning with chef solo, specifying a cookbooks path, roles
+  # path, and data_bags path (all relative to this Vagrantfile), and adding
+  # some recipes and/or roles.
+  #
+  # config.vm.provision "chef_solo" do |chef|
+  #   chef.cookbooks_path = "../my-recipes/cookbooks"
+  #   chef.roles_path = "../my-recipes/roles"
+  #   chef.data_bags_path = "../my-recipes/data_bags"
+  #   chef.add_recipe "mysql"
+  #   chef.add_role "web"
+  #
+  #   # You may also specify custom JSON attributes:
+  #   chef.json = { mysql_password: "foo" }
+  # end
+
+  # Enable provisioning with chef server, specifying the chef server URL,
+  # and the path to the validation key (relative to this Vagrantfile).
+  #
+  # The Opscode Platform uses HTTPS. Substitute your organization for
+  # ORGNAME in the URL and validation key.
+  #
+  # If you have your own Chef Server, use the appropriate URL, which may be
+  # HTTP instead of HTTPS depending on your configuration. Also change the
+  # validation key to validation.pem.
+  #
+  # config.vm.provision "chef_client" do |chef|
+  #   chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
+  #   chef.validation_key_path = "ORGNAME-validator.pem"
+  # end
+  #
+  # If you're using the Opscode platform, your validator client is
+  # ORGNAME-validator, replacing ORGNAME with your organization name.
+  #
+  # If you have your own Chef Server, the default validation client name is
+  # chef-validator, unless you changed the configuration.
+  #
+  #   chef.validation_client_name = "ORGNAME-validator"
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/custom.yaml	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,24 @@
+---
+#root_path  : ../
+#vm_box     : puppetlabs/ubuntu-14.04-64-puppet
+#vm_ip      : 172.16.1.3
+#vm_name    : spel_dev
+
+#sysconfig::params::db_name : spel
+#sysconfig::params::db_user : spel_user
+#sysconfig::params::db_pw   : spel_pw
+#sysconfig::params::db_host : 127.0.0.1
+#sysconfig::params::db_port : 5433
+
+#sysconfig::params::testserver_port : 8001
+
+#sysconfig::params::superuser_name   : admin_custom
+#sysconfig::params::superuser_pw     : dev@spel_custom
+#sysconfig::params::user_edit_name   : user-edit
+#sysconfig::params::user_edit_pw     : user-edit@spel
+#sysconfig::params::user_com_name    : user-com
+#sysconfig::params::user_com_pw      : user-com@spel
+#sysconfig::params::user_observ_name : user-observ
+#sysconfig::params::user_observ_pw   : user-observ@spel
+
+#sysconfig::params::path_to_virtualenv   : '/home/vagrant/myspelenv'
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/custom.yaml.tmpl	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,26 @@
+---
+#root_path  : ../
+#vm_box     : puppetlabs/ubuntu-14.04-64-puppet
+#vm_ip      : 172.16.1.3
+#vm_name    : spel_dev
+
+#sysconfig::params::db_name : spel_custom
+#sysconfig::params::db_user : spel_user_cutom
+#sysconfig::params::db_pw   : spel_pw_custom
+#sysconfig::params::db_host : 127.0.0.1_custom
+#sysconfig::params::db_port : 5433
+
+#sysconfig::params::testserver_port : 8001
+
+#sysconfig::params::superuser_name   : admin_custom
+#sysconfig::params::superuser_pw     : dev@spel_custom
+#sysconfig::params::user_edit_name   : user-edit
+#sysconfig::params::user_edit_pw     : user-edit@spel
+#sysconfig::params::user_com_name    : user-com
+#sysconfig::params::user_com_pw      : user-com@spel
+#sysconfig::params::user_observ_name : user-observ
+#sysconfig::params::user_observ_pw   : user-observ@spel
+
+#sysconfig::params::path_to_virtualenv   : '/home/vagrant/myspelenv'
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/hiera.yaml	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,7 @@
+---
+:hierarchy:
+  - custom
+:backends:
+  - yaml
+:yaml:
+  :datadir: '/vagrant/'
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/manifests/site.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,31 @@
+exec {
+    'apt_update_site':
+      command     => '/usr/bin/apt-get update',
+      timeout     => 2400,
+      returns     => [ 0, 100 ];
+      #refreshonly => true;
+    
+}
+
+Exec["apt_update_site"] -> Package <| |>
+
+# upgrade system
+class { 'sysconfig::sys_upgrade': }->
+
+# params
+class { 'sysconfig::params': }->
+
+# install packages
+class { 'sysconfig::packages': }->
+
+# install postgres
+class { 'sysconfig::postgresql': }->
+
+# set up the virtualenv
+class { 'sysconfig::virtualenv': } ->
+
+# write config
+ class { 'sysconfig::config': }->
+
+# write django_init
+class { 'sysconfig::django_init': }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/config.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,39 @@
+class sysconfig::config(
+  $db_name = hiera('sysconfig::params::db_name',$sysconfig::params::db_name),
+  $db_user = hiera('sysconfig::params::db_user',$sysconfig::params::db_user),
+  $db_pw   = hiera('sysconfig::params::db_pw',$sysconfig::params::db_pw),
+  $db_host = hiera('sysconfig::params::db_host',$sysconfig::params::db_host),
+  $db_port = hiera('sysconfig::params::db_port',$sysconfig::params::db_port)
+) inherits sysconfig::params {
+
+  notify {'config': name => "config -> \$db_host: ${db_host}, \$db_port: ${db_port}, \$db_name: ${db_name}, \$db_user: ${db_user}, \$db_pw: ${db_pw}", withpath => true }
+
+   file { 'local-settings':
+     ensure  => 'present',
+     path    => "/srv/spel/src/spel/settings.py",
+     replace => 'no',
+     owner   => 'vagrant',
+     group   => 'vagrant',
+     mode    => 644,
+     content => template('sysconfig/settings.py.erb'),
+    }
+    
+    #file { 'local-settings':
+     #ensure  => 'present',
+     #path    => "/srv/spel/src/spel/config.py",
+     #replace => 'no',
+     #owner   => 'vagrant',
+     #group   => 'vagrant',
+     #mode    => 644,
+     #content => template('sysconfig/config.py.erb'),
+    #}
+    
+   file { 'media-root':
+     ensure => 'directory',
+     path   => '/srv/spel/web',
+     owner  => 'www-data',
+     group  => 'www-data',
+     mode   => '0775'
+   }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/django_init.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,33 @@
+class sysconfig::django_init (
+    $superuser_name = hiera('sysconfig::params::superuser_name', $sysconfig::params::superuser_name ),
+    $superuser_pw   = hiera('sysconfig::params::superuser_pw'  , $sysconfig::params::superuser_pw   ),
+    $path_to_virtualenv = hiera('sysconfig::params::path_to_virtualenv', $sysconfig::params::path_to_virtualenv )
+) inherits sysconfig::params {
+    
+    notify {'django_init': name => "django init \$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }->
+
+    exec { 'syncdb':
+        command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput",
+        cwd     => '/srv/spel/src',
+        user    => 'vagrant',
+        provider => 'shell'
+    }
+
+    exec { 'loaddata':
+        command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py loaddata roles_generic",
+        cwd     => '/srv/spel/src',
+        user    => 'vagrant',
+        provider => 'shell',
+        require => Exec['syncdb']
+    }
+
+    exec { 'createsuperuser':
+        command => "/bin/echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${superuser_name}', 'admin@example.com', '${superuser_pw}')\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell",
+        cwd     => '/srv/spel/src',
+        user    => 'vagrant',
+        provider => 'shell',
+        onlyif  => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell",
+       require => Exec['syncdb']
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/init.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,4 @@
+
+class sysconfig {
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/packages.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,19 @@
+class sysconfig::packages {
+
+  $spel_pkgs = [
+      'python-dev',
+      'python-setuptools',
+      'libpq-dev',
+      'libjpeg8-dev',
+      'libxslt-dev',
+      'libxml2',
+      'mercurial'
+  ]
+  
+  package { $spel_pkgs: ensure => "installed" }
+
+  #upgrade setuptools
+  exec { '/usr/bin/easy_install --upgrade setuptools': require => Package[$spel_pkgs]}
+
+  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/params.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,25 @@
+class sysconfig::params {
+
+  $db_name = 'spel'
+  $db_user = 'spel_user'
+  $db_pw   = 'spel'
+  $db_host = '127.0.0.1'
+  $db_port = '5432'
+
+  $db_host_real = hiera('sysconfig::params::db_host',$db_host)
+  $db_is_local = ($db_host_real == undef or !$db_host_real or $db_host_real=='127.0.0.1' or $db_host_real=='localhost')
+
+  $testserver_port = 8001
+
+  $superuser_name   = 'admin'
+  $superuser_pw     = 'dev@spel'
+  $user_edit_name   = 'user-edit'
+  $user_edit_pw     = 'user-edit@spel'
+  $user_com_name    = 'user-com'
+  $user_com_pw      = 'user-com@spel'
+  $user_observ_name = 'user-observ'
+  $user_observ_pw   = 'user-observ@spel'
+  
+  $path_to_virtualenv = hiera('sysconfig::params::path_to_virtualenv', '/home/vagrant/myspelenv')
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/postgresql.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,37 @@
+class sysconfig::postgresql (
+    $db_host    = hiera('sysconfig::params::db_host', $sysconfig::params::db_host),
+    $db_port    = hiera('sysconfig::params::db_port', $sysconfig::params::db_port),
+    $db_name    = hiera('sysconfig::params::db_name', $sysconfig::params::db_name),
+    $db_user    = hiera('sysconfig::params::db_user', $sysconfig::params::db_user),
+    $db_pw      = hiera('sysconfig::params::db_pw', $sysconfig::params::db_pw),
+) inherits sysconfig::params {
+
+    notify {'postgresql': name => "\$db_host : ${db_host}, \$db_port : ${db_port}, \$db_name : ${db_name}, \$db_user : ${db_user}, \$db_pw : ${db_pw}", withpath => true }
+    
+    #include postgresql::globals
+    include postgresql::server
+    #include postgresql::client
+    
+    # if $sysconfig::params::db_is_local {
+
+        postgresql::server::role {"${db_user}_createdb":
+            username      => $db_user,
+            createdb      => true,
+            password_hash => postgresql_password($db_user, $db_pw)
+        }->
+        postgresql::server::database { $db_name:
+            owner    => $db_user,            
+            encoding => 'UTF8',
+        }
+    #}
+    # else {
+        # postgresql::validate_db_connection { 'validate_postgres_connection':
+            # database_host           => $db_host,
+            # database_port           => $db_port,
+            # database_username       => $db_user,
+            # database_password       => $db_pw,
+            # database_name           => $db_name,
+            # create_db_first         => 'true';
+        # }
+    #}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/sys_upgrade.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,28 @@
+class sysconfig::sys_upgrade {
+
+  exec {
+    'apt_source_update':
+      command   => "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main dependencies' > /etc/apt/sources.list.d/pgdg.list;,
+                    wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -;",
+      timeout   => 0,
+      provider  => 'shell',
+      returns   => [0, 100];
+    'apt_get_update_sysconfig':
+      command     => '/usr/bin/apt-get update',
+      timeout     => 2400,
+      returns     => [ 0, 100 ],
+#     refreshonly => true;
+      require     => Exec['apt_source_update'];
+    'sys-upgrade':
+      command   => '/usr/bin/apt-get upgrade -y',
+      timeout => 0,
+      require   => Exec['apt_get_update_sysconfig'];
+    'sys-dist-upgrade':
+      command   => '/usr/bin/apt-get dist-upgrade -y',
+      timeout => 0,
+      require   => Exec['apt_get_update_sysconfig'];
+  }
+
+  Exec['apt_get_update_sysconfig'] -> Exec['sys-upgrade'] -> Exec['sys-dist-upgrade']
+  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/manifests/virtualenv.pp	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,19 @@
+class sysconfig::virtualenv (
+    $path_to_virtualenv = hiera('sysconfig::params::path_to_virtualenv', $sysconfig::params::path_to_virtualenv )
+) inherits sysconfig::params {
+
+    exec {
+            'create_python_env_script':
+            command     => '/usr/bin/python /srv/spel/virtualenv/web/create_python_env.py',
+            timeout     => 2400,
+            returns     => [ 0, 100 ],
+            provider => 'shell';
+            'project_boot_script':
+            command     => "python /srv/spel/virtualenv/web/project-boot.py ${path_to_virtualenv}",
+            timeout     => 2400,
+            returns     => [ 0, 100 ],
+            provider => 'shell',
+            require     => Exec['create_python_env_script']
+            }
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/templates/config.py.erb	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,180 @@
+# -*- coding: utf-8 -*-
+import os, logging
+
+SITE_ID = 1
+
+#configuration for runserver
+#BASE_URL = '/'
+#PLATFORM_BASE_URL = '/'
+#WEB_URL = ''
+#WEB_AUTH = []
+
+
+
+BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
+#BASE_DIR = '%(base_dir)s'
+BASE_URL = ''
+PLATFORM_BASE_URL = BASE_URL + 'spel/'
+WEB_URL = '%(web_url)s'
+WEB_AUTH = [] # example [{'REGEX': 'localhost/~ymh/spel', 'NAME': 'ymh', 'PASSWORD': 'ymh'}]
+STATIC_URL = BASE_URL + 'static/site/'
+
+
+STREAM_URL = ""
+
+STREAM_SRC_PREFIX = "%(stream_src_prefix)s"
+ 
+BASE_STATIC_ROOT = os.path.abspath(BASE_DIR + "../static/").rstrip("/")+"/"
+BASE_STATIC_URL = BASE_URL + 'static/' 
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = BASE_STATIC_ROOT + "media/"
+
+
+# Absolute path to the directory that static files (js, css, swf...)
+# DO NOT forget to do command line ./manage.py collectstatic to gather static media into the web/static folder
+STATIC_ROOT = BASE_STATIC_ROOT + "site/"
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '%(secret_key)s'
+
+# PATH to the ffmpeg executable, used to know automatically the media file duration 
+FFMPEG_PATH = "%(ffmpeg_path)s"
+
+
+CONTENT_ROOT = BASE_STATIC_ROOT + "content/"
+
+# PATH where uploaded media are put.
+STREAM_PATH = CONTENT_ROOT
+
+LDT_MEDIA_PREFIX = STATIC_URL + 'ldt/'
+
+
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.%(db_engine)s', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': '%(db_name)s',                      # Or path to database file if using sqlite3.
+        'USER': '%(db_user)s',                      # Not used with sqlite3.
+        'PASSWORD': '%(db_password)s',                  # Not used with sqlite3.
+        'HOST': '%(db_host)s',                      # Set to empty string for localhost. Not used with sqlite3.
+        'PORT': '%(db_port)d',                      # Set to empty string for default. Not used with sqlite3.
+    }
+}
+
+CACHES = {
+    'default': {
+        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
+    }
+}
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+#LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt"))
+LOG_FILE = '%(log_file)s'
+LOG_LEVEL = logging.DEBUG
+LOGGING = {
+    'version': 1,
+    'disable_existing_loggers': False,
+    'filters': {
+        'require_debug_false': {
+            '()': 'django.utils.log.RequireDebugFalse'
+        }
+    },
+    'formatters' : {
+        'simple' : {
+            'format': "%(asctime)s - %(levelname)s : %(message)s",
+        },
+        'semi-verbose': {
+            'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
+        },                    
+    },
+    'handlers': {
+        'mail_admins': {
+            'level': 'ERROR',
+            'filters': ['require_debug_false'],
+            'class': 'django.utils.log.AdminEmailHandler'
+        },
+        'stream_to_console': {
+            'level': LOG_LEVEL,
+            'class': 'logging.StreamHandler'
+        },
+        'file': {
+            'level': LOG_LEVEL,
+            'class': 'logging.FileHandler',
+            'filename': LOG_FILE,
+            'formatter': 'semi-verbose',
+        },
+    },
+    'loggers': {
+        'django.db.backends':{
+            'handlers': ['file'],
+            'level': LOG_LEVEL,
+            'propagate': True,
+        },                
+        'django.request': {
+            'handlers': ['file'],
+            'level': LOG_LEVEL,
+            'propagate': True,
+        },
+        'ldt': {
+            'handlers': ['file'],
+            'level': LOG_LEVEL,
+            'propagate': True,
+        },
+        'spel': {
+            'handlers': ['file'],
+            'level': LOG_LEVEL,
+            'propagate': True,
+        },
+    }
+}
+
+
+ADMINS = (
+    # ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+GOOGLE_ANALYTICS_CODE = '%(google_analytics_code)s'
+
+EMAIL_USE_TLS = %(email_use_tls)s
+EMAIL_HOST = '%(email_host)s'
+EMAIL_HOST_USER = '%(email_host_user)s'
+EMAIL_HOST_PASSWORD = '%(email_host_user)s'
+EMAIL_PORT = %(email_port)d 
+
+ACCOUNT_ACTIVATION_DAYS = 7
+REGISTRATION_OPEN = False
+
+LDT_MAX_SEARCH_NUMBER = 50
+LDT_MAX_FRAGMENT_PER_SEARCH = 3
+LDT_RESULTS_PER_PAGE = 1
+LDT_JSON_DEFAULT_INDENT = 0
+LDT_MAX_CONTENTS_PER_PAGE = 5
+LDT_MAX_PROJECTS_PER_PAGE = 5
+LDT_FRONT_MEDIA_PER_PAGE = 9
+
+EMPTY_MEDIA_EXTERNALID = None
+
+AUTO_INDEX_AFTER_SAVE = True
+
+FORBIDDEN_STREAM_URL = "%(forbidden_stream_url)s"
+
+AUDIO_RECORD_URL = "%(audio_record_url)s"
+
+FRONT_TAG_LIST = [u"Enmi 2011", u"film", u"conférence"]
+
+HAYSTACK_CONNECTIONS = {
+    'default': {
+        #for elasticsearch use ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine
+        'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
+        #'URL': 'http://127.0.0.1:9200/',
+        #'INDEX_NAME': 'spel',
+    },
+}
+
+LDT_INDEXATION_INSERT_BATCH_SIZE = 5000
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/modules/sysconfig/templates/settings.py.erb	Wed Sep 10 16:14:03 2014 +0200
@@ -0,0 +1,286 @@
+# -*- coding: utf-8 -*-
+#@PydevCodeAnalysisIgnore
+import os.path
+import spel
+# Django settings for project.
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+    # ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+  'default': {
+    'ENGINE': 'django.db.backends.postgresql_psycopg2', # YOUR_SETTINGS # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+    'NAME': '<%= @db_name %>',               # YOUR_SETTINGS # Or path to database file if using sqlite3.
+    'USER': '<%= @db_user %>',               # YOUR_SETTINGS # Not used with sqlite3.
+    'PASSWORD': '<%= @db_pw %>',             # YOUR_SETTINGS # Not used with sqlite3.
+    'HOST': '<%= @db_host %>',                      # YOUR_SETTINGS # Set to empty string for localhost. Not used with sqlite3.
+    'PORT': '<%= @db_port %>',                      # YOUR_SETTINGS # Set to empty string for default. Not used with sqlite3.
+   }
+}
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'UTC'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'fr-fr'
+
+ugettext = lambda s: s
+
+LANGUAGES = ( 
+    ('fr', ugettext('French')),
+    ('en', ugettext('English')),
+    ('ja', ugettext('Japanese')),
+)
+
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+#MEDIA_ROOT = ''
+
+# Root of static files used by each app, generated by code or uploaded by users
+#STATIC_URL = '/static/'
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+#MEDIA_URL = ''
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+
+#LDT_MEDIA_PREFIX = '/ldt/'
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 't^lii5_z@tho$%6t&b#dm#t9nz$$ylyclxvkdiyqbl+(dnt(ma'
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
+#     'django.template.loaders.eggs.Loader',
+)
+
+MIDDLEWARE_CLASSES = (
+    'django.middleware.cache.UpdateCacheMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.cache.FetchFromCacheMiddleware',
+    'django.middleware.gzip.GZipMiddleware',
+    'ldt.ldt_utils.middleware.swfupload.SWFUploadMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    #'django.middleware.locale.LocaleMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django_openid_consumer.middleware.OpenIDMiddleware',
+    'ldt.ldt_utils.middleware.userprofile.LanguageMiddleware',
+    'ldt.security.middleware.SecurityMiddleware',
+)
+
+TEMPLATE_CONTEXT_PROCESSORS = ( 
+    "django.core.context_processors.request",
+    "django.contrib.auth.context_processors.auth",
+    "django.core.context_processors.debug",
+    "django.core.context_processors.i18n",
+    "django.core.context_processors.media",
+    "django.core.context_processors.static",
+    "ldt.utils.context_processors.ldt_context",
+    "spel.utils.context_processors.spel_context",
+)
+
+
+ROOT_URLCONF = 'spel.urls'
+
+TEMPLATE_DIRS = (
+    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+    # Always use forward slashes, even on Windows.
+    # Don't forget to use absolute paths, not relative paths.
+    os.path.join(os.path.basename(__file__), 'templates'), 
+    os.path.join(os.path.dirname(__file__), 'templates'),  
+)
+    
+FIXTURES_DIRS = (
+    os.path.join(os.path.basename(__file__), 'fixtures'),
+)
+
+INSTALLED_APPS = (
+    'django_extensions',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.admin',
+    'django.contrib.staticfiles',
+    'haystack',
+    'tastypie',
+    'guardian',
+    'taggit',
+    'taggit_templatetags',
+    'registration',
+    'oauth_provider',
+    'django_openid_consumer',
+    'social_auth',
+    'south',
+    'sorl.thumbnail',
+    'ldt',
+    'ldt.core',
+    'ldt.security',
+    'ldt.user',
+    'ldt.ldt_utils',
+    'ldt.text',
+    'ldt.management',
+    'ldt.indexation',
+    'chunked_uploads',
+    'spel',
+)
+
+#AUTH_PROFILE_MODULE = 'user.UserProfile'
+AUTH_USER_MODEL = 'user.LdtUser'
+INITIAL_CUSTOM_USER_MIGRATION = "0009_rename_auth_user_to_user_ldt_user"
+
+DECOUPAGE_BLACKLIST = (
+     "de_PPP",
+)
+ 
+ZIP_BLACKLIST = (
+     "__MACOSX",
+)
+
+AUTHENTICATION_BACKENDS = (
+    'social_auth.backends.twitter.TwitterBackend',
+    'social_auth.backends.facebook.FacebookBackend',
+#    'social_auth.backends.google.GoogleOAuthBackend',
+#    'social_auth.backends.google.GoogleOAuth2Backend',
+    'social_auth.backends.google.GoogleBackend',
+    'social_auth.backends.yahoo.YahooBackend',
+#    'social_auth.backends.contrib.linkedin.LinkedinBackend',
+#    'social_auth.backends.contrib.LiveJournalBackend',
+#    'social_auth.backends.contrib.orkut.OrkutBackend',
+    'social_auth.backends.OpenIDBackend',
+    'django.contrib.auth.backends.ModelBackend',
+    'guardian.backends.ObjectPermissionBackend',
+)
+#SOCIAL_AUTH_IMPORT_BACKENDS = (
+#    'myproy.social_auth_extra_services',
+#)
+
+ACCOUNT_ACTIVATION_DAYS = 7 
+
+LDT_MAX_SEARCH_NUMBER = 50
+LDT_JSON_DEFAULT_INDENT = 0
+LDT_MAX_FRAGMENT_PER_SEARCH = 3
+LDT_RESULTS_PER_PAGE = 10
+LDT_MAX_CONTENTS_PER_PAGE = 10
+LDT_MAX_PROJECTS_PER_PAGE = 10
+LDT_FRONT_MEDIA_PER_PAGE = 9
+LDT_FRONT_PROJECTS_PER_PAGE = 12
+LDT_MEDIA_IN_RESULTS_PAGE = 6
+
+OAUTH_PROVIDER_KEY_SIZE = 32
+OAUTH_PROVIDER_SECRET_SIZE = 32
+OAUTH_PROVIDER_VERIFIER_SIZE = 10
+OAUTH_PROVIDER_CONSUMER_KEY_SIZE = 256
+OAUTH_AUTHORIZE_VIEW = 'oauth_provider.views.fake_authorize_view'
+OAUTH_CALLBACK_VIEW = 'oauth_provider.views.fake_callback_view'
+TEST_WEBSERVER_ADDRPORT = "127.0.0.1:8888"
+
+TWITTER_CONSUMER_KEY     = 'UxAdbOLSo4Mx3CXIwDG9Eg'
+TWITTER_CONSUMER_SECRET  = '2PcWgdjnJL6Vp8srB40jeAo0fjMEtDnUwmAia6EUww'
+FACEBOOK_APP_ID = '163134140411313'
+FACEBOOK_API_SECRET = 'f25e0754a44f0d90d3f4d9ea961ff012'
+
+SOCIAL_AUTH_COMPLETE_URL_NAME  = 'complete'
+SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'associate_complete'
+
+
+AUTO_INDEX_AFTER_SAVE = True
+
+ANONYMOUS_USER_ID = -1
+
+WEB_VERSION = spel.get_version()
+
+DIVISIONS_FOR_STAT_ANNOTATION = 64
+
+FRONT_TAG_LIST = []
+
+DEFAULT_CONTENT_ICON = "thumbnails/contents/content_default_icon.png"
+DEFAULT_PROJECT_ICON = "thumbnails/projects/project_default_icon.png"
+DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png"
+DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png"
+PROFILE_IMG_MAX_SIZE = 1000000
+
+USE_GROUP_PERMISSIONS = ['Project', 'Content', 'Media']
+FORBIDDEN_STREAM_URL = "rtmp://media.iri.centrepompidou.fr/ddc_player/mp4:video/forbidden_stream.mp4?old_path="
+PUBLIC_GROUP_NAME = 'everyone'
+MAX_USERS_SEARCH = 20
+
+SYNTAX = {
+          '++' : 'OK',
+          '--' : 'KO',
+          '==' : 'REF',
+          '??' : 'Q'
+          }
+
+EXTERNAL_STREAM_SRC = ['youtube.com', 'dailymotion.com', 'vimeo.com']
+
+HAYSTACK_CONNECTIONS = {
+    'default': {
+        #for elasticsearch use ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine
+        'ENGINE': 'ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine',
+        'URL': 'http://127.0.0.1:9200/',
+        'INDEX_NAME': 'spel',
+    },
+}
+HAYSTACK_SIGNAL_PROCESSOR = 'ldt.indexation.signals.LdtSignalProcessor'
+
+from config import *
+
+if not "SRC_BASE_URL" in locals():
+    SRC_BASE_URL = BASE_URL + __name__.split('.')[0] + '/' 
+
+if not "LOGIN_URL" in locals():
+    LOGIN_URL = SRC_BASE_URL + 'accounts/login/'
+if not "LOGOUT_URL" in locals():
+    LOGOUT_URL = SRC_BASE_URL + 'accounts/disconnect/'
+if not "LOGIN_REDIRECT_URL" in locals():
+    LOGIN_REDIRECT_URL = SRC_BASE_URL + 'ldt/'
+if not "LOGOUT_REDIRECT_URL" in locals():
+    LOGOUT_REDIRECT_URL = SRC_BASE_URL + 'accounts/login'
+if not "PROFILE_REDIRECT_URL" in locals():
+    PROFILE_REDIRECT_URL = SRC_BASE_URL + 'auth_accounts/create/profile'
+
+if not "LOGIN_ERROR_URL" in locals():
+    LOGIN_ERROR_URL = SRC_BASE_URL + 'accounts/login'
+
+# Used in a lot of templates
+if not "LDT_MEDIA_PREFIX" in locals():
+    LDT_MEDIA_PREFIX = STATIC_URL + 'ldt/'
+# URL that handles the media served from MEDIA_ROOT.
+if not "MEDIA_URL" in locals():
+    MEDIA_URL = BASE_URL + 'static/media/'
+
+#forced settings
+MAX_TAG_LENGTH = 1024
+#FORCE_LOWERCASE_TAGS = True
+LDT_INDEXATION_INSERT_BATCH_SIZE = 1
+LDT_RESULTS_PER_PAGE = 500
+
+