2014-03-10 00:25:00 +00:00
#!/usr/bin/env bash
2014-04-09 15:00:42 +00:00
#
# HabitRPG provisioning script
2014-03-10 00:25:00 +00:00
2014-04-09 15:00:42 +00:00
# function for autostart
function autostart_habitrpg {
update_config = $'Please update config.json with your values\nfor ADMIN_EMAIL, SMTP_USER, SMTP_PASS and SMTP_SERVICE,\nthen run "vagrant reload --provision"'
2014-03-10 00:25:00 +00:00
2014-04-09 15:00:42 +00:00
# check if config.json exists, then check if the defaults are still in place
if [ -e config.json ] ;
2014-03-10 00:25:00 +00:00
then
2014-04-09 15:00:42 +00:00
if grep -Fq 'ADMIN_EMAIL": "you@yours.com' config.json;
then
echo " $update_config " ;
exit;
else
npm start
fi
else
cp config.json.example config.json;
2014-03-10 00:25:00 +00:00
echo " $update_config " ;
exit;
fi
2014-04-09 15:00:42 +00:00
}
# Main provisioning
echo Setting up HabitRPG...
echo cd /vagrant >> /home/vagrant/.bashrc
2014-07-24 08:34:27 +00:00
# Prevent warnings: "dpkg-preconfigure: unable to re-open stdin ..."
export DEBIAN_FRONTEND = noninteractive
2014-04-27 06:03:05 +00:00
echo Updating repositories...
2014-04-09 15:00:42 +00:00
apt-get update -qq
2014-07-24 08:34:27 +00:00
echo Installing Unix build tools - needed for node-gyp to use make...
apt-get install -qq build-essential
echo Installing GraphicsMagick - provides gm and convert...
apt-get install -qq graphicsmagick
echo Installing phantomjs and dependency...
apt-get install -qq phantomjs libicu48
echo Installing requirements for grunt-spritesmith...
apt-get install -qq pkg-config libcairo2-dev libjpeg-dev
2014-04-09 15:00:42 +00:00
echo Installing Mongodb...
apt-get install -qq mongodb
echo Installing Git...
apt-get install -qq git
echo Installing npm...
apt-get install -qq python-software-properties
2014-04-27 06:03:05 +00:00
echo Adding repository node.js...
2014-04-09 15:00:42 +00:00
apt-add-repository -y ppa:chris-lea/node.js
2014-04-27 06:03:05 +00:00
echo Updating repositories...
2014-04-09 15:00:42 +00:00
apt-get update -qq
2014-04-27 06:03:05 +00:00
echo Installing node.js
2014-04-09 15:00:42 +00:00
apt-get install -qq nodejs
cd /vagrant
echo Installing grunt/bower...
npm install -g grunt-cli bower
echo Installing HabitRPG
npm install
2014-05-21 03:03:09 +00:00
echo Installing Bower packages
2014-07-24 08:34:27 +00:00
sudo -H -u vagrant bower --config.interactive= false install -f
2014-05-21 03:03:09 +00:00
2014-09-12 03:09:08 +00:00
## # echo Seeding Mongodb...
## node ./src/seed.js
2014-09-12 03:12:42 +00:00
## no longer required - see comments in src/seed.js
2014-04-09 15:00:42 +00:00
2014-04-27 06:03:05 +00:00
# Uncomment both lines to autostart the habitrpg server when provisioning
# echo Starting HabitRPG server...
2014-04-09 15:00:42 +00:00
# autostart_habitrpg