Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Snorby delayed_job running in development mode #231

Closed
GoogleCodeExporter opened this issue Mar 24, 2015 · 7 comments
Closed

Snorby delayed_job running in development mode #231

GoogleCodeExporter opened this issue Mar 24, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Snorby is started from /usr/local/share/snorby/snorby_start.  The end
of that file looks like this:
# start the webserver
cd $SNORBYHOME
echo "Starting thin web server"
bundle exec thin start --ssl -e production -d
echo "Running Snorby jobs"
bundle exec script/delayed_job start

The thin web server should be running in production mode due to the
"-e production" option.  However, I think delayed_job is defaulting to
development mode.  Try changing the delayed_job line to:
RAILS_ENV=production bundle exec script/delayed_job start

Original issue reported on code.google.com by doug.bu...@gmail.com on 28 Feb 2012 at 8:39

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Updated /usr/local/share/snorby/snorby_start as follows:

#!/bin/bash
# Originally written by Vivek Rajagopalan
# http://www.unleashnetworks.com/blog/?p=356
# Revised by Doug Burks for Security Onion.
#
# Version:
# 20120229
#
# Changelog:
# 20111222 - Initial release for Security Onion
# 20120222 - Updated for Snorby 2.4.0
# 20120229 - Run in production mode

# Snorby directory
SNORBYHOME=/usr/local/share/snorby

# Configure Snorby for production mode
export RAILS_ENV=production

# Activate rbenv
export RBENV_ROOT=$SNORBYHOME/.rbenv
export PATH=$RBENV_ROOT/bin:$PATH
eval "$(rbenv init -)"

# Initialize database if necessary
if ! test -e $SNORBYHOME/db/first; then
    cd $SNORBYHOME
    echo "Initializing Snorby database"
    bundle exec rake snorby:setup | grep "datamapper"
    touch $SNORBYHOME/db/first
fi

# Start Snorby
cd $SNORBYHOME
echo "Starting thin web server"
bundle exec thin start --ssl -d
echo "Running Snorby jobs"
bundle exec script/delayed_job start

Original comment by doug.bu...@gmail.com on 1 Mar 2012 at 12:06

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Added the following to /usr/local/bin/setup right before starting Snorby:

export RAILS_ENV=production

Original comment by doug.bu...@gmail.com on 1 Mar 2012 at 12:06

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Packaged /usr/local/bin/setup:
/usr/local/lib/ruby/gems/1.9.1/gems/fpm-0.3.11/bin/fpm -s dir -t deb -n 
securityonion-setup -v 20120229 /usr/local/bin/setup

Added the following to security-onion-upgrade.sh:

sed -i 's| |=|g' $CONF
source $CONF
if [ "$VERSION" = "20120224" ]; then
        NEW="20120229"
        echo "**********************************************"   | $LOGGER
        echo "* Upgrading from $VERSION to $NEW."               | $LOGGER
        echo "**********************************************"   | $LOGGER
        DIR="/nsm/backup/$NEW"
        mkdir -p $DIR                                           | $LOGGER
        cd $DIR

        if [ -d /var/lib/mysql/snorby ]; then
                echo "* Stopping Snorby processes"              | $LOGGER
                ps aux |grep "thi[n]" |awk '{print $2}'|xargs kill -9
                ps aux |grep "delayed_jo[b]" |awk '{print $2}'|xargs kill -9
        fi

    echo "* Installing new Setup script"            | $LOGGER
    FILE=securityonion-setup_"$NEW"_i386.deb
    wget -q http://sourceforge.net/projects/security-onion/files/$NEW/$FILE -O $FILE | $LOGGER
    dpkg -i $FILE                       | $LOGGER

    echo "* Installing new snorby_start"            | $LOGGER
        SNORBYHOME=/usr/local/share/snorby
        FILE=snorby_start
        wget -q http://sourceforge.net/projects/security-onion/files/$NEW/$FILE -O $FILE | $LOGGER
        cp $FILE $SNORBYHOME/
        chmod +x $SNORBYHOME/$FILE

        if [ -d /var/lib/mysql/snorby ]; then
                echo "* Starting Snorby"                        | $LOGGER
                /usr/local/share/snorby/snorby_start            >> $LOG
        fi

        sed -i "s|VERSION=$VERSION|VERSION=$NEW|g" $CONF        | $LOGGER
        echo "* Upgrade to $NEW complete."                      | $LOGGER
        echo 
fi

Original comment by doug.bu...@gmail.com on 1 Mar 2012 at 12:11

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Tested by:
Scott Runnels
Liam Randall
Eric Ooi
Heine Lysemose

Original comment by doug.bu...@gmail.com on 1 Mar 2012 at 12:12

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Published:
http://securityonion.blogspot.com/2012/03/security-onion-20120229-now-available.
html

Original comment by doug.bu...@gmail.com on 1 Mar 2012 at 1:06

  • Changed state: Verified
  • Added labels: ****
  • Removed labels: ****

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant