Skip to content

Instantly share code, notes, and snippets.

@light9
Last active October 28, 2016 04:40
Show Gist options
  • Save light9/a6ac23862636ceaccc36 to your computer and use it in GitHub Desktop.
Save light9/a6ac23862636ceaccc36 to your computer and use it in GitHub Desktop.
baasbox as a service on Ubuntu 14.04 based on http://www.unsure.org/baasbox/ubuntu/running-baasbox-on-ubuntu/
./start (on *nix) You might need to grant execution permissions via chmod +x ./start
# Install Java, Supervisor, and unzip
apt-get install software-properties-common
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer unzip supervisor
# Add baasbox user and set up directories
sudo adduser baasbox
sudo -u baasbox
sudo mkdir -p /opt/baasbox
sudo mkdir -p /var/log/baasbox
# Download Baasbox
cd /opt
wget --content-disposition http://www.baasbox.com/download/baasbox-stable.zip
unzip baasbox-stable.zip
sudo chown -R baasbox /var/log/baasbox /opt/baasbox-*
ln -s baasbox-0.9.4 baasbox
#/opt/baasbox/start
#!/bin/bash
scriptdir="/opt/baasbox"
classpath="$scriptdir/lib/*"
# check if the RUNNING_PID file exists. In this case it will be deleted if there is no process with the same PID stored in it
# RUNNING_PID file is created by BaasBox when it starts. If it quits unexpectedly (kill -9, server crash) the file is not deleted and BaasBox will not restarts
if [ -f RUNNING_PID ];
then
ps -p $(cat RUNNING_PID) > /dev/null; test $? -eq 1 && rm RUNNING_PID
fi
exec java ${1+"$@"} -Dconfig.file=/opt/baasbox/baasbox.conf -cp "$classpath" play.core.server.NettyServer $scriptdir
#/opt/baasbox/baasbox.conf
include classpath("application.conf")
application.code="1234567890"
orient.baasbox.path="/opt/baasbox/db/baasbox"
orient.baasbox.backup.path="/opt/baasbox/db/backup"
push.baasbox.certificates.folder="/opt/baasbox/certificates"
#/etc/supervisor/conf.d/baasbox.conf
[program:baasbox]
command=/opt/baasbox/start
user=baasbox
autostart=true
autorestart=true
stderr_logfile=/var/log/baasbox/baasbox.err.log
stdout_logfile=/var/log/baasbox/baasbox.out.log
#restart supervisor
service supervisor restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment