This is a self-hosted application that requires some setup to use. To get started, you'll need to have a few things:
- NodeJS v7 installed.
- A system running with BASH (A native shell used by Linux and OSX, windows is not supported but cygwin might work)
- A TRN Api key, you can get one at https://battlefieldtracker.com/site-api
Instead of hard-coding any configuration, this standalone application uses environment variables. The following are used:
Key | Description |
---|---|
TRN_API_KEY | Required API Key required to comminucate with battlefieldtracker.com |
NODE_ENV | Use "production" for an optimized version, anything else is considered "development" (is "development" by default) |
HOST | Optional domain host - falls back to IP |
IP | Optional ip - falls back to 0.0.0.0 |
PORT | Optional port - falls back to 3000 |
REDIS_URL | Optional URL to your redis endpoint - if blank redis is not used |
KEEN_PROJECT_ID | Optional, Keen analytics project ID - ignore if you dont want to use. |
KEEN_WRITE_KEY | Optional, Keen analytics write key - ignore if you dont want to use. |
Download NodeJS
Clone this project:
git clone https://github.com/MattMcFarland/bf-swag
Install Dependencies:
npm install
Start the application:
npm start
It is highly recommended you use a cloud platform that takes advantage of the nodejs pipeline. Heroku, MS Azure, Google CLoud Compute, and Amazon AWS are all viable options. I personally used Heroku for this project and found it to be the easiest.
If you are planning on running this on your own managed server - some extra steps will be necessary, and the installation will be more difficult!
It might be worth it to install pm2
http://pm2.keymetrics.io/
To run with apache, see http://stackoverflow.com/questions/9831594/apache-and-node-js-on-the-same-server
If you are running with nginx - see https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04