This folder contains the REST API for Cyclotron. It is a Node.js application, built with Express. Data is stored in MongoDB using the Mongoose library.
Refer to the installation instructions in the parent README.md.
The service configuration is located in config/config.js
. This file is missing by default, but there are sample templates in the same folder which can be copied and used. The service will not start without the config file in place.
The available configuration properties are documented in `config/sample.config.js'. This config file can be used as-is to connect to a local MongoDB server, or used as a starting point for a new configuration.
Deploying Cyclotron on a server is dependent on the OS. The primary concern is running the web service as a daemon instead of a user account. Included in the cyclotron-svc/init.d/
folder is a sample sysvinit script which can be used in many flavors of Linux.
-
Install Node.js and npm
-
Install the cyclotron-svc files onto the server, for example:
/opt/app/cyclotron-svc
-
Create the configuration file in
/opt/app/cyclotron-svc/config/
-
Copy the
cyclotron-svc/init.d/cyclotron-svc
script to/etc/init.d/cyclotron-svc
-
Install forever globally via npm:
npm install -g forever
Forever is used to restart the service if it crashes.
-
Install PhantomJS and CasperJS globally via npm:
npm install -g phantomjs npm install -g casperjs
These packages are used to export Dashboards to PDFs.
-
Create the
log/
andexport/
folder and grant permissions -
Start the service via init.d:
sudo service cyclotron-svc start
-
Enable auto-run on system start:
sudo chkconfig cyclotron-svc on
These steps may vary for different operating systems.