Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix couple of defects and enhancements: backend service port, css extend error, wrong nginx tap, run require.py without root, nginx user setting, 404 on Chart.min.js, etc #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
111 changes: 66 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]/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://[email protected]/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
```
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions ppmessage/bootstrap/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ppmessage/conf/nginx.conf.ssl.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#user nobody;
user {nginx.user} {nginx.group};
worker_processes 4;

#error_log logs/error.log;
Expand Down
16 changes: 8 additions & 8 deletions ppmessage/conf/nginx.conf.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#user nobody;
user {nginx.user} {nginx.group};
worker_processes 4;

#error_log logs/error.log;
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ppmessage/ppkefu/ppkefu/www/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion ppmessage/scripts/install_brews.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
4 changes: 0 additions & 4 deletions ppmessage/scripts/require.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down