Browse Source

ap/omero: Cleaned up.

slackware-14.2
Damien Goutte-Gattat 12 years ago
parent
commit
8f44f51eb2
  1. 8
      ap/omero/EventHandler.java
  2. 130
      ap/omero/README
  3. 33
      ap/omero/README_UPGRADE.txt
  4. 13
      ap/omero/doinst.sh
  5. 43
      ap/omero/omero-config.patch
  6. 67
      ap/omero/omero.SlackBuild
  7. 2
      ap/omero/omero.sh
  8. 93
      ap/omero/rc.omero
  9. 6
      ap/omero/slack-desc

8
ap/omero/EventHandler.java

@ -115,6 +115,14 @@ public class EventHandler implements MethodInterceptor {
// and ticket:1266
if (!readOnly) {
statement.execute("COMMIT;");
// XXX: PACKAGER'S PATCH
// The following statement is not necessary, as PostgreSQL
// automatically starts a new transaction after a 'COMMIT';
// adding this statement makes PostgreSQL (very) frequently
// complain about a "transaction already in progress". This
// may not be a big problem (nothing the upstream developers
// seem to worry about anyway), but I don't like to have my
// PostgreSQL logs polluted by a useless warning.
// statement.execute("BEGIN");
}
// now the user can be considered to be logged in.

130
ap/omero/README

@ -0,0 +1,130 @@
PACKAGER'S README FOR OMERO-Beta4.1.0
Damien Goutte-Gattat <dgouttegattat@incenp.org>
1. DISCLAIMER
This file does not come from the OMERO project and the OMERO
developers don't endorse anything of it. Official documentation and
instructions for installing and running OMERO server should be looked
for at <http://www.openmicroscopy.org/site/support/omero4/server/>.
2. SYSTEM USERS AND GROUPS
The OMERO server installed by this SlackBuild is intended to be run
by a dedicated `omero' user. That user will own most of the OMERO
files and must also have a existing, writable HOME directory.
The `doinst.sh' script will automatically create that user if it does
not already exist in `/etc/passwd'. The new account will have a UID
of 270, a HOME directory in `/var/lib/omero' and will belong to the
`omero' group; that group will also be automatically created if
needed.
To use another UID/GID or another HOME directory, either edit the
`doinst.sh' script before running the SlackBuild, or create the group
and user yourself before installing the package.
3. INSTALLATION LAYOUT
There are four locations on the filesystem that will be used by the
package:
- the OMERO main directory, `/opt/omero', where the programs and
libraries themselves will be installed;
- the OMERO configuration directory, `/etc/omero', will store all
the configuration files; they should normally be in OMERO's main
directory, but I prefer to have them in `/etc', so I symlink
`/opt/omero/etc' to `/etc/omero' to allow OMERO to find them;
- the `omero' user's home directory, by default `/var/lib/omero'
(as created by the `doinst.sh' script, see above); it will hold
some temporary files and the current runtime configuration of
OMERO, if different from the default built-in configuration;
- the data repository, where OMERO will store the raw data files,
`/OMERO' by default.
The four locations must be readable by the `omero' user; the main
directory, the `omero' user's home directory, and the data repository
must be writable by that user.
The main and configuration directories are hardcoded in the
SlackBuild and the associated scripts, but not in OMERO itself; you
may change them if you want before running the SlackBuild.
The `omero' user's home directory can be changed at any time with
usermod(8). Restart OMERO for the change to take effect.
The data repository is defined by the key `omero.data.dir' in the
main configuration file `/etc/omero/omero.properties'. Restart OMERO
for the change to take effect.
4. OMERO CONFIGURATION AND CONTROL
There are many parameters controlling OMERO's behavior, but most of
them may be left unmodified for the first run. The only parameters
that must be explicitly set before running OMERO are those defining
the data repository (`omero.data.dir') and the database backend
(`omero.db.*'), in `/etc/omero/omero.properties'.
Starting and stoping OMERO is done with the `/etc/rc.d/rc.omero'
control script. At startup, the script will ensure the data
repository and the database backend are ready to use; this implies
automatically creating the PostgreSQL account and database if those
specified in `/etc/omero/omero.properties' does not exist on the
server. The script will attempt to connect to PostgreSQL using the
`postgres' account; change the value of the `DB_ROOT' variable if you
want/need to use another superuser account.
5. OMERO.web
The Django-based web application OMERO.web is needed at least to
create OMERO users. The SlackBuild and associated scripts do *not*
automatically set up that application to work, you'll have to do it
yourself. Detailled instructions are available at
<http://openmicroscopy.org/site/support/omero4/server/install_web/>,
I will only recall them briefly.
- Create a directory to store OMERO.web's logs; the directory should
be writable by `apache' (the user who runs httpd on Slackware).
- Edit `/opt/omero/lib/python/omeroweb/settings.py'. Set `LOGDIR' to
the directory created above, and fill in the fields related to
OMERO.web database backend. I recommend using the
`postgresql_psycopg2' backend with the same database than OMERO
itself; you'll need the `psycopg2' Python module for that.
- Run `sudo -u omero omero web settings' and provide the requested
parameters.
- Run `sudo -u omero omero web superuser' and create an
administrator account for OMERO.web.
- Run `sudo -u apache omero web syncdb'.
- Make sure httpd runs with the `mod_python' module (I have not
tested yet with other Python modules such as `mod_wsgi').
- Configure httpd as follows:
---8<---------------------------------------------------------------
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE omeroweb.settings
PythonPath "['/opt/omero/lib/python',\
'/opt/omero/lib/python/omeroweb] + sys.path"
</Location>
--->8---------------------------------------------------------------
It seems it is not possible (or at least, not easy) to publish
OMERO.web at any other place than the server root ("/"). If your
httpd server has another purposes beyond OMERO.web, you may want to
use a VirtualHost.

33
ap/omero/README_UPGRADE.txt

@ -1,33 +0,0 @@
*** UPGRADING FROM OMERO-Beta4.0.3 ***
1. Stop the Omero server:
/etc/rc.d/rc.omero stop
2. Backup the PostgreSQL database:
pg_dump -h <host> -U omero -Fc -f omero.backup omero
3. Upgrade the omero package:
upgradepkg omero-4.1.0-i486-1GGD
4. If you had modified the /etc/omero.conf configuration file, have a
look at /etc/omero.conf.new and port changes accordingly.
5. Delete the file /opt/omero/lib/server/blitz.jar
6. Upgrade the PostgreSQL database
cd /opt/omero
psql -h <host> -U omero omero < sql/psql/OMERO4.1__0/OMERO4__0.sql
7. Run the newly installed server:
/etc/rc.d/rc.omero start

13
ap/omero/doinst.sh

@ -9,14 +9,19 @@ config()
rm $NEW
fi
}
config /etc/omero.conf.new
for f in backup.cfg hibernate.properties ice.config internal.cfg ivysettings.xml log4j-indexing.xml log4j.xml master.cfg node1.cfg node2.cfg omero.properties rollover.cfg testdropbox.config grid/default.xml grid/templates.xml ; do
config /etc/omero/$f.new
done
if ! grep ^omero /etc/group > /dev/null ; then
/usr/sbin/groupadd omero
/usr/sbin/groupadd -g 270 omero
fi
if ! grep ^omero /etc/passwd > /dev/null ; then
/usr/sbin/useradd -c Omero -g omero omero
/usr/sbin/groupadd -u 270 -c Omero -d /var/lib/omero -g omero omero
mkdir -p /var/lib/omero
chown omero:omero /var/lib/omero
fi
chown -R omero /opt/omero
chown -R omero /opt/omero /etc/omero

43
ap/omero/omero-config.patch

@ -1,43 +0,0 @@
diff -Naur omero.orig/etc/grid/default.xml omero/etc/grid/default.xml
--- omero.orig/etc/grid/default.xml 2009-10-21 19:53:12.000000000 +0200
+++ omero/etc/grid/default.xml 2009-11-04 10:44:06.967814296 +0100
@@ -41,13 +41,13 @@
server-endpoints="tcp -h 127.0.0.1"/>
<server-instance template="BlitzTemplate" index="0" config="default"/>
<server-instance template="IndexerTemplate" index="0"/>
- <server-instance template="DropBoxTemplate"/>
+ <!-- <server-instance template="DropBoxTemplate"/> -->
<server-instance template="FSTemplate"/>
- <server-instance template="ShellTemplate" id="Web" act="on-demand"/>
+ <server-instance template="ShellTemplate" id="Web" act="always"/>
<server-instance template="StormTemplate"/>
<server-instance template="ProcessorTemplate" index="0" dir=""/><!-- assumes legacy -->
<server-instance template="TablesTemplate" index="0" dir=""/><!-- assumes legacy -->
- <server-instance template="TestDropBoxTemplate"/>
+ <!-- <server-instance template="TestDropBoxTemplate"/> -->
</node>
</application>
diff -Naur omero.orig/etc/grid/templates.xml omero/etc/grid/templates.xml
--- omero.orig/etc/grid/templates.xml 2009-10-21 19:53:12.000000000 +0200
+++ omero/etc/grid/templates.xml 2009-11-04 10:44:27.966487003 +0100
@@ -186,6 +186,7 @@
<option>manage.py</option>
<option>runserver</option>
<option>--noreload</option>
+ <option>127.0.0.1:8000</option>
<env>${PYTHONPATH}</env>
<adapter name="WebAdapter" endpoints="tcp" server-lifetime="false"/>
<properties>
diff -Naur omero.orig/lib/python/omero/plugins/server.py omero/lib/python/omero/plugins/server.py
--- omero.orig/lib/python/omero/plugins/server.py 2009-10-21 19:53:10.000000000 +0200
+++ omero/lib/python/omero/plugins/server.py 2009-11-04 10:45:04.831670258 +0100
@@ -72,7 +72,7 @@
subprocess.call(["python","manage.py","syncdb","--noinput"], cwd=str(omero_web), env = os.environ)
# Now exec
os.chdir(str(omero_web))
- django = ["python","manage.py","runserver","--noreload"]+list(args)
+ django = ["python","manage.py","runserver","0.0.0.0:8000","--noreload"]+list(args)
os.execvpe("python", django, os.environ)
try:
register("server", ServerControl)

67
ap/omero/omero.SlackBuild

@ -22,11 +22,10 @@
#
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
#
# Latest omero sourcecode is available at:
# <http://www.openmicroscopy.org/>
# Latest omero sourcecode is available at: <http://www.openmicroscopy.org/>.
#
# Depends: d/ice, ap/postgresql
# Recommends: extra/numpy, extra/psycopg2
# Recommends: extra/numpy
# Source package infos
NAMESRC=${NAMESRC:-omero}
@ -36,8 +35,9 @@ WGET=${WGET:-http://cvs.openmicroscopy.org.uk/snapshots/omero/$ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-omero}
BUILD=${BUILD:-3GGD}
BUILD=${BUILD:-4GGD}
ARCH=${ARCH:-i486}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
# Directories
@ -64,51 +64,50 @@ if [ ! -r $ARCHIVE ]; then
mv $ARCHIVE.part $ARCHIVE
fi
sha1sum -c $ARCHIVE.sha1
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
# Extract and install
mkdir -p $PKG/opt
cd $PKG/opt
tar xf $CWD/$ARCHIVE
mv $PKG/opt/omero_dist $PKG/opt/omero
cd $PKG/opt/omero
# Delete pre-compiled Python files
find $PKG/opt/omero/lib/python -name '*.pyc' -delete
mv omero_dist omero
# Fix superfluous 'BEGIN' SQL instruction
# that cause a lot of logging overhead in PostgreSQL
(
mkdir lib/server/server
cd lib/server/server
jar xf ../server.jar
cd ome/security/basic
cp $CWD/EventHandler.java .
javac -cp $PKG/opt/omero/lib/server/blitz.jar EventHandler.java
rm EventHandler.java
cd $PKG/opt/omero/lib/server
jar cmf server/META-INF/MANIFEST.MF server.jar -C server .
rm -rf server
)
mkdir server
cd server
jar xf $PKG/opt/omero/lib/server/server.jar
cp $CWD/EventHandler.java .
javac -cp $PKG/opt/omero/lib/server/blitz.jar EventHandler.java
rm EventHandler.java
mv EventHandler.class ome/security/basic
cd ..
jar cmf server/META-INF/MANIFEST.MF server.jar -C server .
rm -rf server
mv server.jar omero/lib/server/server.jar
# Suppress blitz.jar archive; we'll rebuild it at run time
# to merge the configuration settings from /etc/omero.conf
# (yeah, I know, that's crazy).
# Install config files in /etc/omero
mkdir -p $PKG/etc
mv omero/etc $PKG/etc/omero
ln -s /etc/omero $PKG/opt/omero/etc
(
mkdir lib/server/blitz
cd lib/server/blitz
jar xf ../blitz.jar
rm ../blitz.jar
cd $PKG/etc/omero
rm -rf Windows* local.properties.example grid/windefault.xml
for f in backup.cfg hibernate.properties ice.config internal.cfg ivysettings.xml log4j-indexing.xml log4j.xml master.cfg node?.cfg omero.properties rollover.cfg testdropbox.config grid/*.xml ; do
mv $f $f.new
done
)
# Fix config files
patch -p 1 < $CWD/omero-config.patch
install -D -m 600 lib/server/blitz/omero.properties $PKG/etc/omero.conf.new
# Install launch scripts in standard directories
# Install launch scripts
install -D -m 755 $CWD/omero.sh $PKG/usr/bin/omero
install -D -m 644 $CWD/rc.omero $PKG/etc/rc.d/rc.omero
# Install documentation
mkdir -p $PKG/usr/doc/$NAMEPKG-$VERSION
install -m 644 $CWD/README $PKG/usr/doc/$NAMEPKG-$VERSION
mv omero/LICENSE.txt $PKG/usr/doc/$NAMEPKG-$VERSION
mv omero/docs/api $PKG/usr/doc/$NAMEPKG-$VERSION
rmdir omero/docs
# Copy slack-desc and doinst.sh files
mkdir -p $PKG/install
install -m 644 $CWD/slack-desc $PKG/install/slack-desc

2
ap/omero/omero.sh

@ -1,6 +1,6 @@
#!/bin/sh
OMERO_HOME=/opt/omero
PYTHONPATH=$PYTHONPATH:/opt/omero/lib/python
PYTHONPATH=/opt/omero/lib/python
export OMERO_HOME
export PYTHONPATH

93
ap/omero/rc.omero

@ -1,83 +1,72 @@
#!/bin/bash
CONFIG_FILE=/etc/omero.conf
DB_ROOT=postgres
CONFIG_FILE=/etc/omero/omero.properties
ICEGRID_PIDFILE=/opt/omero/var/master/master.pid
omero_initialize()
{
# Read settings
OMERO_DATADIR=$(sed -nre 's/^omero.data.dir=(.*)$/\1/p' $CONFIG_FILE)
OMERO_DB_HOST=$(sed -nre 's/^omero.db.host=(.*)$/\1/p' $CONFIG_FILE)
OMERO_DB_NAME=$(sed -nre 's/^omero.db.name=(.*)$/\1/p' $CONFIG_FILE)
OMERO_DB_USER=$(sed -nre 's/^omero.db.user=(.*)$/\1/p' $CONFIG_FILE)
PGOPTS="-h $OMERO_DB_HOST -U postgres"
if [ ! -f $CONFIG_FILE ]; then
echo Configuration file $CONFIG_FILE not found! Aborting...
exit 1
fi
echo Reading configuration from $CONFIG_FILE...
DATADIR=$(sed -nre 's/^omero\.data\.dir=(.*)$/\1/p' $CONFIG_FILE)
DB_HOST=$(sed -nre 's/^omero\.db\.host=(.*)$/\1/p' $CONFIG_FILE)
DB_PORT=$(sed -nre 's/^omero\.db\.port=(.*)$/\1/p' $CONFIG_FILE)
DB_NAME=$(sed -nre 's/^omero\.db\.name=(.*)$/\1/p' $CONFIG_FILE)
DB_USER=$(sed -nre 's/^omero\.db\.user=(.*)$/\1/p' $CONFIG_FILE)
PGOPTS="-h $DB_HOST -p $DB_PORT -U $DB_ROOT"
# Create compiled settings file
echo Compile settings...
cp $CONFIG_FILE /opt/omero/lib/server/blitz/omero.properties
jar cmf \
/opt/omero/lib/server/blitz/META-INF/MANIFEST.MF \
/opt/omero/lib/server/blitz.jar \
-C /opt/omero/lib/server/blitz .
echo Applying configuration...
sudo -H -u omero omero config load $CONFIG_FILE
# Create data repository
echo Ensure data repository exists...
if [ ! -d $OMERO_DATADIR ]; then
mkdir -p $OMERO_DATADIR
chown omero $OMERO_DATADIR
if [ ! -d $DATADIR ]; then
echo Creating data repository...
mkdir -p $DATADIR
chown omero $DATADIR
fi
# Create database user
echo Ensure database user exists...
if ! psql $PGOPTS -c '\du' | grep -q $OMERO_DB_USER ; then
createuser $PGOPTS -P -D -R -S $OMERO_DB_USER
if ! psql $PGOPTS -c '\du' | grep -q $DB_USER ; then
echo Creating database user...
createuser $PGOPTS -P -D -R -S $DB_USER
fi
# Create and fill database
echo Ensure database is ready to use...
if ! psql $PGOPTS -l | grep -q $OMERO_DB_NAME ; then
createdb $PGOPTS -O $OMERO_DB_USER $OMERO_DB_NAME
createlang $PGOPTS plpgsql $OMERO_DB_NAME
if ! psql $PGOPTS -l | grep -q $DB_NAME ; then
echo Creating database...
createdb $PGOPTS -O $DB_USER $DB_NAME
createlang $PGOPTS plpgsql $DB_NAME
(
cd /opt/omero
sudo -u omero omero db script
psql -h $OMERO_DB_HOST -U $OMERO_DB_USER $OMERO_DB_NAME < \
OMERO4.1__0.sql
rm -rf OMERO4.1__0.sql .java
sudo -H -u omero omero db script
psql -h $DB_HOST -p $DB_PORT -U $DB_USER $DB_NAME < OMERO4.1__0.sql
rm -rf OMERO4.1__0.sql
)
fi
}
omero_start()
{
if [ ! -f /opt/omero/lib/server/blitz.jar ]; then
omero_initialize
fi
sudo -H -u omero omero admin start
}
omero_stop()
{
sudo -H -u omero omero admin stop
[ -f $ICEGRID_PIDFILE ] && kill -TERM $(< $ICEGRID_PIDFILE)
}
case "$1" in
init)
omero_initialize
;;
start)
omero_start
omero_initialize
sudo -H -u omero omero admin start
;;
stop)
omero_stop
sudo -H -u omero omero admin stop
[ -f $ICEGRID_PIDFILE ] && kill -TERM $(< $ICEGRID_PIDFILE)
;;
restart)
omero_stop
$0 stop
sleep 5
omero_start
$0 start
;;
*)
echo "Usage: ${1##.*/} {init|start|stop|restart}"
exit 1

6
ap/omero/slack-desc

@ -5,8 +5,8 @@ omero: OME Remote Objects (OMERO) is a modern client-server software platform
omero: for visualising, managing, and annotating biological image data. OMERO
omero: also provides components for image importing, archiving, protocol
omero: recording, and user administration. OMERO consists of a Java server,
omero: several Java client applications, as well as Python and C++ bindings
omero: and a Django-based web application.
omero:
omero: several Java client applications [not provided in this package, see
omero: xap/omero-client], as well as Python and C++ bindings and a
omero: Django-based web application.
omero:
omero:

Loading…
Cancel
Save