Installing DADI CDN
Joseph Denne 2016-12-14T14:28:59Z
269 words
1 min read

Image libraries

$ sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev

Sqwish CSS Compressor

$ sudo npm install -g sqwish

Upgrade GCC++ Compiler

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update -y
$ sudo apt-get install gcc-4.9 g++-4.9
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

NPM

All our platform microservices are available from NPM. To install CDN:

$ npm install @dadi/cdn

Manual install

If you do not want to use NPM, you can grab the latest release. Then you can install:

$ cd ./release-download-location/
$ npm install

Using DADI Generator

We have a handy tool to generate new applications easily.

$ npm install -g @dadi/generator
$ dadi-generator cdn /path/to/your_new_app
$ cd /path/to/your_new_app
$ npm install
$ npm start

Dependencies

API requires MongoDB. There is a complete guide to installing this and API together here.

You can see our full list of dependencies in the package.json.

Tests

If you have installed manually, you can run tests by:

$ npm run test

Forever (optional)

As with most Node.js applications, to run the app in the background you will need to install install Forever and Forever-service:

$ [sudo] npm install forever -g
$ [sudo] npm install -g forever-service

Install DADI CDN as a service and ensure it loads on boot:

$ [sudo] forever-service install -s main.js -e NODE_ENV=production cdn --start

Note the environment variable NODE_ENV=production must be set to target the required config version.

You can then interact with the service using the following command:

$ [sudo] start cdn
$ [sudo] stop cdn
$ [sudo] status cdn
$ [sudo] restart cdn

And you’re done, now move on to configuration.

See something to improve? Edit in Github.