Installation Guide Run Projectivity

From Projectivity Documentation
Jump to: navigation, search
Go back to Installation Guide main section

Contents

Run Projectivity Manually

To run Projectivity:

  1. start PostgreSQL
  2. run projectivity server instance in JBoss

To run projectivity server instance in JBoss

on Linux
[root@py root] cd /opt/projectivity-3.0/bin
[root@py bin]./run.sh -c projectivity -b 127.0.0.1
 on Windows
..> cd C:\projectivity-3.0\bin
..> run.bat -c projectivity -b 127.0.0.1

NOTE: Make sure to pass the -b argument with your v-host IP address, otherwise you won't be able to connect to it, i.e. specifying 127.0.0.1 (localhost address) will allow you to connect to Projectivity just from the local host (Browser and Projectivity running on the same host). For instance, if the host is connected to a LAN via an ethernet interface with ip 192.168.1.53 you have to run Projectivity as follows:

..> run.bat -c projectivity -b 192.168.1.53

You can also bind Projectivity to all available network interfaces specifying -b 0.0.0.0, however you'll get few error messages on the log file when Projectivity shuts down (this is a bug of JBoss Application Server and you can safely ignore those error messages)

You can now login Projectivity:

URL: http://127.0.0.1:8080/py/secure/projectivity.iface
id: admin
password: adminadmin

Stop Projectivity Manually

on Linux
[root@py root] cd /opt/projectivity-3.0/bin
[root@py bin]./shutdown -S
 on Windows
..> cd C:\projectivity-3.0\bin
..> shutdows -S

Run Projectivity as a Service on Windows

You need to have JBoss and PostgreSQL run as services and set JBoss to depend on Postgres.

Run Projectivity as a Service on Linux

This section explains how to run Projectivity as a system service under Linux.

Linux uses System V init scripts. Usually it looks like this (there can be some differences between distributions):

/etc/rc.d/init.d/	contains the start and stop scripts (other distributions: /etc/init.d/) 
/etc/rc.(x)/ 	        contains links to the start and stop scripts prefixed with S or K (start or kill respectively) 

There are various run levels for various stages of system use. 
1.rc1.d - Single User Mode 
2.rc2.d - Single User Mode with Networking 
3.rc3.d - Multi-User Mode - boot up in text mode 
4.rc4.d - Undefined 
5.rc5.d - Multi-User Mode - boot up in X Windows 
6.rc6.d - Shutdown 

Most Linux systems used as Application Servers boot into run level 3 to avoid to start X-Windows and waste system resources.

To automatically start a process you have to (given a SysV script called process):

Create a task specific user to restrict the access only to the files and system resources
Create a script called /etc/init.d/process
Add a new service for management by chkconfig
Enable the service

PostgreSQL

The official rpm package of PostgreSQL available from http://www.postgres.org offers a SysV script to start the postmaster server (the script is installed on /etc/init.d/postgresql).

You can turn on the service in the current runlevel with the following command:

chkconfig postgresql on

NOTE: if you version of Linux does not manage rpm packages or you don't have the SysV script installed for any reason, please refer on PostgreSQL documentation to find the best way to automate the server startup.

Projectivity (JBoss)

  • Create the projectivity user
  • Create the /etc/init.d/projectivity

#!/bin/sh
# chkconfig: - 91 35
# description: Starts and stops Projectivity Application Server
# Projectivity Control Script
#
# Modified by Andrea Di Cesare - andrea@softinstigate.com
#
#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/opt/projectivity-3.0"}    <-- check this
#define the user under which jboss will run, or use 'RUNASIS' to run as the current user
JBOSS_USER=${JBOSS_USER:-"projectivity"}
#make sure java is in your path
JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.6.0_04/bin"}  <-- check this
#configuration to use, usually one of 'minimal', 'default', 'all'
JBOSS_CONF=${JBOSS_CONF:-"projectivity"}
#bind address for jboss services, by default bind to *all* NICs
JBOSS_HOST=${JBOSS_HOST:-"127.0.0.1"}
#define the classpath for the shutdown class
JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF -b $JBOSS_HOST"}
if [ "$JBOSS_USER" = "RUNASIS" ]; then
  SUBIT=""
else
  SUBIT="su - $JBOSS_USER -c "
fi
if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
  # ensure the file exists
  touch $JBOSS_CONSOLE
  if [ ! -z "$SUBIT" ]; then
    chown $JBOSS_USER $JBOSS_CONSOLE
  fi
fi
if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then
  echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"
  echo "WARNING: ignoring it and using /dev/null"
  JBOSS_CONSOLE="/dev/null"
fi
#define what will be done with the console log
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}
JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"}
if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
  export PATH=$PATH:$JAVAPTH
fi
if [ ! -d "$JBOSS_HOME" ]; then
  echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
  exit 1
fi
echo JBOSS_CMD_START = $JBOSS_CMD_START
case "$1" in
start)
    cd $JBOSS_HOME/bin
    if [ -z "$SUBIT" ]; then
        eval $JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &
    else
        $SUBIT "$JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1" &
    fi
    ;;
stop)
    if [ -z "$SUBIT" ]; then
         $JBOSS_CMD_STOP
    else
        $SUBIT "$JBOSS_CMD_STOP"
    fi
    ;;
restart)
    $0 stop
    $0 start
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac

  • Turn on the service in the current runlevel with the following command

chkconfig --add projectivity
chkconfig projectivity on

Personal tools
Downloads
Other Resources