Skip to content

Commit d8d753f

Browse files
committed
Make the dev Vagrant virtual box and the test suite (using the dev vm as target) work again
1 parent 2fd40a9 commit d8d753f

File tree

18 files changed

+263
-82
lines changed

18 files changed

+263
-82
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,14 @@ lib/
2828
local/
2929
mercurial-recipe/
3030

31+
buildout-dev.cfg
32+
dev/modules/
33+
dev/custom.yaml
34+
src/cm/settings_dev.py
35+
test-suite/clean-testserver.sh
36+
test-suite/karma.conf.dev.js
37+
test-suite/node_modules/
38+
test-suite/start-test-suite-dev.sh
39+
test-suite/start-testserver.sh
40+
test-suite/workspace.info.dev.js
41+
test-suite/workspace.info.js

.gitmodules

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[submodule "dev/modules/nginx"]
2+
path = dev/modules/nginx
3+
url = https://github.com/jfryman/puppet-nginx.git
4+
[submodule "dev/modules/stdlib"]
5+
path = dev/modules/stdlib
6+
url = https://github.com/puppetlabs/puppetlabs-stdlib.git
7+
[submodule "dev/modules/apt"]
8+
path = dev/modules/apt
9+
url = https://github.com/puppetlabs/puppetlabs-apt.git
10+
[submodule "dev/modules/postgresql"]
11+
path = dev/modules/postgresql
12+
url = https://github.com/puppetlabs/puppetlabs-postgresql.git
13+
[submodule "dev/modules/supervisord"]
14+
path = dev/modules/supervisord
15+
url = https://github.com/adedommelin/puppet-supervisord.git
16+
[submodule "dev/modules/concat"]
17+
path = dev/modules/concat
18+
url = https://github.com/puppetlabs/puppetlabs-concat.git

README.md

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,25 @@ CC-BY (<http://creativecommons.org/licenses/by/3.0/>) for translation files
7878

7979
4 a) Postgresql
8080

81-
- Install and configure database server [skip this step if use an external database server]
82-
(ubuntu users : `sudo apt-get install postgresql`)
81+
- Install and configure database server [skip this step if use an external database server]
82+
(ubuntu users : `sudo apt-get install postgresql`)
8383

8484
- Install database client
85-
(ubuntu users : `sudo apt-get install postgresql-client`)
85+
(ubuntu users : `sudo apt-get install postgresql-client`)
8686

8787
- Install python database connector: psycopg2
88-
(ubuntu users : `sudo apt-get install python-psycopg2`)
88+
(ubuntu users : `sudo apt-get install python-psycopg2`)
8989

9090
4 b) Mysql
9191

9292
- Install and configure mysql server [skip this step if use an external database server]
93-
(ubuntu users : `sudo apt-get install mysql-server`)
93+
(ubuntu users : `sudo apt-get install mysql-server`)
9494

9595
- Install database client
9696
(ubuntu users : `sudo apt-get install mysql-client`)
9797

9898
- Install python database connector: mysqldb
99-
(ubuntu users : `sudo apt-get install python-mysqldb`)
99+
(ubuntu users : `sudo apt-get install python-mysqldb`)
100100

101101
5. Create a database (we recommend UTF8 encoding) and a read/write access to it. (skip this step if you plan to use a sqlite database)
102102

@@ -107,7 +107,7 @@ CC-BY (<http://creativecommons.org/licenses/by/3.0/>) for translation files
107107
6. Setup the project and get dependencies
108108

109109
- `python bootstrap.py`
110-
- `./bin/buildout`
110+
- `./bin/buildout`
111111

112112
7. Configure Comt to your settings
113113

@@ -130,6 +130,60 @@ CC-BY (<http://creativecommons.org/licenses/by/3.0/>) for translation files
130130
11. Access your Comt instance by pointing your browser to http://127.0.0.1:8000/
131131

132132

133+
## Installation (Vagrant development box)
134+
135+
The second option is to use the vagrant virtual machine defined in the `dev` folder.
136+
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
137+
138+
`$ vagrant up`
139+
140+
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.
141+
142+
The provisioning tool used is Puppet and the manifest (cf `dev/manifests/site.pp`) uses some external modules (c.f. `dev/modules/` except `dev/modules/sysconfig`). These modules are referenced as git submodule. Therefore you mus ensure that all the submodules have been cloned also. There is two ways to make this:
143+
144+
- pass the `--recursive` option to `git clone` when cloning the Co-ment repository :
145+
`$ git clone --recursive https://github.com/co-ment/comt.git`
146+
- or on an existing cloned repository :
147+
`$ git submodule init && git submodule install`
148+
149+
150+
The installation have the following parameters:
151+
- The root of the project is mapped on `/srv/comt` on the dev box.
152+
- The web server is nginx (http://nginx.org/).
153+
- The web pages are served as a wsgi application with gunicorn (http://gunicorn.org/).
154+
- The gunicorn processes are monitored by supervisor (http://supervisord.org/).
155+
- Openoffice is installed but is not launched as an headless instance (althought it could be easily setup with supervisor).
156+
- The dev box uses a virtual network with the ip 172.16.1.2 (this can be changed in the Vagrant config).
157+
- The box is provisioned using puppet (http://puppetlabs.com/).
158+
- Most of the configuration is done in the sysconfig module found in `dev/modules/sysconfig`.
159+
- 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.
160+
161+
Moreover, the following parameters are set :
162+
163+
| var name | default |
164+
|----------------|-------------|
165+
| db_name | coment |
166+
| db_user | coment_user |
167+
| db_pw | coment |
168+
| db_host | 127.0.0.1 |
169+
| db_port | 5432 |
170+
| superuser_name | admin |
171+
| superuser_pw | dev@co-ment |
172+
173+
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.
174+
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.
175+
Otherwise, the server is considered remote and only the postgresql client libraries are installed on the dev box.
176+
Also in this case, the database (db_name) and user (db_user) are not created automatically.
177+
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.
178+
179+
The creation of the virtual machine will create some files in your source tree (`buildout-dev.cfg, test-suite/start-test-suite-dev.js,...`). These files are necessary to the correct operation of the dev virtual machine and should not be touched. They are generated by Puppet during the provisioning of the Vagrant box. If they need to be adapted you will find them in the `sysconfig` puppet module.
180+
Please note that they should not be added to the versioning tool (git) and are currently already ignored.
181+
182+
After you are done with the virtual machine (or if you need to start afresh) they can be cleaned by launching the `clean-testserver.sh` script. Please note that except the files directly managed by Vagrant,the script clean **all** trace of the virtual machine in the source tree, including the buildout `bin` and `egg` folders.
183+
184+
Please refer to the available online documentation for more details on the various tools used here.
185+
186+
133187

134188
## Installation (production environment)
135189

@@ -150,7 +204,7 @@ Upgrading you database should only need one command:
150204

151205
- `./bin/buildout`
152206
- `./bin/django migrate --settings=settings`
153-
207+
154208
### Upgrade from alpha releases
155209

156210
If your database was created using comt alpha prior to the revision 29, here are the commands you should run:
@@ -183,7 +237,7 @@ To use openoffice, on a development setup, you should make sure no openoffice pr
183237
- django <http://www.djangoproject.com/> BSD License
184238
- python magic <http://hupp.org/adam/hg/python-magic> permissive BSD style license
185239
- Beautiful soup <http://www.crummy.com/software/BeautifulSoup/> PSF license
186-
- python-chardet <http://chardet.feedparser.org/> LGPL
240+
- python-chardet <http://chardet.feedparser.org/> LGPL
187241
- python-feedparser <http://feedparser.org/> "Permissive" custom license
188242
- python-imaging <http://www.pythonware.com/products/pil/> http://www.pythonware.com/products/pil/license.htm
189243
- python-pytz
@@ -195,7 +249,7 @@ To use openoffice, on a development setup, you should make sure no openoffice pr
195249
- python-pexpect
196250
- python-cssutils
197251

198-
### Icons
252+
### Icons
199253

200254
Icons derived from FatCow Icon Set (<http://www.fatcow.com/free-icons/index.bml>) (Creative Commons Attribution 3.0 License)
201255

@@ -224,7 +278,7 @@ R3: For this feature (commentator name = drupal login name) to be available, a c
224278
Q4: I get 'import error' when starting the server (step #9)
225279

226280
R4: Make sure you installed all required python dependencies
227-
281+
228282

229283
## Community
230284

@@ -234,7 +288,7 @@ The Comt web site <http://www.co-ment.org/> is the place to ask questions, repor
234288
## How to contribute
235289

236290
We use GitHub as our collaboration tool.
237-
291+
238292
### Reporting issues
239293

240294
Please use the GitHub issue tracker for the project: <>
@@ -269,4 +323,4 @@ Run:
269323

270324
cd src/cm
271325
../../bin/django makemessages -l LG -e .html,.txt
272-
../../bin/django makemessages -d djangojs -l LG
326+
../../bin/django makemessages -d djangojs -l LG

buildout.cfg

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
[buildout]
22
newest=false
3-
parts =
4-
django
5-
python
6-
django-extensions
7-
django-piston
8-
utidylib
9-
omelette
3+
find-links = http://downloads.sourceforge.net/project/utidylib.berlios/uTidylib-0.2.zip
4+
parts =
5+
django
6+
python
7+
django-extensions
8+
utidylib
9+
omelette
1010
unzip = true
1111
develop = .
1212

1313
[versions]
1414
django = 1.3
15+
utidylib = 0.2
1516
django-tagging = 0.3.1
17+
psycopg2 = 2.4.1
1618

1719
[python]
1820
recipe = zc.recipe.egg
19-
interpreter = python-comt
21+
interpreter = python
2022
eggs = ${django:eggs}
2123

2224
[django]
@@ -28,44 +30,39 @@ wsgi = true # gen wsgi
2830
settings = settings
2931
#test = cm
3032
pythonpath = src
31-
src/cm
32-
${django-extensions:location}
33-
${django-piston:location}
34-
${utidylib:location}
35-
eggs =
36-
django-flash
37-
django-tagging
38-
# django-piston
33+
src/cm
34+
extras
35+
${django-extensions:location}
36+
eggs =
37+
django-flash
38+
django-tagging
39+
django-piston
3940
# api dependency
40-
# django-css
41-
# chardet
42-
feedparser
43-
Pillow # Was PIL
44-
BeautifulSoup
45-
html5lib
46-
pytz
47-
simplejson
48-
pyyaml
49-
south
50-
python-memcached
51-
psycopg2
52-
chardet
53-
# psycopg2/mysql should be optional dependencies ... possible with buildout ???
54-
# magic ???????? http://www.jsnp.net/code/magic.py ??? impossible to include this dependency
55-
# utidylib ?????? http://download.berlios.de/utidylib/uTidylib-0.2.zip
41+
# django-css
42+
chardet
43+
feedparser
44+
Pillow
45+
BeautifulSoup
46+
html5lib
47+
pytz
48+
simplejson
49+
pyyaml
50+
south
51+
psycopg2
52+
utidylib
53+
cssutils
54+
pexpect
5655

5756
[django-extensions]
5857
recipe=zerokspot.recipe.git
5958
repository=git://github.com/django-extensions/django-extensions.git
6059
#rev=7c73978b55fcadbe2cd6f2abbefbedb5a85c2c8c
6160

62-
[django-piston]
63-
recipe = mercurialrecipe
64-
repository = http://bitbucket.org/jespern/django-piston
6561

6662
[utidylib]
67-
recipe=zerokspot.recipe.git
68-
repository=https://github.com/xdissent/utidylib.git
63+
recipe = zc.recipe.egg
64+
eggs = uTidylib
65+
6966

7067
[omelette]
7168
recipe = collective.recipe.omelette

dev/clean_dev.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ ROOTPATH="$SCRIPTPATH/.."
88

99
pushd "$ROOTPATH" > /dev/null
1010

11-
rm -rf .installed.cfg .mr.developer.cfg parts/ eggs/ develop-eggs/ bin/ \
12-
src/cm/settings_local.py src/cm/settings_dev.py test-suite/workspace.info*.js \
11+
rm -rf .installed.cfg .mr.developer.cfg buildout-dev.cfg parts/ eggs/ \
12+
develop-eggs/ bin/ src/cm/settings_local.py src/cm/settings_dev.py \
13+
test-suite/workspace.info*.js \
1314
test-suite/{clean-testserver.sh,karma.conf.dev.js} \
1415
test-suite/{start-test-suite-dev.sh,start-testserver.sh}
1516

1617
find . -name '*.pyc' -or -name '*.egg-info' | xargs rm -rvf
1718

1819
popd > /dev/null
19-

dev/modules/apt

Submodule apt added at 2873c1e

dev/modules/concat

Submodule concat added at 7ed3f56

dev/modules/nginx

Submodule nginx added at 1620e18

dev/modules/postgresql

Submodule postgresql added at 0caf8a5

dev/modules/stdlib

Submodule stdlib added at 4700f16

0 commit comments

Comments
 (0)