-
Install Node v.0.10.18 or higher.
-
If you've installed Titanium Studio, then you most likely have already installed Node and NPM. Otherwise, check the official Node installation instructions
-
For Ubuntu, you will most likely have to run the following commands (but check the official instructions first):
sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install python-software-properties python g++ make nodejs
-
Verify that
node -v
returns0.10.xx
andnpm -v
returns1.4.x
-
-
Checkout the analytics server from Git.
- HTTPS:
https://YOUR-BITBUCKET-USERNAME@bitbucket.org/taleblazer/taleblazer_analytics.git
- SSH:
git clone git@bitbucket.org:taleblazer/taleblazer_analytics.git
- HTTPS:
-
Configure your database connection.
- In the
config
directory, copyconfig.example.json
toconfig.json
. - Fill in the details for the environment that you're in, according to your purpose:
- For development purposes: Fill in 'development' and 'test' so that you can run tests locally. Make sure that the database for 'test' is different from the 'development' database, as running tests clears and remakes analytics tables every time they are run.
- For deployment purposes: Only fill in the 'production' entry, and delete the rest. DO NOT INCLUDE THE TEST ENVIRONMENT*
- NOTE: You can usually get the database details from the
database.php
inapp/Config
of the TaleBlazer Server repository.
- In the
-
(For development purposes) Set up testing
- Install Mocha:
npm install mocha -g
- The
-g
flag installs it globally and is required for testing.
- The
- Run tests by running
npm test
in the top-level analytics directory.All tests should pass.
- Install Mocha:
-
(For deployment purposes) Install Forever and set the NODE_ENV environment variable.
-
Install Forever:
npm install forever -g
-
Set the NODE_ENV variable via the following terminal commands:
echo export NODE_ENV=production >> ~/.bash_profile source ~/.bash_profile
-
-
Run the server
- Development:
node server.js
- Deployment:
npm start
- Stop the server with
npm stop
- Stop the server with
- Development: