This readme file is instended to explain to mac user how to clone pixelhumain git repo and install required packages
##Installation of required packages
### 1- Be sur to have "brew" installed Brew will let you install easylly component and packages such as mongodb in one command line ;)
If not recognized, install it. If it's recognized, move to step 1.4
brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
To check if there is missing package run and if there is warning, read the warning and apply given related command line. Quite explicit and well written.
brew doctor
brew update
It will let you check package and lib dependencies for pixelhumain git repository
If not recognized, install it. If it's recognized, move to step 2.3
composer.phar
curl -sS https://getcomposer.org/installer | php
2.3- Now, "composer.phar" should be recognized as a valid command on terminal. Run update to be sure you have the last version
composer.phar update
composer.phar self-update
pixelhumain is using mongodb database system
brew install mongodb --with-openssl
To make life easier, install macos version of prefpane to let you easilly start/stop mongodb manually and/or on startup using a simple GUI.
download github prefpane for macos
The "app" will be reachable using macos>system prefences>mongoDB Once prefpane is installed, be sure to start mongoDB
If not recognized, install it. If it's recognized, skip this step 4
git
Install app and install commandline tools during installation process
On mac, the must easiest way is to use MAMP (free version or pro version). You will have a complete control over your php/apache/cache/lib/mysql database elements. Some of us use the pro version to simplify alias and virtual host config. Anyway, feel free to choose the apache/php/mysql version of your choice.
It could be the tricky part. mongo is not always easy to set up with apache as an extension (mongo.so). It depends on your php version, if you are using mamp or not,... Some helpfull link on the net :
- Run this command in a terminal
sudo pecl install mongo
- Modify
php.ini
and add
extension=mongo.so
-
Restart apache
-
Check your phpinfo().
mongo
should be loaded
- Be sure to correctly set up php/pecl/pear When using MAMP on OSX, you need to be sure php,pecl and pear used in terminal are those of MAMP, not those of the OSX system.
which pecl
which pear
which php
If it is not matching those of MAMP, modify your .bash_profile
and add this line
export PATH=/Applications/MAMP/bin/php/php5.4.34/bin:/Applications/MAMP/bin/php/php5.4.34/lib:$PATH
- Run this command line on your terminal
sudo pecl install mongo
php.ini
modification on MAMP
If you are using MAMP PRO, use the Mamp Pro GUI, menu "File">"Modify template">"PHP">"PHP5.4.34" and add it to the template. Mamp Pro will override his php.ini at each apache restart. If you are using MAMP or anything else, check where is the relevant php.ini loaded during apache restart.
-
Save it on your extension php folder. For MAMP it is something like
/Applications/MAMP/bin/php/php5.4.34/lib/php/extensions/no-debug-non-zts-20100525/
If your apache is not running mongo extension, you will have mongodb connexion error on steps bellow (during composer stuff and/or yii app launch). If so, you will need to be strong and find yourself how to install properly mongo on your damned osx system.
These config must be set up :
.htaccess
has to be accepted by your apache configmod_rewrite
has to be activated as apache extension (to be able to run with yiiframework and url rewriting)
Use a folder reachable by your local apache server
mkdir /YOUR_LOCAL_FOLDER_REACHABLE_BY_APACHE/pixelhumain
Go to this webpage and click on clone in desktop
button. it will open your github.app on mac and clone repository
https://github.com/pixelhumain/pixelhumain
Inside your favorite mongo administration tool (robomongo ?) :
- connect to your localhost mongodb
- create a new databased called
pixelhumain
(from robomongo gui, right click on "new connection", then create tabase) - create a user for the db :
pixelhumain
(from robomongo gui, under pixelhumain>users, right click, then "add user", then createpixelhumainuser
)
PixelHumain is using yii as based PHP framework. To be able to run local instance of pixelhumain you need to create local folders (to not commit. Don't be afraid, it is already in ignore list) and customized config files
Create the file .../ph/protected/config/dbconfig.php
with your database name and URL (if you customized database name and/or database system mongo/mysql...)
$dbconfig = array(
'class' => 'mongoYii.EMongoClient',
'server' => 'mongodb://127.0.0.1:27017/',
'db' => 'pixelhumain',
);
You can find an example of dbconfig in the file /ph/protected/config/dbconfig.example.php
PixelHumain is using yii as based PHP framework. To be able to run local instance of pixelhumain you need to create local folders.
(use composer
or composer.phar
depending on the recognized command)
Step 2- (create local cache folders) HAS TO be completed before this step 3.
Launch following commands to initiate the application :
cd path/to/pixelhumain/ph
composer.phar update
composer.phar install
To launch the application, you need to install the module citizenToolKit. See below to see how to install modules.
This module can be found at https://github.com/pixelhumain/citizenToolKit
If you follow previous steps successfully you will be able soon to run ph web app. Try to call
http://localhost/pixelhumain/ph
To make your life easier, feel free to do like most of us : create a virtual host to be able to call http://localhost/ph
or http://local.ph.com
.
If it works, try to run this url. All lights should be green http://localhost/ph/test
##Adding a Module
- at the same level of the
/pixelhumain
folder , create a folder called/modules
/pixelhumain
/ph
/doc ...
/modules
- cd modules
- git clone "any of the module" ex : https://github.com/pixelhumain/communecter
- front end URL :
localhost/pixelhumain/ph/communecter
- api URL :
localhost/pixelhumain/ph/communecter/api
- if any there's any initData to be installed you'll see the prompt
- sometimes you'll need to initData to install test Data sets YOU SUCCEED ! READY TO CODE NOW !
Read the readme.md master file to know details on required apache modules + other details on yii, modules...
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 - Confucius