Game Readme




* to start game server, log into www.brandx.net and go to /var/www/html/game/game-site/ and type 
  ruby script/server

* to start in production mode, /var/www/html/game/game-site/ and type
  ruby script/server -d production
  
* -d option runs as demon




The game is implemented using mongrel_cluster

There are some notes at the bottom of this page.

The config files are found in ~game/config

The service config files are found in /etc/mongrel_cluster_game and /etc/init.d/assassin

You also have to call chkconfig to add it to the list (see below) 

You can start manually with service assassing start

Note that an upgrade is required to eliminate the lost pid file prolem












=============== HOW TO SET UP MONGREL CLUSTER


Join our Discussion Boards - Here
« How to Add double Dashes to WordPress Posts    Create a Mongrel Cluster with an Apache Frontend Load Balancer for Redmine »
Set up Mongrel as a service and start it automatically on Centos 5.2
BY ADMIN, ON DECEMBER 11TH, 2008
 

From – http://bitsandchaos.wordpress.com/2007/11/18/integrate-mongrel-with-rhel-and-derivatives/

This is tailored for the redmine installation that is descibed on this site.

create a directory

mkdir /etc/mongrel

create a file in that directory

vi /etc/mongrel/mongrel.conf

Put this into the file

# we want three instances, listening on ports 8000, 8001 and 8002

PORTS=”8000 8001 8002″

# the Rails environment (see config/database.yml of your application)

ENVIRONMENT=”production”

# the base name for the log file. Each instance will have a unique log file, as LOGFILE.PORT

LOGFILE=”/opt/redmine-0.8.0_RC1/log/rubyapp.logfile”

# the basename for the pid file. Each instance will have a unique pid file, as PIDFILE.PORT

PIDFILE=”/opt/redmine-0.8.0_RC1/tmp/pids/pidfile”

# the directory containing your RoR application.

ROOTDOCUMENT=”/opt/redmine-0.8.0_RC1/”

# every other extra parameter goes there.

EXTRAPARAMS=”--user apache --group apache”

Create another file

vi /etc/sysconfig/mongrel

Put this into it.

#Path of mongrel_rails

MONGREL=/usr/bin/mongrel_rails

Create another file

vi /etc/init.d/mongrel

Set the permissions

chown root:root /etc/init.d/mongrel

 chmod 755 /etc/init.d/mongrel

add it to chkconfig:

chkconfig -add mongrel

and then set it for automatic starting at appropriate runlevels:

chkconfig –level 345 mongrel on

Put the following in /etc/init.d/mongrel

#!/bin/bash

#

# Mongrel      Startup script for the Mongrel Server

#

# chkconfig: – 84 10

# description: Mongrel is a Ruby on Rails application server

#

# processname: mongrel_rails

# config: /etc/sysconfig/mongrel

# instance config: /etc/mongrel/*.conf

 

# Source function library.

. /etc/rc.d/init.d/functions

 

if [ -f /etc/sysconfig/mongrel ]; then

        . /etc/sysconfig/mongrel

fi

 

# Path to the mongrel_rails server.

mongrel=${MONGREL-/usr/bin/mongrel_rails}

RETVAL=0

 

# For each /etc/mongrel/*.conf file that describes a Ruby on Rails application

# we instantiate the corresponding server instances (one for each port).

# We also cleare the sessions, pids, cache and sockets subdirs.

# Note that you’ll hopefully get a [ OK ] line for each (instance,port) pair.

start() {

      RET=0

      for instancefile in `ls /etc/mongrel/*conf`; do

            echo -n $instancefile;

 

            unset PORTS ENVIRONMENT LOGFILE PIDFILE ROOTDOCUMENT EXTRAPARAMS

            . $instancefile

 

            for INSTANCEPORT in $PORTS; do

                  INSTANCELOG=$LOGFILE.$INSTANCEPORT

                  INSTANCEPID=$PIDFILE.$INSTANCEPORT

                  CMDLINE=”-e $ENVIRONMENT –port $INSTANCEPORT –log $INSTANCELOG –pid $INSTANCEPID $EXTRAPARAMS”

                  if [ -n "$ROOTDOCUMENT" ]; then

                        for SUBDIR in “sessions” “pids” “cache” “sockets”; do

                              rm -f $ROOTDOCUMENT/tmp/$SUBDIR/* 2> /dev/null

                        done

                        (cd $ROOTDOCUMENT; daemon mongrel_rails start -d $CMDLINE)

                        RETVAL=$?

                        if [ "$RETVAL" -ne "0" ]; then

                                RET=1

                        fi

                        echo

                  fi

            done

      done

      return $RET

}

 

# When stopping mongrel_rails we wait a delay of 10 seconds

stop() {

echo -n $”Stopping Mongrel”

killproc -d 10 $mongrel

RETVAL=$?

        # We force remove of PID files (a stopped Mongrel won’t do that for us)

        for instancefile in `ls /etc/mongrel/*conf`; do

                unset PORTS ENVIRONMENT LOGFILE PIDFILE ROOTDOCUMENT EXTRAPARAMS

                . $instancefile

                for INSTANCEPORT in $PORTS; do

                        INSTANCEPID=$PIDFILE.$INSTANCEPORT

                        rm -f $INSTANCEPID 2> /dev/null

                done

        done

        echo

}

 

# See how we were called.

case “$1″ in

  start)

start

;;

  stop)

stop

;;

  status)

        status $mongrel

RETVAL=$?

;;

  restart)

stop

start

;;

  *)

echo $”Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}”

exit 1

esac

 

exit $RETVAL

Use

service mongrel start

service mongrel stop

service mongrel restart

service mongrel status

555555555








