From 6af6c0927ebe98406a4bc5719e59cf76f3a468a1 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 10:50:57 +0800 Subject: [PATCH 1/8] fix wrong backend service ports in nginx conf template file. the backend service ports in nginx conf template should follow supervisord.nginx.conf. --- ppmessage/conf/nginx.conf.template | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ppmessage/conf/nginx.conf.template b/ppmessage/conf/nginx.conf.template index d8463556..61f919bd 100644 --- a/ppmessage/conf/nginx.conf.template +++ b/ppmessage/conf/nginx.conf.template @@ -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 { From 3625e5e9c66e8376d3d319029706789604fbb6cf Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 11:19:37 +0800 Subject: [PATCH 2/8] fix defect: img.icon-40-raw was not found when do gulp. .icon-40 is extending a non-exist selector in www/scss/_base.scss. --- ppmessage/ppkefu/ppkefu/www/scss/_base.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From 65fca8a9f76a8311468ee0509b6467748f90155b Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 11:31:26 +0800 Subject: [PATCH 3/8] fix defect: homebrew/nginx doesn't have upload module. nginx upload module is available in nginx-full which is in tap denji/nginx. --- README.md | 2 +- ppmessage/scripts/install_brews.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 83c5b45d..eb8c92f7 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ PPConsole is Web user interface of PPMessage and open sourced as well. After PPM ```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 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/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" ] From 566ecd434bbff3a25c5d0669a576ba5be0a44d9d Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 13:20:33 +0800 Subject: [PATCH 4/8] fix defect: under either root or non-root, require.py always run into failure. manos brew doesn't allow to be run under root, but require.py requires being executed under root. --- README.md | 4 +--- ppmessage/scripts/require.py | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index eb8c92f7..5e4cb798 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,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 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] From 882758de45a3861f1fa9661e07eac107e7de097e Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 13:33:56 +0800 Subject: [PATCH 5/8] enhancement: add "user" setting to nginx config. without a proper setting for nginx user, nginx process won't have permission to access to upload path, default is /usr/local/opt/ppmessage, hence uploading files in chat will fail. --- ppmessage/bootstrap/config.py | 2 ++ ppmessage/conf/nginx.conf.ssl.template | 2 +- ppmessage/conf/nginx.conf.template | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) 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 61f919bd..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; From bd4771b12e875a52bb7c148ac9eb78da99f2e0d6 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 13:39:13 +0800 Subject: [PATCH 6/8] fix defect: HTTP error 404 on Chart.min.js somehow bower generated web files refer to Chart.min.js which does not exist instead of Chart.js. didn't find a way to fix this in the source, as a patch, add a step to README to copy this file. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 5e4cb798..d04a64f3 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,16 @@ 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 +``` + ### Check PPCOM Use your browser open your server url which has been configed in config.py file. From 76d1f8e65f66c918820f1f6ba06e1964fd38949e Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 13:40:24 +0800 Subject: [PATCH 7/8] add missing step to README: starting nginx service --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d04a64f3..ad22a247 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,13 @@ Manually copy it from `Chart.js` if it does not exist. 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. From 1f5bc40644bf09bfbe0cbdde2e2b90518403e727 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Aug 2018 13:41:22 +0800 Subject: [PATCH 8/8] enhancement: make README more readable. --- README.md | 90 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index ad22a247..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 denji/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 ```