Created
September 22, 2018 00:39
-
-
Save viq/8a80a40922354350aef7f35e21e8a3b3 to your computer and use it in GitHub Desktop.
WIP state to set up nightscout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include: | |
- mongodb | |
setup nightscout: | |
pkg: | |
- installed | |
- names: | |
- git | |
- node | |
- supervisor | |
group: | |
- present | |
- name: _nightscout | |
- system: True | |
user: | |
- present | |
- name: _nightscout | |
- groups: | |
- _nightscout | |
- home: /usr/local/nightscout | |
- createhome: True | |
- shell: /bin/false | |
- system: True | |
- gid_from_name: True | |
- require: | |
- group: setup nightscout | |
git: | |
- latest | |
- target: /usr/local/nightscout/nightscout | |
- name: https://github.com/nightscout/cgm-remote-monitor.git | |
- user: _nightscout | |
- require: | |
- pkg: setup nightscout | |
- user: setup nightscout | |
mongodb_user: | |
- present | |
- name: nightscout | |
- passwd: {{ salt['pillar.get']('nightscout:mongo:password') }} | |
- database: nightscout | |
- authdb: admin | |
- roles: | |
- readWrite | |
- dbOwner | |
- require: | |
- sls: mongodb | |
npm: | |
- bootstrap | |
- name: /usr/local/nightscout/nightscout | |
- user: _nightscout | |
- onchanges: | |
- git: setup nightscout | |
nightscout npm deps: | |
npm: | |
- installed | |
- name: webpack | |
- user: _nightscout | |
- dir: /usr/local/nightscout/nightscout | |
- force_reinstall: True | |
- onfail: | |
- npm: setup nightscout | |
nightscout bootstrap: | |
npm: | |
- bootstrap | |
- name: /usr/local/nightscout/nightscout | |
- user: _nightscout | |
- onchanges: | |
- npm: nightscout npm deps | |
{% set nightscout_env=['MONGO_CONNECTION="mongodb://nightscout:' ~ salt['pillar.get']('nightscout:mongo:password') ~ '@127.0.0.1:27017/nightscout"', | |
'API_SECRET="' ~ salt['pillar.get']('nightscout:api:secret') ~ '"', | |
'TIME_FORMAT="24"', | |
'ENABLE="careportal,delta,direction,upbat,timeago,devicestatus,ar2,simplealarms,iob,cob,sage"', | |
'HOSTNAME="127.0.0.1"'] | |
%} | |
supervisord for nightscout: | |
service: | |
- running | |
- name: supervisord | |
- enable: True | |
- require: | |
- pkg: setup nightscout | |
file: | |
- managed | |
- name: /etc/supervisord.d/nightscout.ini | |
- mode: 0600 | |
- replace: False | |
- require: | |
- pkg: setup nightscout | |
ini: | |
- options_present | |
- name: /etc/supervisord.d/nightscout.ini | |
- strict: True | |
- require: | |
- file: supervisord for nightscout | |
- sections: | |
'program:nightscout': | |
command: '/usr/local/bin/node server.js' | |
user: _nightscout | |
directory: '/usr/local/nightscout/nightscout' | |
redirect_stderr: True | |
environment: {{ nightscout_env|join(',') }} | |
supervisord: | |
- running | |
- name: nightscout | |
- update: True | |
- watch: | |
- ini: supervisord for nightscout | |
- watch_any: | |
- npm: setup nightscout | |
- npm: nightscout bootstrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment