Install/run node apps on FreeBSD (could be easily adapted)
- dedicated system user/home
- git source pull/update
- config template placeholder
- syslog for output
- FreeBSD rc script for start/stop/restart
node_version
(8) node major versionnode_apps
([]) list of dicts for each app (see app variables below)node_update_git
(True) update git sources if anynode_force_git
(False) update git sources overriding local changesnode_force_conf
(False) overwrite existing config filesnode_start_app
(True) Set to false to start/enable app by other way
name
MANDATORY short name for the app, [a-z0-9] onlyuser
(name
)path
(/home/name
)script
(app.js)scriptargs ({})
dict of runtime flags passed to scriptgitsrc
('') Git repository sourcegitversion ('master')
Git repo tag/branchgitupdate
(node_update_git
) Will update source codegitforce
(node_force_git
) Will force source updateconfs
([]) List of config files, as dicts of {src=template,dest=dest} dest can be relative toapp.path
use_syslog
(False) IP/name of syslog server (do enable syslog)syslog_tag
(app.name
)env (developement)
NODE_ENV valueenvvars ({})
dict of environment variablesdeploy_command ('')
command to deploy code (instead of automatic npm or bower)
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- criecm.node
vars:
node_apps:
- name: myapp1
script: index.js
gitsrc: 'https://git.web.url/myproject.git'
confs:
- src: mytemplace.js.j2
dest: config.js
BSD