Multiple Instances not working

Asked by John Davis on 2014-01-23

I was tryng to set up a second instance of schooltool on my server. Now the new instance does not work at all, but if I stop the new service (/init.d/schooltool-roanoke) the old one stops working. I was trying to follow the directions on book.schooltool but must have goofed somthing up.

here are the files that I changed for the new instance:

/etc/init.d/schooltool-roanoke
###############################################
#!/bin/sh
### BEGIN INIT INFO
# Provides: schooltool
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SchoolTool server
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/supervisord
CONTROL=/usr/bin/supervisorctl
NAME=roanoke
DESC="Roanoke SchoolTool"
SERVER=roanoke
INSTANCE=roanoke
CONFIGFILE=/etc/schooltool/$INSTANCE/supervisord.conf
DAEMON_OPTS="-c $CONFIGFILE"
PIDFILE=/var/run/schooltool/supervisord.pid
DODTIME=5 # Time to wait for the server to die, in seconds
                            # If this value is set too low you might not
                            # let some servers to die gracefully and
                            # 'restart' will not work
......

##########################################

/etc/schooltool/roanoke/schooltool.conf
##########################################
# Standard SchoolTool server configuration file

# Site definition file (Do not change unless you know what you're doing):
site-definition /etc/schooltool/roanoke/site.zcml

# Task server definition files:
result-server-definition /etc/schooltool/roanoke/result-server.zcml
report-server-definition /etc/schooltool/roanoke/report-server.zcml

# Where should the server store all data?
<zodb>

  # <filestorage> traditional FileStorage
  # path filename required
  # create yes|no default: yes
  # read-only yes|no default: no
  # quota size default: no quota
  # blob-dir directory directory to hold blob data
  # </filestorage>
  <filestorage>
    path /var/lib/schooltool/roanoke-Data.fs
  </filestorage>
......
error-log-file /var/log/schooltool/roanoke-error.log

#
# web-access-log-file
#
.........
#
web-access-log-file /var/log/schooltool/roanoke-web-access.log
##############################################

/etc/schooltool/roanoke/paste.ini
###############################################
[composite:main]
use = egg:Paste#urlmap
/ = schooltool
/schooltool.task_results = task_results

[app:schooltool]
use = egg:schooltool#main
config_file=schooltool.conf

[app:task_results]
use = egg:schooltool#task_results
config_file=schooltool.conf

[server:main]
use = egg:zope.server
host = 0.0.0.0
port = 7082
##########################################

Question information

Language:
English Edit question
Status:
Answered
For:
SchoolTool Edit question
Assignee:
No assignee Edit question
Last query:
2014-02-06
Last reply:
2014-02-06
Gediminas Paulauskas (menesis) said : #2

You have following instructions from the book, that describe a setup for 2.4 or older schooltool. Since version 2.6, there are now more files and more ports to be changed.

Copy the existing files and not from the book.

First, the init.d script:

$ sudo cp /etc/init.d/schooltool /etc/init.d/schooltool-roanoke

Edit it, you only need to change three lines

NAME=schooltool-roanoke
DESC="Roanoke SchoolTool"
INSTANCE=roanoke

And replace all occurences of /var/run/schooltool with /var/run/schooltool-roanoke

Copy the instance directory

$ sudo cp -r /etc/schooltool/standard /etc/schooltool/roanoke
$ cd /etc/schooltool/roanoke

Edit the files, and do find & replace of the following strings:

/etc/schooltool/standard => /etc/schooltool/roanoke
/var/run/schooltool => /var/run/schooltool-roanoke
/var/log/schooltool => /var/log/schooltool-roanoke
/var/lib/schooltool => /var/lib/schooltool-roanoke
7079 => 7078

Here are all the lines I had to change:

paste.ini
---------

port = 7082

redis.conf
----------

port = 7078
logfile /var/log/schooltool-roanoke/redis.log
dir /var/lib/schooltool-roanoke

schooltool.conf
---------------

site-definition /etc/schooltool/roanoke/site.zcml
result-server-definition /etc/schooltool/roanoke/result-server.zcml
report-server-definition /etc/schooltool/roanoke/report-server.zcml
  <zeoclient>
    server /var/run/schooltool-roanoke/zeo.sock
    blob-dir /var/lib/schooltool-roanoke/blobs
    shared-blob-dir yes
  </zeoclient>
error-log-file /var/log/schooltool-roanoke/error.log
web-access-log-file /var/log/schooltool-roanoke/web-access.log

zeo.conf
--------

<zeo>
  address /var/run/schooltool-roanoke/zeo.sock
</zeo>
<eventlog>
  <logfile>
    path /var/log/schooltool-roanoke/zeo.log
  </logfile>
</eventlog>
<filestorage>
  path /var/lib/schooltool-roanoke/Data.fs
  blob-dir /var/lib/schooltool-roanoke/blobs
</filestorage>

supervisord.conf
----------------

[unix_http_server]
file=/var/run/schooltool-roanoke/supervisord.sock

[supervisord]
logfile=/var/log/schooltool-roanoke/supervisord.log
pidfile=/var/run/schooltool-roanoke/supervisord.pid

[supervisorctl]
serverurl=unix:///var/run/schooltool-roanoke/supervisord.sock

[program:schooltool]
priority=999
directory=/var/lib/schooltool-roanoke
command=/usr/bin/start-schooltool-instance /etc/schooltool/roanoke
environment=CELERY_CONFIG_MODULE='schooltool.task.config.zope',REDIS_HOST='127.0.0.1',REDIS_PORT='7078'
stdout_logfile=/var/log/schooltool-roanoke/paste.log

[program:zeo]
command=/usr/bin/runzeo -C /etc/schooltool/roanoke/zeo.conf

[program:redis]
priority=100
directory=/var/lib/schooltool-roanoke
command=redis-server /etc/schooltool/roanoke/redis.conf

[program:celery_report]
directory=/var/lib/schooltool-roanoke
environment=SCHOOLTOOL_CONF='/etc/schooltool/roanoke/schooltool.conf',REDIS_HOST='127.0.0.1',REDIS_PORT='7078'
stdout_logfile=/var/log/schooltool-roanoke/celery_report.log

Create log and data directories and change their ownership

$ sudo mkdir /var/log/schooltool-roanoke /var/lib/schooltool-roanoke
$ sudo chown schooltool:schooltool /var/log/schooltool-roanoke /var/lib/schooltool-roanoke

Now, start the new server!

$ sudo /etc/init.d/schooltool-roanoke start

See if everything is RUNNING

$ sudo /etc/init.d/schooltool-roanoke status
schooltool RUNNING pid 11419, uptime 0:02:12
services:celery_report RUNNING pid 11276, uptime 0:02:14
services:redis RUNNING pid 11274, uptime 0:02:14
services:zeo RUNNING pid 11275, uptime 0:02:14

Open it in web browser:

http://localhost:7082/

To automatically start on startup

$ sudo update-rc.d schooltool-roanoke defaults

John Davis (jdavis-b) said : #3

schooltool@schooltool:/$ sudo service schooltool-roanoke start
 * Starting SchoolTool Roanoke... [ OK ]
schooltool@schooltool:/$ sudo service schooltool-roanoke status
[sudo] password for schooltool:
unix:///var/run/schooltool-roanoke/supervisord.sock no such file
schooltool@schooltool:/$

Followed instructions but, it looks like I still need to make a copy of the /var/run/schooltool/ file. The question is should those files be automaticly generating, or can I make a simple copy of the file and .sock files renamed to schooltool-roanoke?

John Davis (jdavis-b) said : #4

Stopped and started service got this message as well.

schooltool@schooltool:/$ sudo service schooltool-roanoke stop
 * Stopping SchoolTool Roanoke... [ OK ]
schooltool@schooltool:/$ sudo service schooltool-roanoke start
 * Starting SchoolTool Roanoke... Error: The directory named as part of the path /var/run/schooltool-roanoke/supervisord.pid does not exist.
For help, use /usr/bin/supervisord -h

Also stopping the service still causes the localhost:7080 to stop loading

Gediminas Paulauskas (menesis) said : #5

Looks to me that the /etc/init.d/schooltool-roanoke file has references to /var/run/schooltool that should point to /var/run/schooltool-roanoke instead. The init.d script creates the directory if it does not exist.

Enzo L. Castro (enzo-l-castro) said : #6

Hi,

I have a same problem here.

root@academico:~#
root@academico:~# /etc/init.d/schooltool-schoolA start
[....] Starting schooltool-schoolA (via systemctl): schooltool-schoolA.serviceFailed to start schooltool-schoolA.service: Unit schooltool-schoolA.service failed to load: No such file or directory.
 failed!
root@academico:~#
root@academico:~#
root@academico:~# /etc/init.d/schooltool-schoolA status
‚óŹ schooltool-schoolA.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
root@academico:~#
root@academico:~#

Documentation: http://book.schooltool.org/multiple-schooltools.html

Step by Step.

Thk!!!

Can you help with this problem?

Provide an answer of your own, or ask John Davis for more information if necessary.

To post a message you must log in.