diff --git a/README.md b/README.md index 83c5b45d..cbbdddcc 100644 --- a/README.md +++ b/README.md @@ -16,57 +16,63 @@ PPConsole is Web user interface of PPMessage and open sourced as well. After PPM ## Run PPMessage on Mac OS X -### Requirements +### Get PPMessage -* Homebrew - * Download and install from [http://brew.sh](http://brew.sh) - ```Bash - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - ``` - - * Install command ```Bash - brew install hg autoconf libtool automake redis libmagic mysql libjpeg libffi fdk-aac lame mercurial - brew tap homebrew/services - brew tap homebrew/nginx - brew install nginx-full --with-upload-module - brew install ffmpeg --with-fdk-aac --with-opencore-amr --with-libvorbis --with-opus + git clone https://github.com/alexzhangs/ppmessage ``` +### Requirements + +* Homebrew, nginx-full and other dependencies + * Manual installation + * Download and install Homebrew from [http://brew.sh](http://brew.sh) + ```Bash + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + ``` + + * Install nginx-full and other dependencies + ```Bash + brew install hg autoconf libtool automake redis libmagic mysql libjpeg libffi fdk-aac lame mercurial + brew tap homebrew/services + brew tap denji/nginx-full + brew install nginx-full --with-upload-module + brew install ffmpeg --with-fdk-aac --with-opencore-amr --with-libvorbis --with-opus + ``` + * Or use `ppmessage/scripts/install_brews.py` to install automatically -* Manual download - * Apns-client source - ```Bash - hg clone https://dingguijin@bitbucket.org/dingguijin/apns-client - cd ./apns-client; sudo -H python setup.py install; cd - - ``` - * Geolite2 library source - ```Bash - git clone --recursive https://github.com/maxmind/libmaxminddb - cd libmaxmindb; ./bootstrap; ./configure; make; make install; cd - - ``` +* Apns-client source +```Bash + hg clone https://dingguijin@bitbucket.org/dingguijin/apns-client + cd ./apns-client; sudo -H python setup.py install; cd - +``` +* Geolite2 library source +```Bash + git clone --recursive https://github.com/maxmind/libmaxminddb + cd libmaxmindb; ./bootstrap; ./configure; make; make install; cd - +``` - * Geolite2 DB (assuming you have cloned the ppmessage source, and under the root `ppmessage` directory.) - ```Bash - cd ppmessage/api/geolite2 - wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz - gunzip GeoLite2-City.mmdb.gz - cd - - ``` - > sh ppmessage/scripts/download_geolite2.sh is an alternative scripts way which PPMessage provides. +* Geolite2 DB (assuming you have cloned the ppmessage source, and under the root `ppmessage` directory.) +```Bash + cd ppmessage/api/geolite2 + wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz + gunzip GeoLite2-City.mmdb.gz + cd - +``` +> sh ppmessage/scripts/download_geolite2.sh is an alternative scripts way which PPMessage provides. - * Mysql connector python - ```Bash - wget -c http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz - tar zxvf mysql-connector-python-2.1.3.tar.gz - cd mysql-connector-python-2.1.3 - sudo python setup.py install - cd - - ``` +* Mysql connector python +```Bash + wget -c http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz + tar zxvf mysql-connector-python-2.1.3.tar.gz + cd mysql-connector-python-2.1.3 + sudo python setup.py install + cd - +``` -* Python pip - * Install command +* Python dependencies + * Manual Installation ```Bash sudo -H pip install AxmlParserPY beautifulsoup4 biplist certifi cffi chardet cryptography evernote filemagic geoip2 green identicon ipaddr jieba matplotlib maxminddb numpy paho-mqtt paramiko Pillow ppmessage-mqtt pyOpenSSL pyparsing pypinyin python-dateutil python-gcm qiniu qrcode readline redis requests rq scikit-learn scipy six SQLAlchemy supervisor tornado xlrd ``` @@ -97,10 +103,8 @@ PPConsole is Web user interface of PPMessage and open sourced as well. After PPM #### Check the requirements are ready or not. -> require.py needs super user permission - ```Bash - sudo python ppmessage/scripts/require.py + python ppmessage/scripts/require.py ``` #### Use your text editor (vim/emacs/sublime) to edit the config file in PPMessage @@ -155,6 +159,23 @@ PPConsole is Web user interface of PPMessage and open sourced as well. After PPM sh dist.sh log ``` +### Patch Chart.js + +Somehow generated web files refer to `Chart.min.js` instead of `Chart.js`. +Manually copy it from `Chart.js` if it does not exist. + +```Bash + cp -a ppmessage/ppconsole/static/bower_components/Chart.js/Chart.js +ppmessage/ppconsole/static/bower_components/Chart.js/Chart.min.js +``` + +### Start/Stop Nginx server + +```Bash +sudo brew services start nginx-full +sudo brew services stop nginx-full +``` + ### Check PPCOM Use your browser open your server url which has been configed in config.py file. diff --git a/ppmessage/bootstrap/config.py b/ppmessage/bootstrap/config.py index a18af067..a0827877 100644 --- a/ppmessage/bootstrap/config.py +++ b/ppmessage/bootstrap/config.py @@ -51,6 +51,8 @@ # nginx conf "nginx": { + "user": "nobody", # change this to your appreciated user, otherwise upload won't work + "group": "nobody", # change this with "user" accordingly "nginx_conf_path": "/usr/local/etc/nginx/nginx.conf", "server_name": ["ppmessage.com", "www.ppmessage.com"], "listen": "8080", #80 diff --git a/ppmessage/conf/nginx.conf.ssl.template b/ppmessage/conf/nginx.conf.ssl.template index 0621ee1f..462c35ed 100644 --- a/ppmessage/conf/nginx.conf.ssl.template +++ b/ppmessage/conf/nginx.conf.ssl.template @@ -1,5 +1,5 @@ -#user nobody; +user {nginx.user} {nginx.group}; worker_processes 4; #error_log logs/error.log; diff --git a/ppmessage/conf/nginx.conf.template b/ppmessage/conf/nginx.conf.template index d8463556..f2c91dad 100644 --- a/ppmessage/conf/nginx.conf.template +++ b/ppmessage/conf/nginx.conf.template @@ -1,5 +1,5 @@ -#user nobody; +user {nginx.user} {nginx.group}; worker_processes 4; #error_log logs/error.log; @@ -54,29 +54,29 @@ http { } upstream ppcom_backends { - server 127.0.0.1:21000; + server 127.0.0.1:20500; } upstream pcsocket_backends { - server 127.0.0.1:21100; + server 127.0.0.1:20600; } upstream monitor_backends { - server 127.0.0.1:21200; + server 127.0.0.1:20700; } upstream pphome_backends { - server 127.0.0.1:21300; + server 127.0.0.1:20800; } upstream ppauth_backends { - server 127.0.0.1:21400; + server 127.0.0.1:20900; } upstream ppconsole_user_backends { - server 127.0.0.1:21500; + server 127.0.0.1:21000; } - + # end of backends server { diff --git a/ppmessage/ppkefu/ppkefu/www/scss/_base.scss b/ppmessage/ppkefu/ppkefu/www/scss/_base.scss index 01366551..c24c673b 100644 --- a/ppmessage/ppkefu/ppkefu/www/scss/_base.scss +++ b/ppmessage/ppkefu/ppkefu/www/scss/_base.scss @@ -57,7 +57,7 @@ body, p, pre, input, h2, textarea, span { } .icon-40 { - @extend img.icon-40-raw; + @extend .icon-40-raw; @include icon-left; } diff --git a/ppmessage/scripts/install_brews.py b/ppmessage/scripts/install_brews.py index 1a0096c1..ddde27dc 100644 --- a/ppmessage/scripts/install_brews.py +++ b/ppmessage/scripts/install_brews.py @@ -43,7 +43,7 @@ def _install(): install_cmds = [ "brew tap homebrew/services", - "brew tap homebrew/nginx", + "brew tap denji/nginx", "brew install nginx-full --with-upload-module", "brew install ffmpeg --with-fdk-aac --with-opencore-amr --with-libvorbis --with-opus" ] diff --git a/ppmessage/scripts/require.py b/ppmessage/scripts/require.py index 17eeae70..c34df649 100644 --- a/ppmessage/scripts/require.py +++ b/ppmessage/scripts/require.py @@ -96,10 +96,6 @@ def _require_ppmessage_pth(): _color_print("python packages path not found.") sys.exit() - if 0 != os.getuid(): - _color_print("need root privilege") - sys.exit() - current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = current_dir.split(os.path.sep) current_dir = current_dir[:-2]