The default restart policy for containers is "no". As a result, the service container (graphite, haraka) are not started on system reboot. The apps themselves are resumed by apps.js. That code also handles resumption of app tasks should the box have crashed/rebooted midway. This code could have been placed in a supervisor script or an init script. init script means tighter integration into the system OS which we want to avoid. supervisor script could be done at some point should we need a more sophisticated "pre-start" script. Fixes #98
The Box
Development setup
-
sudo adduser yellowtent ** This dummy user is required for supervisor 'box' configs
-
rmappdir.sh should be callable without a password ** Add a file called /etc/sudoers.d/yellowtent with the following contents: Defaults!/home/girish/yellowtent/box/src/scripts/rmappdir.sh env_keep=HOME girish ALL=(ALL) NOPASSWD: /home/girish/yellowtent/box/src/scripts/rmappdir.sh Defaults!/home/girish/yellowtent/box/src/scripts/reloadnginx.sh env_keep=HOME girish ALL=(ALL) NOPASSWD: /home/girish/yellowtent/box/src/scripts/reloadnginx.sh Defaults!/Users/girishra/research/yellowtent/box/src/scripts/backup.sh env_keep=HOME girishra ALL=(ALL) NOPASSWD: /Users/girishra/research/yellowtent/box/src/scripts/backup.sh Defaults!/Users/girishra/research/yellowtent/box/src/scripts/update.sh env_keep=HOME girishra ALL=(ALL) NOPASSWD: /Users/girishra/research/yellowtent/box/src/scripts/update.sh Defaults!/Users/girishra/research/yellowtent/box/src/scripts/reboot.sh env_keep=HOME girishra ALL=(ALL) NOPASSWD: /Users/girishra/research/yellowtent/box/src/scripts/reboot.sh Defaults!/Users/girishra/research/yellowtent/box/src/scripts/reloadcollectd.sh env_keep=HOME girishra ALL=(root) NOPASSWD: /Users/girishra/research/box/src/scripts/reloadcollectd.sh
(replace the username and path to rmappdir.sh to match your environment)
You might have to clear the sudo cache using sudo -k.
** scripts/checkInstall.sh
** Add admin-localhost as 127.0.0.1 in /etc/hosts ** All apps will be installed as hypened-subdomains of localhost. You should add hyphened-subdomains of your apps into /etc/hosts
Running
-
./run.sh - this starts up nginx to serve up the webadmin ** Navigate to https://admin-localhost
-
DEBUG=box:* ./app.js - this the main box code ** NODE_ENV is set to production by default
Deployment setup
Creating a box image involves the following steps:
- scripts/createDigitalOceanImage.sh <GIT_REF>
- This should spit out a image id at the end of the script