Project

General

Profile

Support #353

Updated by Daniel Curtis about 10 years ago

This guide is to document setting up a self-hosted HabitRPG node. It is assumed that the node is setup and configured as an ISPConfig web server node, as covered in Issue #177.  

 h2. Install and set up MongoDB 

 <pre> 
 apt-get install mongodb 
 </pre> 

 h2. Install and set up NodeJS and NPM 

 Because Ubuntu's software repositories may run a few months behind the latest revisions, Ubuntu users will want to install node from an updated repository: 
 <pre> 
 apt-get update 
 apt-get install python-software-properties 
 apt-add-repository ppa:chris-lea/node.js 
 apt-get update 
 apt-get install nodejs 
 </pre> 

 h2. (Optional) Building NodeJS from source 

 Since I am not running an Ubuntu system, I had to resort to compiling the latest NodeJS from source. 

 h3. Resolve prerequisite packages 

 <pre> 
 apt-get install python g++ make checkinstall 
 </pre> 

 h3. Make, then change into a temporary build folder 

 <pre> 
 src=$(mktemp -d) && cd $src 
 </pre> 

 h3. Get latest NodeJS source 

 <pre> 
 wget -N http://nodejs.org/dist/node-latest.tar.gz 
 </pre> 

 h3. Extract NodeJS source 

 <pre> 
 tar xzvf node-latest.tar.gz && cd node-v* 
 </pre> 

 h3. Configure build variables 
 <pre> 
 ./configure 
 </pre> 

 h3. Build a .deb package 
 <pre> 
 fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p') make -j$(($(nproc)+1)) install 
 </pre> 

 Install the NodeJS .deb 
 <pre> 
 sudo dpkg -i node_* 
 </pre> 

 h2. Install and set up Git 

 Fork the repository on your computer 
 <pre> 
 git clone https://github.com/HabitRPG/habitrpg.git 
 </pre> 

 Make sure you are on the develop branch where all the development, this should be the default branch if you are forking from github. You can check with git branch, the branch with a star next to it is the branch you are currently on. If you are not on the develop branch switch to it 
 <pre> 
 cd /path/to/habitrpg 
 git checkout develop 
 </pre> 

 h2. Install grunt-cli npm package globally 

 Note: On some systems you may need to add sudo in front of this command 

 <pre> 
 npm install -g grunt-cli bower 
 </pre> 

 h3. Install the npm and bower packages: 

 <pre> 
 npm install 
 </pre> 

 h2. Create a config file from the example one: 

 <pre> 
 cp config.json.example config.json 
 </pre> 

 Edit @config.json@ with your values for:  
 * *ADMIN_EMAIL* 
 * *SMTP_USER* 
 * *SMTP_PASS* 
 * *SMTP_SERVICE* 

 Ensure that Mongo is running: 
 <pre> 
 service mongodb start 
 </pre> 

 Then seed the database with initial settings: 
 <pre> 
 node ./src/seed.js 
 </pre> 

 h2. Run HabitRPG  

 There are two ways to start the web application: 
 # Using grunt 
 <pre> 
 grunt run:dev 
 </pre> 
 # *OR* Using NPM 
 <pre> 
 npm start 
 </pre> 

 This will start an HTTP server on port 3000, so pointing a web browser there will access the HabitRPG site 

 h2. Troubleshooting 

 I encountered a couple of errors while starting the web application. 

 h3. Failure to start grunt 

 > failed to locate @import file ../bower_components/angular-loading-bar/build/loading-bar.css Warning: Stylus failed to compile. Used --force, continuing. 

 You need to update bower and restart the command: 
 <pre> 
 bower update 
 grunt run:dev 
 </pre> 

 h3. bower update fails 

 > Error: EEXIST, rename '.bower-cache/ef2188def21eb1bbd1f1792311942a53/1.2.15-build.2360%2Bsha.6b18a56' 

 If you encounter this or a similar error when issuing a bower update, perform the following: 
 <pre> 
 cd .bower-cache/ef2188def21eb1bbd1f1792311942a53/ 
 rm -rf 1.2.15-build.2360%2Bsha.6b18a56 
 </pre> 

 The actual names of these directories may differ on your system.  

 h2. Resources 

 * http://habitrpg.wikia.com/wiki/Setting_up_HabitRPG_locally 
 * http://habitrpg.wikia.com/wiki/Guidance_for_Blacksmiths#Git 
 * http://habitrpg.wikia.com/wiki/Installation_troubleshooting 
 * https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Back