Files
habitica/vagrant.sh
T
nivl4 495e103be5 Update vagrant provisioning script to create symlinks for any binaries the package might contain (default npm install behavior), as without those symlinks "npm test" gives the following error:
vagrant@habitrpg:/vagrant$ npm test

> habitrpg@0.0.0-152 test /vagrant
> gulp test

[Error: /vagrant/node_modules/bson/build/Release/bson.node: invalid ELF header]
js-bson: Failed to load c++ bson extension, using pure JS version
[07:07:48] Using gulpfile /vagrant/gulpfile.js
[07:07:48] Starting 'test:prepare:build'...
[07:07:48] Starting 'test:prepare:mongo'...
[07:07:48] Starting 'test:prepare:webdriver'...
[07:07:48] 'test:prepare:build' errored after 33 ms
[07:07:48] Error: Command failed: /bin/sh: 1: ./node_modules/.bin/grunt: not found

    at ChildProcess.exithandler (child_process.js:658:15)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Socket.<anonymous> (child_process.js:979:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)
[07:07:48] Finished 'test:prepare:mongo' after 78 ms
[07:08:50] Finished 'test:prepare:webdriver' after 1.02 min
npm ERR! Test failed.  See above for more details.

- "npm install" was giving the following error in earlier version of VirtualBox when creating symlinks with relative "../" path in shared folders. "--no-bin-links" was a workaround, but it's been fixed in the latest VirtualBox 5.0.8 (https://www.virtualbox.org/ticket/14563)

vagrant@habitrpg:/vagrant$ npm install
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN EPEERINVALID chai-as-promised@3.3.1 requires a peer of chai@>= 1.0.2 < 2 but none was installed.
npm WARN EPEERINVALID karma-requirejs@0.2.2 requires a peer of requirejs@~2.1 but none was installed.
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "node" "/usr/bin/npm" "install"
npm ERR! node v0.10.37
npm ERR! npm  v3.3.6
npm ERR! path ../acorn/bin/acorn
npm ERR! code UNKNOWN
npm ERR! errno -1

npm ERR! UNKNOWN, symlink '../acorn/bin/acorn'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/npm-debug.log
2015-10-24 09:53:01 +08:00

93 lines
2.6 KiB
Bash

#!/usr/bin/env bash
#
# Habitica provisioning script
# 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"'
# check if config.json exists, then check if the defaults are still in place
if [ -e config.json ];
then
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;
echo "$update_config";
exit;
fi
}
# Main provisioning
echo Setting up Habitica...
echo cd /vagrant >> /home/vagrant/.bashrc
# Prevent warnings: "dpkg-preconfigure: unable to re-open stdin ..."
export DEBIAN_FRONTEND=noninteractive
echo Updating repositories...
apt-get update -qq
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 libicu48
echo Installing requirements for grunt-spritesmith...
apt-get install -qq pkg-config libcairo2-dev libjpeg-dev
# Import MongoDB public GPG key
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# Create a list file for MongoDB
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
echo Installing Mongodb...
apt-get update
apt-get install mongodb-10gen
apt-get install -y mongodb-org=2.6.4 mongodb-org-server=2.6.4 mongodb-org-shell=2.6.4 mongodb-org-mongos=2.6.4 mongodb-org-tools=2.6.4
echo Installing Git...
apt-get install -qq git
echo Installing npm...
apt-get install -qq python-software-properties
echo Adding repository node.js...
apt-add-repository -y ppa:chris-lea/node.js
echo Updating repositories...
apt-get update -qq
echo Installing node.js
apt-get install -qq nodejs
echo Updating npm...
npm install -g npm
cd /vagrant
echo Installing gulp/bower...
npm install -g gulp grunt-cli bower
echo Installing Habitica
npm install
echo Installing Bower packages
sudo -H -u vagrant bower --config.interactive=false install -f
## # echo Seeding Mongodb...
## node ./src/seed.js
## no longer required - see comments in src/seed.js
# Uncomment both lines to autostart the habitica server when provisioning
# echo Starting Habitica server...
# autostart_habitrpg