Skip to content

Instantly share code, notes, and snippets.

@furins
Last active May 8, 2017 21:22
Show Gist options
  • Save furins/7399417 to your computer and use it in GitHub Desktop.
Save furins/7399417 to your computer and use it in GitHub Desktop.
install supervisor and solr, code almost copied by http://martinbrochhaus.com/solr.html
SOLR_VERSION=4.5.1
WEBFACTION_USER=username
MY_SUPERVISOR_CONF_ID=7399041
# retrieve a standard supervisor.conf
mkdir ~/tmp
cd ~/tmp
wget -O supervisor.conf.json https://api.github.com/gists/$MY_SUPERVISOR_CONF_ID && cat supervisor.conf.json|python -c 'import json,sys;obj=json.load(sys.stdin);print obj["files"]["supervisor.conf"]["content"]' > ../supervisord.conf
rm supervisor.conf.json
cd ~
sed -i 's/username/'"$WEBFACTION_USER"'/g' supervisord.conf
echo "[program:solr]
user=$WEBFACTION_USER
directory=/home/$WEBFACTION_USER/src/solr-$SOLR_VERSION/example
command=java -Djava.util.logging.config.file=logging.properties -jar start.jar
" >> supervisord.conf
# installs solr (using netherland mirror since the server is in Amsterdam)
mkdir ~/src && cd ~/src
wget ftp://mirror.nl.webzilla.com/apache/lucene/solr/$SOLR_VERSION/solr-$SOLR_VERSION.tgz
tar -xzf solr-$SOLR_VERSION.tgz
cd apache-solr-$SOLR_VERSION/example
echo ".level = INFO
handlers = java.util.logging.FileHandler
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
java.util.logging.FileHandler.pattern = /home/$WEBFACTION_USER/my/logs/solr%u.log
" > logging.properties
cd ~
# installs supervisor
pip install -U supervisor
mkdir -p ~/my/logs/cron
mkdir ~/etc && cd ~/etc
echo "now add a cronjob like:
*/5 * * * * ~/bin/supervisord > $HOME/my/logs/cron/supervisord.log 2>&1
into your crontab"
@andryw
Copy link

andryw commented May 8, 2017

Hi!
I was trying to run Solr with supervisord but when the Solr crashes the process don’t restart. Did it happen the same with you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment