# HG changeset patch # User ymh # Date 1393577712 -3600 # Node ID 8e9ea314e06e27b8c190fa867381ed8841258434 # Parent a1aa29e7809fdc20500dc49f3c9b8b79b32987c9 dev box bug correction + minimal doc in README.txt diff -r a1aa29e7809f -r 8e9ea314e06e README.txt --- a/README.txt Thu Feb 27 23:19:13 2014 +0100 +++ b/README.txt Fri Feb 28 09:55:12 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 a1aa29e7809f -r 8e9ea314e06e dev/Vagrantfile --- a/dev/Vagrantfile Thu Feb 27 23:19:13 2014 +0100 +++ b/dev/Vagrantfile Fri Feb 28 09:55:12 2014 +0100 @@ -82,6 +82,7 @@ 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 diff -r a1aa29e7809f -r 8e9ea314e06e dev/modules/sysconfig/manifests/config.pp --- a/dev/modules/sysconfig/manifests/config.pp Thu Feb 27 23:19:13 2014 +0100 +++ b/dev/modules/sysconfig/manifests/config.pp Fri Feb 28 09:55:12 2014 +0100 @@ -6,7 +6,7 @@ $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 } + 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', diff -r a1aa29e7809f -r 8e9ea314e06e dev/modules/sysconfig/manifests/deploy.pp --- a/dev/modules/sysconfig/manifests/deploy.pp Thu Feb 27 23:19:13 2014 +0100 +++ b/dev/modules/sysconfig/manifests/deploy.pp Fri Feb 28 09:55:12 2014 +0100 @@ -42,10 +42,10 @@ require => Exec['reload_supervisor'] } - nginx::resource::vhost { '172.16.1.2': + nginx::resource::vhost { $ipaddress_eth1: ensure => present, proxy => 'http://coment_app', - proxy_set_header => ['Host $http_host'], + proxy_set_header => ['Host \$http_host'], vhost_cfg_append => { 'proxy_redirect' => 'off' }, diff -r a1aa29e7809f -r 8e9ea314e06e dev/modules/sysconfig/manifests/django_init.pp --- a/dev/modules/sysconfig/manifests/django_init.pp Thu Feb 27 23:19:13 2014 +0100 +++ b/dev/modules/sysconfig/manifests/django_init.pp Fri Feb 28 09:55:12 2014 +0100 @@ -1,9 +1,9 @@ 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 } + notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }-> exec { 'syncdb': command => '/srv/comt/bin/django syncdb --noinput --migrate', @@ -17,10 +17,10 @@ } 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', + 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', - unless => '/bin/echo "from django.contrib.auth.models import User; exit(0) if User.objects.filter(username=\'$superuser_name\').count() else exit(1)" | /srv/comt/bin/django shell', - require => Exec['syncdb'] + 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 a1aa29e7809f -r 8e9ea314e06e dev/modules/sysconfig/templates/settings_local.erb --- a/dev/modules/sysconfig/templates/settings_local.erb Thu Feb 27 23:19:13 2014 +0100 +++ b/dev/modules/sysconfig/templates/settings_local.erb Fri Feb 28 09:55:12 2014 +0100 @@ -10,13 +10,13 @@ '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': '<%= @sdb_pw %>', # 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://172.16.1.2/" # YOUR_SETTINGS +SITE_URL = "http://<%= @ipaddress_eth1 %>/" # YOUR_SETTINGS DEFAULT_FROM_EMAIL = "me@example.com" # YOUR_SETTINGS