Unified repository for both, dummy rest server and client components for the DIVAServices Spotlight project
- Checkout the repository
- Install the mandatory dependencies: * mongoDB and start mongo daemon * Node.js and update npm * GraphicsMagick
Following packages must be installed globally. If you use `install` script, you can omit this and all the following sections from *Install*.
* [CoffeeScript](http://coffeescript.org/) ``npm install -g coffee-script``
* [Brunch](http://brunch.io/) ``npm install -g brunch``
* [Bower](http://bower.io/) ``npm install -g bower``
* [Node Foreman](https://github.com/strongloop/node-foreman) ``npm install -g foreman``
* [forever](https://github.com/foreverjs/forever) ``npm install -g forever``
- Change to the
restdirectory and let NPM install the necessary libraries:
```bash
$ cd rest
$ npm install
```
- Change to the
webdirectory and install the required Node.JS modules:
```bash
$ cd web
$ npm install
$ bower install
```
- Change to the
testdirectory and install the required Node.js modules:
```bash
$ cd test
$ npm install
```
- Create the folder logs under /web/
- Add dummy backend host to
hostscollection india_devanddia_testdatabase
```bash
$ mongo
> use dia_dev
> db.hosts.insert({"host": "Dummy Backend Host", "url": "http://localhost:8081"})
> use dia_test
> db.hosts.insert({"host": "Dummy Backend Host": "url": "http://localhost:8081"})
```
- Configure mongo-express if you intend to use it. (Per default it is disabled. To enable it, uncomment line 6 in
Procfile.dev)
Assuming you are in the root folder
```bash
$ cd web/node_modules/mongo-express
$ cp config.default.js config.js
```
Then change the port on line 46 to ``8083``. If you have any authentication settings on your mongoDB, please configure the ``config.js`` file according to it.
The DIVAServices Spotlight application can be started within three environments.
- Developing mode
$ export NODE_ENV=dev && nf -j Procfile.dev start
# or
$ nf -j Procfile.dev -e etc/dev.env startThis configuration is recommended if you want to develop. 2. Testing mode
$ export NODE_ENV=test && nf -j Procfile.dev start
# or
$ nf -j Procfile.dev -e etc/test.env startThis configuration is mandatory for running the tests. 3. Production mode
# Build static files for production
$ cd web && rm -r public && brunch b -P && cd ..
# and run with
$ export NODE_ENV=prod && nf start
# or
$ nf -e etc/prod.env startThis configuration is used for production.
Assuming you are in the root folder. Execute the following scripts:
$ ./scripts/run-tests (runs all the tests)If you want to run the tests manually:
- e2e
In root folder:
Shell 1
$ nf -j Procfile.dev -e etc/test.env start
Shell 2
$ cd test
$ npm run e2e- server
In root folder:
# Shell 1
$ coffee rest/server.coffee
# Shell 2
$ ./test/node_modules/.bin/mochaTo start and stop dummy rest server and web client with one command:
$ nf -j Procfile.dev -e etc/dev.env startFor manually starting backend server
$ cd rest
$ forever -m 5 --minUptime 1000 --spinSleepTime 5000 --watch -c coffee server.coffeeFor manually starting web client
$ export NODE_ENV=dev
$ cd web
$ brunch w -sThen go to localhost:3000
To run DIVAServices Spotlight in production mode follow those steps:
$ cd web && rm -r public && brunch b -P && cd ..
$ nf -e etc/prod.env start