Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install HabitRPG on Uberspace.

##This is a guide to install HabitRPG on an Uberspace.

###Installation

First you have to create a folder which is accessable from the web (e.g. habitrpg.yourdomain.com) and then move to it. In this folder execute

git clone https://github.com/HabitRPG/habitrpg.git .

After that, you have to download some dependencies with:

npm install grunt-cli bower phantomjs
npm install

Now you have all necessary files on your server.

###Configuration

To configure HabitRPG for uberspace you have to copy the config.json.example to config.json with

cp config.json.example config.json

Now look for a free port between 61000 and 65536. (Node apps need a specific port, where they can listen). To check which ports are used you can issue this command:

netstat -tulpen | column -t | grep ':6[1-5][0-9]\{3\}'

Of course we need to redirect the traffic from your domain to the port your app will be running on. So create a file called .htaccess and put the following in it (remember to correct the port to the one, you've chosen):

RewriteEngine On
RewriteRule ^(.*) http://localhost:<YOUR_PORT>/$1 [P]

We also need a database. HabitRPG uses mongodb, so we have to set up a mongodb instance. On an Uberspace that's a no-brainer. ;) Just hit

uberspace-setup-mongodb

Keep the data wherever you want, but keep it. (You can check the mongo instance with mongo admin --port <YOUR_MONGO_PORT> -u '<YOUR_MONGO_USERNAME>' -p '<YOUR_MONGO_PASSWORD>' [replace the <YOUR_MONGO_*>-tags with the output from uberspace-setup-mongodb]. Ctrl-C to exit.)

Ok, lets open the config.json file and edit following lines:

  • The PORT to the port you've chosen
  • The NODE_DB_URI to "mongodb://<YOUR_MONGO_USERNAME>:<YOUR_MONGO_PASSWORD>@localhost:<YOUR_MONGO_PORT>/db?authSource=admin" (replace the <YOUR_MONGO_*>-tags with the data from uberspace-setup-mongodb.
  • The SESSION_SECRET to a random key with 50 characters (alphanumeric)

If you want, you can change the remaining configurations later, but for now it's enough to get HabitRPG running.

###Bring it to life

npm install

(Nothing more to say)

######Have fun!

@mamiu

This comment has been minimized.

Copy link
Owner Author

mamiu commented Mar 24, 2015

For more information (german only) take a look at http://yhaupenthal.org/1422213598.htm

@genlinut

This comment has been minimized.

Copy link

genlinut commented Apr 22, 2015

Bring it to life = npm start ?

Do you know, how to use daemontools to start habitrpg at uberspace?

thx

@Dreknor

This comment has been minimized.

Copy link

Dreknor commented Feb 18, 2016

Doesn't work. npm install showing massive errors and fails

@nantokakantoka

This comment has been minimized.

Copy link

nantokakantoka commented Apr 18, 2016

Yeah, unfortunately this doesn't work for me either.

@perguth

This comment has been minimized.

Copy link

perguth commented Jun 29, 2016

I get a 500 when using the reverse proxy. Something within express router revolts... Need to investigate... I uncommented a comment... that was the reason for the 500.

@perguth

This comment has been minimized.

Copy link

perguth commented Jun 29, 2016

The important takeaway here is ?authSource=admin for the MongoDB connection.

@gruentee

This comment has been minimized.

Copy link

gruentee commented Nov 26, 2016

Worked fine for me, thanks!

@gruentee

This comment has been minimized.

Copy link

gruentee commented Dec 4, 2016

Has anyone tried running Habitica in production mode? When I set NODE_ENV to production in config.json I get redirected to the BASE_URL.

@gruentee

This comment has been minimized.

Copy link

gruentee commented Feb 21, 2017

For the latest version of Habitica npm >= v.3.10.10 is required. Therefore on uberspace you currently need to install Node & npm via nvm.

@gruentee

This comment has been minimized.

Copy link

gruentee commented Feb 24, 2017

Moreover one needs to use a recent version of GCC in order to install (compile) bcrypt >= v1.0.3.

export PATH=/package/host/localhost/gcc-4/bin:$PATH
# then install bcrypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.