README.md 6.78 KB
Newer Older
Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
1
Pixel Humain
Tibor Katelbach's avatar
Tibor Katelbach committed
2
===========
Tibor Katelbach's avatar
Tibor Katelbach committed
3

4 5 6 7 8
## Requierement
Php version : 5.4.X (minimum)
MongoDB : 2.6.X (tested version - minimum)
Mongo Driver : 1.4.5 (tested version - minimum)

9

Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
10
##Installation
11 12 13 14 15 16 17
####Configure your php
Verify your php configuration is right done lauching the command line
```
php --ini
```
The php.ini specified in the "Loaded Configuration File" option should be the right one.
Check in this php.ini file the openssl extension is activated.
18

Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
19
####must install a Php webserver
Sylvain's avatar
Sylvain committed
20 21 22 23 24 25
Choose your favorite webserver (apache) or package (easyPhp, Wamp...)
Edit the httpd.conf file and activate the line
```
LoadModule rewrite_module modules/mod_rewrite.so
```

Tibor Katelbach's avatar
Tibor Katelbach committed
26
# On Unix like OS : Linux Ubuntu, Debian  :
Marc Farré's avatar
Marc Farré committed
27 28
* [Step by step install CO2 on Ubuntu 16.04](https://wiki.communecter.org/en/installing-communect-on-ubuntu-16.04.html)
* [special for Debian Automated install script (not updated for CO2)](https://github.com/tech62/pixelhumain/blob/e574fa0a533d3d994960b2abc5ebfb38a7292ab4/installdebian.sh)
Tibor Katelbach's avatar
Tibor Katelbach committed
29

Tibor Katelbach's avatar
Tibor Katelbach committed
30 31 32 33 34 35 36 37 38 39
## Otherwise 
 * Same rules as windows but choose a .so driver instead of a dll one.
 * [Here's a good doc](http://tech.enekochan.com/2013/10/22/install-mongodb-in-ubuntu-12-04/)
 * [manuel d'installation officiel PHP](http://www.php.net/manual/fr/mongo.installation.php)

# On Windows OS :
* Get the dll from here https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
* Download the 1.4.5 mongo driver version (php_mongo-1.4.5.zip)
* Extract the zip file.
* The right version driver depends on the version of php you're running with.
40 41 42 43
Saying 5.X is your php version, choose the file :
```
if (X<5)
 php_mongo-1.4.5-5.X-vc9.dll
Sylvain's avatar
Sylvain committed
44
else
45
 php_mongo-1.4.5-5.X-vc11.dll
Sylvain's avatar
Sylvain committed
46
```
47 48 49
 * Important : if you'are running with a 64bits platform choose the file with 'x86_64' in it.
 * Copy the dll file in your directory : %php_dir%/ext
 * In the php.ini add (the name of the dll file depends on your php install version) :
sylvain.barbot's avatar
sylvain.barbot committed
50
```
Tibor Katelbach's avatar
Tibor Katelbach committed
51 52
for php 5.5
extension=php_mongo-1.4.5-5.5-vc11.dll
53
or
Tibor Katelbach's avatar
Tibor Katelbach committed
54 55
for php 5.3
extension=php_mongo-1.4.1-5.3-vc9.dll
sylvain.barbot's avatar
sylvain.barbot committed
56
```
Tibor Katelbach's avatar
Tibor Katelbach committed
57

Tibor Katelbach's avatar
Tibor Katelbach committed
58 59 60 61
# On Mac
If you are on mac OSX, read this readme first :
[Specific readme_macOS.md for Mac OSX](https://github.com/pixelhumain/pixelhumain/blob/master/README_macOs.md/)

Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
62 63 64
####install a mongo Database instance and admin tool
- [Mongo installation](http://docs.mongodb.org/manual/installation/)
- [Mongo administration-interfaces](http://docs.mongodb.org/ecosystem/tools/administration-interfaces/)
65
- [many of us use ROBOMONGO](http://robomongo.org/)
66
- launch Mongo localy :
Sylvain's avatar
Sylvain committed
67
```
68
mongod --dbpath data/db
Sylvain's avatar
Sylvain committed
69
```
70
- inside your favorite mongo administration tool :
Sylvain's avatar
Sylvain committed
71
- create a database called pixelhumain
72
- create a user for the db : pixelhumain
73
- you can do this the simple mongo
74 75
 - use pixelhumain
 - db.addUser( "pixelhumain","pixelhumain" )
Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
76

Sylvain's avatar
Sylvain committed
77 78
####Composer installation
PixelHumain is set with composer in order to manage dependencies and libraries.
Tibor Katelbach's avatar
Tibor Katelbach committed
79
- [Clone](https://github.com/pixelhumain/pixelhumain) the repository in order to recover the files
Sylvain's avatar
Sylvain committed
80
- If you don't have it get the composer (https://getcomposer.org/)
81
- Create the file /ph/protected/config/dbconfig.php with your database name and URL. 
82 83 84 85
```
$dbconfig = array(
    'class' => 'mongoYii.EMongoClient',
    'server' => 'mongodb://127.0.0.1:27017/',
86
    'db' => 'pixelhumain',
87 88
);
```
89
You can find an example of dbconfig in the file /ph/protected/config/dbconfig.example.php
90 91
- Launch following commands to initiate the application :
in
92 93
cd path/to/pixelhumain/ph
where you'll find composer.json
Sylvain's avatar
Sylvain committed
94 95 96 97 98
```
composer update
...
composer install
```
Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
99

100 101 102 103
####Add the module citizenToolKit

To launch the application, you need to install the module citizenToolKit. See below to see how to install modules.

Tibor Katelbach's avatar
Tibor Katelbach committed
104 105
####Launch the application
- Launch you http webserver
106
- depending on how you webservers alias is configured here the alias is called ''ph'' and pointing to the folder you cloned test this url :
Tibor Katelbach's avatar
Tibor Katelbach committed
107 108 109 110
http://localhost:8080/ph/index.php/test

- All the first line should be green.

Tibor Katelbach's avatar
Tibor Katelbach committed
111
right now you can access the application like 127.0.0.1/ph/index.php/anyModule
112
to remove the index.php you'll need to configure your http.conf like this
Tibor Katelbach's avatar
Tibor Katelbach committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
```
Alias "/ph" "pathToProjectFolder/pixelhumain/ph"
<Directory "pathToProjectFolder/pixelhumain/ph">
Options FollowSymLinks Indexes
AllowOverride none
Order deny,allow
Allow from 127.0.0.1
deny from all
<IfModule mod_rewrite.c>
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /ph/index.php/$1 [L]
</IfModule>
</Directory>
```

Tibor Katelbach's avatar
Tibor Katelbach committed
133 134
####Adding a Module
- at the same level of the /pixelhumain folder , create a folder called /modules
Tibor Katelbach's avatar
Tibor Katelbach committed
135 136
```
/pixelhumain
137 138
 /ph
 /doc ...
Tibor Katelbach's avatar
Tibor Katelbach committed
139 140
/modules
```
141 142 143
- cd modules
- git clone "any of the modules". Currently maintained modules are:
  *  https://github.com/pixelhumain/communecter
sylvainbarbot's avatar
sylvainbarbot committed
144
  *  https://github.com/pixelhumain/citizenToolKit
145
  *  https://github.com/pixelhumain/opendata
Tibor Katelbach's avatar
Tibor Katelbach committed
146 147
  *  https://github.com/pixelhumain/api
  
Tibor Katelbach's avatar
Tibor Katelbach committed
148 149
- front end URL : 127.0.0.1/ph/communecter
- api URL : 127.0.0.1/ph/communecter/api
150
- if any there's any initData to be installed you'll see the prompt
Tibor Katelbach's avatar
Tibor Katelbach committed
151
- sometimes you'll need to initData to install test Data sets
152 153 154 155 156 157 158 159

## Init Data Base

Change to the folder modules/communecter/data is run the following commands:
 - mongoimport --db pixelhumain --collection cities cities.json --jsonArray;
 - mongoimport --db pixelhumain --collection lists lists.json --jsonArray ;


Sylvain's avatar
Sylvain committed
160
YOU SUCCEED ! READY TO CODE NOW !
Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
161

162
####Understanding the structure and Yii
Tibor Katelbach's avatar
Tibor Katelbach committed
163 164
Now you can follow urls to understand and dive into the code, which is a fairly standard and simple MVC
ex : 127.0.0.1/ph/communecter/person/profile
165
- "communecter" is the module
Tibor Katelbach's avatar
Tibor Katelbach committed
166 167 168
- "person" is the controller file called PersonController.php
- "profile" is the action foun called actionProfile found in the above controller file

169

Tibor Katelbach's avatar
Tibor Katelbach committed
170 171 172
### Valuing States Structure
* page region  : List all Counties with minimal descritption
* city page : List local actors(directory), local Places
173
* people page :
Tibor Katelbach's avatar
Tibor Katelbach committed
174

175
##Roadmap short term
Tibor Katelbach's avatar
Tibor Katelbach committed
176 177 178
* add a person/citizen
* add and Association, Company
* add a State entity (city, county...)
Tibor Katelbach's avatar
Tibor Katelbach committed
179

Tibor Katelbach's avatar
Tibor Katelbach committed
180
##Document before coding
181 182
Make a good habit of writing a doc or a doc corrected before embarking in the code.
This avoids a tedious task of writing a doc after hit.
Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
183

184 185
##More info
* [Specific readme.md for Mac OSX](https://github.com/pixelhumain/pixelhumain/blob/master/README_macOs.md/)
Tibor Katelbach's avatar
doc  
Tibor Katelbach committed
186 187 188
* [le site](http://www.pixelhumain.com/)
* [le blog](http://blog.pixelhumain.com/)
* [group Facebook](https://www.facebook.com/groups/pixelhumain/)
189 190 191 192 193 194 195 196 197 198 199


<br/>
<br/>

---

<br/>
<br/>


Tibor Katelbach's avatar
Tibor Katelbach committed
200 201 202 203
Help keep this project alive
===========
contribute or Join the NGO on [Hello Asso](https://www.helloasso.com/associations/open-atlas/adhesions/soutenez-et-adherez-a-open-atlas)

204 205 206
##Version 0.002
    L'homme qui déplace une montagne commence par déplacer les petites pierres.- Confucius
    Man who wants to move a mountain starts by moving pebbles