Skip to content

Ubuntu Installation

Debanjum Singh Solanky edited this page Jan 28, 2015 · 1 revision

Ubuntu Installation

Document Version 0.1 (Jan 28th, 2015)

The intention of this document is to give prospective administrators more information about pump.io for use within their existing Ubuntu systems.

Pump.io is relatively simple to run, however there can be some difficulties surrounding database choice and installation.

It has also been noted that setting up the config file can be distro agnostic, and cause confusion for people who are wanting more specific answers.

In this example installation, we will be using the standard install information provided in the pump.io tutorial, and using it to configure pump.io specifically for Ubuntu.

Three Step Install Script (for testing)

wget https://gist.githubusercontent.com/debanjum/3c3e92de34d290a8bc68/raw/f2d86de263980e744a7ac1079c2863f49fe1c9d6/Pump.sh
chmod +x Pump.sh        # Make script exectuable
sudo ./Pump.sh "local"  # For local testing
# OR #
sudo ./Pump.sh "server" # For server testing, with external ip and hostname

Detailed Installation

Prerequisites

Install basic build essential packages

apt-get install build-essential curl git python-software-properties

Install NodeJS

add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

Install pump.io specific system dependencies

apt-get install redis-server graphicsmagick screen

Install Pump.io

cd ~ && git clone https://github.com/e14n/pump.io.git  # Clone the git repository

cd pump.io; npm install; cd .. # Install pump.io nodejs dependencies using npm

npm test  # Test the install

Install Database Driver

cd pump.io; npm install databank-redis; cd .. # Install the redis driver in the pump.io directory.

Configuration

System Configuration

useradd -M -c "Pump.io User" -g www-data pumpio  # Adding user who will run pump.io
sudo passwd pumpio # Add passwd for 'pumpio' user

mkdir pump.io/uploads  # Create pump.io upload directory
mv ~/pump.io /srv/     # Moving pump.io directory to /srv/

Pump.io Configuration

pump.io uses a JSON file for configuration. The pump.io.json.sample file should give you an idea of how to use it.

cp /srv/pump.io/pump.io.json.sample /etc/pump.io.json
nano /etc/pump.io.json  # Alter the file according to your preferences.

If you choose, you can overwrite the content with the setup below. This will work with the default setup we've chosen. Don't forget to alter the details accordingly

{
"driver": "redis",
"params": {"host":"localhost","port":6379},
"secret": "<YOUR SECRET>", # add your own secret key
"noweb": false,
"site": "<YOUR DOMAIN>", # add your own sub/domain here
"owner": "<YOUR NAME/NICKNAME>", #add your own nick/name here
"ownerURL": "<YOUR URL>", # add a URL for your nick/name to link to
"bounce": true, # this pushes all requests on port 80, to 443
"port": 443,
"key": "<PATH TO YOUR SSL KEY>", # add the full path including file name
"cert": "<PATH TO YOUR SSL CERT>", # add the full path including file name
"hostname": "<YOUR HOST NAME>", # the hostname of your server
"address": "0.0.0.0",
"nologger": false,
"serverUser": "pumpio",
"uploaddir": "/srv/pump.io/uploads",
"debugClient": false,
"firehose": "ofirehose.example",
}

To complete and save, press CTRL+X, press Y, then Enter.

Starting Pump.io

screen -S pumpserver -L -dm bash -c "cd /srv/pump.io; npm start"  # Starting pump in screen

Finishing Up

You should now be able to connect to you instance via http://YOUR SUB/DOMAIN This will push you to https://YOUR SUB/DOMAIN thanks to '"bounce": true' in the config file.

Debugging

On the command line you can see the pump console by going into the running screen session by screen -r

If you don't see it, something went wrong - you can see the error messages in screenlog.0 by cat screenlog.0

Init File

#!/bin/bash
# /etc/init.d/pumpio

### BEGIN INIT INFO
# Provides:          pump.io
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts pump.io as a background daemon
# Description:       Starts pump.io on boot
### END INIT INFO

# Author: Bob Mottram <bob@robotics.uk.to>

#Settings
SERVICE='pumpio'
COMMAND="forever /srv/pump.io/bin/pump > /var/local/pump.io/daemon.log"
USERNAME='pumpio'
NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources
HISTORY=1024
INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/var/local/pump.io'

pumpio_start() {
echo "Starting $SERVICE..."
su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME
}

pumpio_stop() {
echo "Stopping $SERVICE"
su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME
}

#Start-Stop here
case "$1" in
  start)
    pumpio_start
    ;;
  stop)
    pumpio_stop
    ;;
  restart)
    pumpio_stop
    sleep 10s
    pumpio_start
    ;;
    *)
  echo "Usage: $0 {start|stop|restart}"
  exit 1
  ;;
esac

exit 0

Bugs

If you find bugs, you can report them here:

https://github.com/e14n/pump.io/issues

You can also email evan at evan@e14n.com

Clone this wiki locally