XPUSH, Installation & Run

Updated: April 25, 2014.

There are two methods to install XPUSH, one methods is that install with NPM( Node Package Manger), another way is that download and run the image file of the Docker, you can install it by selecting one of the two.

Installation with npm

XPUSH based on nodejs. You can easily install the XPUSH through the npm.

1. Prepare

To use the XPUSH is, nodejs, zookeeper, redis , mongodb is required .

The following is how to install 64bit linux. Please install to suit your environment. If you have already been installed, the xpush installation immediately please.

nodejs

nodejs installation by referring to Download and unzip the nodejs.

mkdir -p $HOME/xpush
cd $HOME/xpush
wget http://nodejs.org/dist/v0.10.32/node-v0.10.32-linux-x64.tar.gz
tar zvf node-v0.10.32-linux-x64.tar.gz

Set the PATH environment variable so that you can use the node and npm to global.

PATH=$HOME/xpush/node-v0.10.32-linux-x64/bin:$PATH

zookeeper

Install and run zookeeper with reference Zookeeper installation.

The following is the code to install and run the zookeeper3.4.6.

cd $HOME/xpush
wget http://apache.mirror.cdnetworks.com/zookeeper/stable/zookeeper-3.4.6.tar.gz
tar xvf zookeeper-3.4.6.tar.gz

cp zookeeper-3.4.6/conf/zoo_sample.cfg zookeeper-3.4.6/conf/zoo.cfg
cd zookeeper-3.4.6/bin
./zkServer.sh start

redis

Install and run redis with reference Redis installation.

The follow is the code to install and run redis 2.8.14.

cd $HOME/xpush
wget http://download.redis.io/releases/redis-2.8.14.tar.gz
tar xzf redis-2.8.14.tar.gz
cd redis-2.8.14
make

src/redis-server
(daemon : $ nohup src/redis-server & )

mongodb

Install and run mongodb with reference Mongodb installation.

The follow is the code to install and run redis 2.6.4

cd $HOME/xpush
wget --no-check-certificate https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
tar xzf mongodb-linux-x86_64-2.6.4.tar.gz

cd mongodb-linux-x86_64-2.6.4
mkdir db
mkdir logs
bin/mongod --fork --dbpath db --logpath logs

NOte: use –smallfiles option if disk space less than 3379MB

bin/mongod --dbpath db --smallfiles

imageMagick

Install and run imageMagicK with reference Imagemagick installation.

The follow is the code install and run imageMagick.

CentOS

yum -y install ImageMagick-c++ ImageMagick-c++-devel

ubuntu

apt-get install imagemagick

Install from Source

wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-6.8.9-8
./configure && make && sudo make install
sudo ldconfig /usr/local/lib
sudo ln -s /usr/local/bin/convert /usr/bin/convert


2. Install xpush

When you are all ready, please install the xpush. If not ready, please make sure the preparation. You can use the -g option it is recommended that you install to the global.

Install with npm

npm install -g xpush

Note: If the node-gyp rebuild error occurs, when version of node-gyp is 0.10.10 node.js is 0.8.xx, gyp can not re-build the package for different versions. In such a case, you can install it using the npm by erasing the $ HOME / .node-gyp folder node-gyp to new.

npm install -g node-gyp

Install from github

To install the latest development version, please install directly using the git.

git clone https://github.com/xpush/node-xpush.git
cd node-xpush
npm install


3. Run xpush

Please run the session server. For more options, please make sure the here.

cd $HOME/xpush/node_modules/xpush
bin/xpush --port 8000 --config ./config/config.server.sample.json --session

Please run the channel server. For more options, please make sure the here.

cd $HOME/xpush/node_modules/xpush
bin/xpush --port 9000 --config ./config/config.server.sample.json



Installation with docker

XPUSH the image of Docker has been registered. You will be able to easily install the XPUSH by using the Docker.

1. Prepare

To use the XPUSH, it is required nodejs, zookeeper, redis, mongodb.

Please install the Docker installation with reference to the Docker. The following is how to install the Docker in Ubuntu13.10.

Install the package for AUFS Filesystem support.

sudo apt-get update
sudo apt-get install linux-image-extra-`uname -r`

Register a Docker repository key to install the Docker with the Debian package.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

After registering the Docker repository, and then install the Docker.

sudo sh -c "echo deb http://get.docker.io/ubuntu docker main/etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker


2. Install xpush

When you are all ready, install the xpush image that has been registered in the docker. Depending on the network environment, it takes a total of about 10 to 30 minutes.

docker pull stalk/xpush:standalone


3. Run with docker

In order to xpush run with docker, you can use the following options.

- d: docker run as a daemon.

- name: the name of the docker container.

- p: It will map the port of host port with docker container. You can be connected to the port in the docker using this setting.

    Usage -p hostPort:containerPort

- v: It will map the directory of host and the directory of docker container. You can use the configuration file of the host using this setting in the docker.

    Usage -v hostDirectory:containerDirectory

3-1. Run xpush standalone

stalk/xpush:standalone docker image will contain all of the S/W required to XPUSH.

Run the downloaded image with Docker environment. Use the start scriptstand-alone-session.sh that are included in the image. Please enter your ip and domain to host.

docker run -d --name xpush -p 8000:8000 -p 9000:9000 stalk/xpush:standalone /bin/bash xpush-stand-alone.sh --host sample.stalk.io

Note: If a run-time permission error was encountered, use the sudo to run the docker.

3-2. Run xpush separately

stalk/xpush:latest image will contain only the features required to use the xpush. You can use your redis, zookeeper and mongodb.

Run session server

Quick for the start, use the start scriptxpush-session.sh that are included in the image.

docker run -d -p 8000:8000 -v /home/stalk/data:/data stalk/xpush:latest /bin/bash xpush-session.sh

Note: shell script has been configured to use the option, such as the following. You need to make asession.json file in /home/stalk/data directory that has been configured information for redis, zookeeper, mongodb.

--config /data/session.json --session --port 8000

Start the session server using the xpush executable file. You can set the way you want the option necessary to run. For more options, please make sure the here.

docker run -i -t -p 8080:8080 -v /home/stalk/data:/data stalk/xpush:latest xpush --config /data/session01.json --session --port 8080 --host sample.stalk.io

Run channel server

Quick for the start, use the start script xpush-channel.sh that are included in the image.

docker run -d -p 9000:9000 -v /home/stalk/data:/data stalk/xpush:latest /bin/bash xpush-channel.sh

Note: shell script has been configured to use the option, such as the following. You need to make achannel.json file in /home/stalk/data directory that has been configured information for redis, zookeeper, mongodb.

--config /data/channel.json --port 9000

Start the channel server using the xpush executable file. You can set the way you want the option necessary to run. For more options, please make sure the here.

docker run -i -t -p 9090:9090 -v /home/stalk/data:/data stalk/xpush:latest xpush --config /data/channel01.json --port 9090 --host sample.stalk.io

About

XPUSH is an opensource realtime communication platform for quickly, easily adding scalable functionality to web and mobile environment.
It lets you develop faster, deploy easier and scale bigger.

Source Link

- Opensource Project from github

Code licensed under MIT License
Documentation licensed under CC BY 3.0