haswellr / CritterDB

A web application to help you find and create custom creatures and NPCs for the 5th edition of the world's greatest role playing game.
http://www.critterdb.com
53 stars 15 forks source link

CritterDB

A web application to help you find and create custom creatures and NPCs for the 5th edition of the world's greatest role playing game.

CritterDB Demo

Submitting Feedback & Bugs

The best way to bring an issue to light is by submitting an issue right here on Github. If you wish to, however, you can also contact me directly at haswellrd@gmail.com.

Working on CritterDB

Any help on the project is much appreciated. The goal is for CritterDB to be reliable, easy to use, and feature-rich, and that will be best achieved with the help of all the strong developers in the role playing community.

If do you want to help out with CritterDB, getting started is easy. The site runs on NodeJS with Angular 1 on the front end and a Mongo database. Angular Material is used as a UI framework for the front end. CritterDB uses npm to manage back-end packages, and grunt to handle pre-deployment tasks such as code minification and compilation. Use the following instructions to set up a local development environment for CritterDB:

Install Prerequisites

  1. Install nodejs + npm (Further instructions on the Node.js website). Npm is typically installed with Nodejs.
  2. Install Grunt globally by running the following command on the command line:
    1. npm install -g grunt-cli
  3. Run a MongoDB server on your machine or set up a server in the cloud. This setup is up to you. Personally I use mLab to host my MongoDB servers as they have a free sandbox tier and the site is very easy to use.

Get the code

Clone the code from Github.

Install Dependencies

CritterDB uses npm to manage its back-end dependencies. Navigate to the CritterDB/server/ folder on the command line, then execute the following command:

  1. npm install

Settings and configuration for npm can be found in 'package.json'.

Configure

CritterDB has a config file which manages several values that must be set before you can run CritterDB. This file is not stored in git as it varies based on dev or deployment environment. Navigate to the 'server' folder within the CritterDB project. Copy 'sampleconfig.js' and name the new file 'config.js'.

Copy sampleconfig.js

Now, open config.js and edit the fields to something that is appropriate for your development environment.

And that's it! The most important thing is making sure that the databaseUrl points to your database. Sample image shown below:

Edit config.js

Compile

CritterDB uses Grunt to perform code minification, obfuscation, and any other tasks that must be performed for the code to be ready for production. Grunt should also be used when developing code to simulate the production environment as closely as possible. Grunt scripts are stored in 'gruntfile.js'.

When first setting up the CritterDB code, you should run Grunt once. Navigate to the 'server' folder on the command line and run the following command to use Grunt to compile the code:

  1. grunt

Grunt needs to be run every time the code changes. When you are developing the server you should run 'grunt watch' from the 'server' folder in a command line. This will constantly watch the directory for changes and recompile as needed so that you don't have to re-run grunt every time you want to test anything.

Running the Code

Now you're ready to run the server! Navigate to the 'server' folder on the command line and run the following command:

  1. node server.js

The server should start up and tell you it's running on port 3000. Now you can navigate to 'localhost:3000' in your browser and you should see CritterDB. You will need to restart the server anytime you change back-end code by stopping and re-running 'node server.js'.

Server File Structure

Health Monitor Server

CritterDB also has a simple health monitor server which periodically pings the CritterDB server and will set off alarms if the production server is unhealthy for several health checks in a row. It can be configured to take automated corrective action (such as trying to restart the CritterDB server repeatedly for a certain number of attempts), and can also send out alerts that the server is down.

This project is contained in the healthMonitorServer folder. To run it you will need to create a 'config.js' file by copying the 'sampleconfig.js' file and editing the values as needed. The program itself is small and should be pretty self explanatory.

Contact

You can get in touch with me at haswellrd@gmail.com.