# HG changeset patch # User ymh # Date 1393663706 -3600 # Node ID a87316d901beef3c903e705801c8e491118b506f # Parent 084934fe912e29ebbd38a0498558d43230ced2aa# Parent 8e9ea314e06e27b8c190fa867381ed8841258434 merge after comt repository repair diff -r 084934fe912e -r a87316d901be .hgignore --- a/.hgignore Fri Feb 28 18:53:55 2014 +0100 +++ b/.hgignore Sat Mar 01 09:48:26 2014 +0100 @@ -9,10 +9,11 @@ develop-eggs downloads .settings - src/comt.egg-info .installed.cfg recreate .pydevproject settings_local.py urls_local.py +dev/.vagrant +dev/custom.yaml diff -r 084934fe912e -r a87316d901be .hgsub --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgsub Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,6 @@ +dev/modules/nginx = [git]https://github.com/jfryman/puppet-nginx.git +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/supervisord = [git]https://github.com/adedommelin/puppet-supervisord.git +dev/modules/concat = [git]https://github.com/puppetlabs/puppetlabs-concat.git diff -r 084934fe912e -r a87316d901be .hgsubstate --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgsubstate Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,6 @@ +738ef15316fef7d3f82d9d29414f71445b3a35d9 dev/modules/apt +24906d1bca3f8a1b93b24d71c0e081eda57afc9e dev/modules/concat +7cf6dac978fe08e061ed9201284c7a5bf22af2a3 dev/modules/nginx +0a8a9a5e1d375150398d70a0193ed99fbbc4e13d dev/modules/postgresql +ab981422a67636441f1bfebaaade36aa690f1f25 dev/modules/stdlib +743e2a3facfd7b9596983bca0f5afef8336ea525 dev/modules/supervisord diff -r 084934fe912e -r a87316d901be README.txt --- a/README.txt Fri Feb 28 18:53:55 2014 +0100 +++ b/README.txt Sat Mar 01 09:48:26 2014 +0100 @@ -42,7 +42,7 @@ (all other python dependencies will be downloaded by buildout) Installation (development install) -============ +================================== 1. Install python2.5+ and all required libraries (ubuntu users : 'sudo apt-get install python python-magic python-setuptools python-uno libyaml-0-1 python-yaml python-dev git-core python-utidylib python-pexpect python-cssutils') 2. Install pandoc @@ -85,8 +85,50 @@ - `./bin/django runserver --settings=settings` 11. Access your Comt instance by pointing your browser to http://127.0.0.1:8000/ +Installation (Vagrant development box) +====================================== + +The second option is to use the vagrant virtual machine defined in the `dev` folder. +For this you need first to install Vagrant for your platform (c.f. http://www.vagrantup.com/), open a terminal in the `dev` folder and launch the command + +$ vagrant up + +This will create a virtual box, using the private address 172.16.1.2. An instance of comt can be reached at the following url http://172.16.1.2. + +The installation have the following parameters: + - The root of the project is mapped on `/srv/comt` on the dev box. + - The web server is nginx (http://nginx.org/). + - The web pages are served as a wsgi application with gunicorn (http://gunicorn.org/). + - The gunicorn processes are monitored by supervisor (http://supervisord.org/). + - Openoffice is installed but is not launched as an headless instance (althought it could be easily setup with supervisor). + - The dev box uses a virtual network with the ip 172.16.1.2 (this can be changed in the Vagrant config). + - The box is provisioned using puppet (http://puppetlabs.com/). + - Most of the configuration is don in the sysconfig module found in `dev/modules/sysconfig`. + - All the other subdirectories of `dev/modules` are puppet modules used during the box provisioning. All the folders are sub-repositories and are checked-out using git. + +Moreover, the following parameters are set : + + | var name | default | + |----------------|-------------| + | db_name | coment | + | db_user | coment_user | + | db_pw | coment | + | db_host | 127.0.0.1 | + | db_port | 5432 | + | superuser_name | admin | + | superuser_pw | dev@co-ment | + +These values can be overriden by creating a `custom.yaml` file in the `dev` folder. The file `custom.yaml.tmpl` gives a template for the format of this file. +if the db_host is empty or 'localhost', or '127.0.0.1', the database is considered local to the box and a postgresql server is installed in the virtual server. +Otherwise, the server is considered remote and only the postgresql client libraries are installed on the dev box. +Also in this case, the database (db_name) and user (db_user) are not created automatically. +You must ensure that they are already created on the postgresql server with the adequate authorizations, and that the user can connect on the 'remote' server from the dev box. + +Please refer to the available online documentation for more details on the various tools used here. + + Installation (production environment) -============= +===================================== This README.txt does not cover in details a production environment because this kind of setup is too platform dependant for us to provide a guide. A few tips thought: - recommended way to install it is using apache and wsgi, check out django installation guide at http://www.djangoproject.com/documentation/modpython/ @@ -116,7 +158,7 @@ To use openoffice, on a development setup, you should make sure no openoffice process is left and launch `soffice -headless "-accept=socket,port=2002;urp;"` to start openoffice in background mode. Comt uses -============ +========= Javascript libs used (and license) / shipped with the distribution ------------------------------------------------------------------ diff -r 084934fe912e -r a87316d901be buildout-prod.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildout-prod.cfg Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,11 @@ +[buildout] +extends = buildout.cfg +parts += gunicorn + +[gunicorn] +recipe = zc.recipe.egg:scripts +dependent-scripts = true +eggs = + ${python:eggs} + eventlet + gunicorn diff -r 084934fe912e -r a87316d901be buildout.cfg --- a/buildout.cfg Fri Feb 28 18:53:55 2014 +0100 +++ b/buildout.cfg Sat Mar 01 09:48:26 2014 +0100 @@ -1,16 +1,19 @@ [buildout] newest=false +find-links = http://download.berlios.de/utidylib/uTidylib-0.2.zip parts = django python django-extensions - django-piston + utidylib omelette unzip = true develop = . [versions] django = 1.3 +utidylib = 0.2 +django-tagging = 0.3.1 [python] recipe = zc.recipe.egg @@ -27,36 +30,39 @@ #test = cm pythonpath = src src/cm + extras ${django-extensions:location} - ${django-piston:location} eggs = django-flash django-tagging -# django-piston + django-piston # api dependency # django-css -# chardet + chardet feedparser - PIL + Pillow BeautifulSoup html5lib pytz simplejson pyyaml south -# psycopg2/mysql should be optional dependencies ... possible with buildout ??? -# magic ???????? http://www.jsnp.net/code/magic.py ??? impossible to include this dependency -# utidylib ?????? http://download.berlios.de/utidylib/uTidylib-0.2.zip + psycopg2 + utidylib + cssutils [django-extensions] recipe=zerokspot.recipe.git repository=git://github.com/django-extensions/django-extensions.git #rev=7c73978b55fcadbe2cd6f2abbefbedb5a85c2c8c -[django-piston] -recipe = mercurialrecipe -repository = http://bitbucket.org/jespern/django-piston + +[utidylib] +recipe = zc.recipe.egg +eggs = uTidylib + [omelette] recipe = collective.recipe.omelette eggs = ${django:eggs} + diff -r 084934fe912e -r a87316d901be dev/Vagrantfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/Vagrantfile Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,125 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# 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 = "wheezy-73-x64" + + # The url from where the 'config.vm.box' box will be fetched if it + # doesn't already exist on the user's system. + config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-puppet.box" + + # 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: 80, host: 8080 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + config.vm.network :private_network, ip: "172.16.1.2" + + # 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 "../", "/srv/comt" + + config.vm.define :coment_dev do |coment_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| + vb.name = "coment_dev" + # # 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 + # + # View the documentation for the provider you're using for more + # information on available options. + + # 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 base.pp in the manifests_path directory. + # + # An example Puppet manifest to provision the message of the day: + # + # # group { "puppet": + # # ensure => "present", + # # } + # # + # # File { owner => 0, group => 0, mode => 0644 } + # # + # # file { '/etc/motd': + # # content => "Welcome to your Vagrant-built virtual machine! + # # Managed by Puppet.\n" + # # } + # + 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.options = "--debug --verbose --hiera_config /vagrant/hiera.yaml " + 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 diff -r 084934fe912e -r a87316d901be dev/custom.yaml.tmpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/custom.yaml.tmpl Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,9 @@ +--- +sysconfig::params::db_name : coment_custom +sysconfig::params::db_user : coment_user_cutom +sysconfig::params::db_pw : coment_pw_custom +sysconfig::params::db_host : 127.0.0.1_custom +sysconfig::params::db_port : 5433 + +sysconfig::params::superuser_name : admin_custom +sysconfig::params::superuser_pw : dev@co-ment_custom \ No newline at end of file diff -r 084934fe912e -r a87316d901be dev/hiera.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/hiera.yaml Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,7 @@ +--- +:hierarchy: + - custom +:backends: + - yaml +:yaml: + :datadir: '/vagrant/' \ No newline at end of file diff -r 084934fe912e -r a87316d901be dev/manifests/site.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/manifests/site.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,23 @@ +# upgrade system +class { 'sysconfig::sys_upgrade': } + +# install packages +class { 'sysconfig::packages': require => Class['sysconfig::sys_upgrade'] } + +# install postgres +class { 'sysconfig::postgresql': require => Class['sysconfig::sys_upgrade'] } + +# install nginx +class { 'sysconfig::nginx': require => Class['sysconfig::sys_upgrade'] } + +# create python +class { 'sysconfig::buildout': require => [Class['sysconfig::packages'], Class['sysconfig::postgresql']] } + +# write config +class { 'sysconfig::config': require => Class['sysconfig::buildout'] } + +# write django_init +class { 'sysconfig::django_init': require => Class['sysconfig::config'] } + +# deploy +class { 'sysconfig::deploy': require => [ Class['sysconfig::django_init'], Class['sysconfig::nginx'], Class['sysconfig::postgresql'] ] } diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/buildout.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/buildout.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,18 @@ +class sysconfig::buildout { + + exec { + 'bootstrap': + command => '/usr/bin/python bootstrap.py', + cwd => '/srv/comt', + creates => '/srv/comt/bin', + user => 'vagrant'; + 'buildout': + command => '/srv/comt/bin/buildout -c /srv/comt/buildout-prod.cfg', + cwd => '/srv/comt', + timeout => 0, + creates => '/srv/comt/bin/gunicorn'; + } + + Exec['bootstrap'] -> Exec['buildout'] + +} diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/config.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/config.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,29 @@ +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/comt/src/cm/settings_local.py", + replace => 'no', + owner => 'vagrant', + group => 'vagrant', + mode => 644, + content => template('sysconfig/settings_local.erb'), + } + + file { 'media-root': + ensure => 'directory', + path => '/srv/comt/web', + owner => 'www-data', + group => 'www-data', + mode => '0775' + } + +} diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/deploy.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/deploy.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,55 @@ +class sysconfig::deploy { + + # create /var/run/gunicorn folder and insert entry in /etc/rc.local + file { 'run-folder': + path => '/var/run/gunicorn', + ensure => 'directory', + owner => 'www-data', + group => 'www-data', + mode => '0775', + } + + #create run folder for gunicorn + file { 'rc.local': + path => '/etc/rc.local', + ensure => 'present', + mode => 755, + owner => 'root', + group => 'root', + content => template('sysconfig/rc.local.erb') + } + + # install supervidsord + class { 'supervisord': } + + supervisord::program { 'coment' : + command => '/srv/comt/bin/gunicorn -b unix:/var/run/gunicorn/comt.socket cm.wsgi:app', + user => 'www-data', + directory => '/srv/comt', + environment => "PYTHONPATH='/srv/comt/src',PROJECT_PATH='/srv/comt/src/cm'" + } + + exec { 'reload_supervisor' : + command => '/usr/bin/supervisorctl update', + require => Supervisord::Program['coment'] + } + + #add site + nginx::resource::upstream { 'coment_app': + ensure => present, + members => [ 'unix:/var/run/gunicorn/comt.socket' ], + upstream_fail_timeout => 0, + require => Exec['reload_supervisor'] + } + + nginx::resource::vhost { $ipaddress_eth1: + ensure => present, + proxy => 'http://coment_app', + proxy_set_header => ['Host \$http_host'], + vhost_cfg_append => { + 'proxy_redirect' => 'off' + }, + require => Nginx::Resource::Upstream['coment_app'] + } + +} \ No newline at end of file diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/django_init.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/django_init.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,26 @@ +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) +) inherits sysconfig::params { + + notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }-> + + exec { 'syncdb': + command => '/srv/comt/bin/django syncdb --noinput --migrate', + user => 'vagrant' + } + + exec { 'loaddata': + command => '/srv/comt/bin/django loaddata roles_generic', + user => 'vagrant', + 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}')\" | /srv/comt/bin/django shell", + cwd => '/srv/comt', + user => 'vagrant', + onlyif => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | /srv/comt/bin/django shell", + require => Exec['syncdb'] + } +} \ No newline at end of file diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/init.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/init.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,4 @@ + +class sysconfig { +} + diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/nginx.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/nginx.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,6 @@ +class sysconfig::nginx { + # install nginx + class { '::nginx':} + +} + diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/packages.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/packages.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,34 @@ +class sysconfig::packages { + + $coment_pkgs = [ + 'vim', + 'python-setuptools', + 'libpq-dev', + 'python-dev', + 'python-virtualenv', + 'libjpeg8-dev', + 'zlib1g-dev', + 'libtiff5-dev', + 'libfreetype6-dev', + 'liblcms2-dev', + 'libwebp-dev', + 'tcl-dev', + 'tk-dev', + 'python-magic', + 'mercurial', + 'libtidy-dev', + 'libyaml-dev', + 'git-core', + 'pandoc', + 'abiword', + 'libreoffice', + 'libreoffice-script-provider-python', + 'python-uno' + ] + + package { $coment_pkgs: ensure => "installed" } + + #upgrade setuptools + exec { '/usr/bin/easy_install --upgrade setuptools': require => Package[$coment_pkgs]} + +} diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/params.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/params.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,15 @@ +class sysconfig::params { + + $db_name = 'coment' + $db_user = 'coment_user' + $db_pw = 'coment' + $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') + + $superuser_name = 'admin' + $superuser_pw = 'dev@co-ment' + +} diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/postgresql.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/postgresql.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,31 @@ + +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 } + + if $sysconfig::params::db_is_local { + class { 'postgresql::server': } + + postgresql::server::db { $db_name: + user => $db_user, + password => postgresql_password($db_user, $db_pw), + encoding => 'UTF8', + } + } + else { + class { 'postgresql::client': }-> + 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, + } + } +} diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/manifests/sys_upgrade.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/manifests/sys_upgrade.pp Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,21 @@ +class sysconfig::sys_upgrade { + + exec { + 'apt_get_update_sysconfig': + command => '/usr/bin/apt-get update', + timeout => 2400, + returns => [ 0, 100 ]; +# refreshonly => true; + '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['sys-upgrade'] -> Exec['sys-dist-upgrade'] + +} diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/templates/rc.local.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/templates/rc.local.erb Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,19 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +if [ ! -d /var/run/gunicorn ]; then + mkdir /var/run/gunicorn/ + chown www-data:www-data /var/run/gunicorn/ +fi + +exit 0 diff -r 084934fe912e -r a87316d901be dev/modules/sysconfig/templates/settings_local.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/templates/settings_local.erb Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,80 @@ +DEBUG = True +TEMPLATE_DEBUG = DEBUG +CLIENT_DEBUG = DEBUG + +YUI_DEBUG = DEBUG # use expanded yui version (i.e. not -min) +YUI_DISTANT = False + +DATABASES = { + 'default': { + 'ENGINE': '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. + } +} + +SITE_URL = "http://<%= @ipaddress_eth1 %>/" # YOUR_SETTINGS + +DEFAULT_FROM_EMAIL = "me@example.com" # YOUR_SETTINGS + +# destination email for the contact page +CONTACT_DEST = DEFAULT_FROM_EMAIL + +# smtp host +EMAIL_HOST = "localhost" # YOUR_SETTINGS + +TEMPLATE_STRING_IF_INVALID = "NNNNNNNNNOOOOOOOOOOOOOOO" if DEBUG else '' + +# web server writable directory to store Comt uploaded content (text images etc.) +MEDIA_ROOT = '/srv/comt/web' # YOUR_SETTINGS + +# Insert some random text here, +# it will be used to add some randomness to every crypto operation Comt does +SECRET_KEY = '<%= Array.new(50){"abcdefghijklmnopqrstuvwxyz0123456789!@#\$%^&*(-_=+)".split("").sample}.join %>' # YOUR_SETTINGS + +MEDIA_URL = '/site_media/' + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.admin', + 'cm', +# 'django_extensions', + 'tagging', + 'south', +) + +CM_MEDIA_PREFIX = '/cmmedia/' + +ADMIN_MEDIA_PREFIX = '/media/' + +ADMINS = ( + ('Comt admin', CONTACT_DEST), +) + +MANAGERS = ADMINS +SEND_BROKEN_LINK_EMAILS = False + +SERVER_EMAIL = DEFAULT_FROM_EMAIL + +# 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. +DEFAULT_TIME_ZONE = "Europe/Paris" + +# Do not use name/email of co-ment users but rather +# those passed in the request. +# Set this parameter to True when using co-ment from +# a third-party CMS throuch co-ment API. +DECORATED_CREATORS = False + +# Set to TRUE to use Abiword for convertion form and to legacy formats. +# Set to False to use LibreOffice for convertion form and to legacy formats. +USE_ABI = True diff -r 084934fe912e -r a87316d901be src/cm/wsgi.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/wsgi.py Sat Mar 01 09:48:26 2014 +0100 @@ -0,0 +1,11 @@ +import os +import sys + +os.environ['DJANGO_SETTINGS_MODULE'] = 'cm.settings' + +path = os.environ['PROJECT_PATH'] +if path not in sys.path: + sys.path.append(path) + +import django.core.handlers.wsgi +app = django.core.handlers.wsgi.WSGIHandler()