I have an application (github's Hubot), that was built to run on Heroku - but I want to run it on our internal Windows 2012 server, for reasons.
One requirement of the solution, is I need to be able to read in a .env
file filled with env vars before the process starts. It runs fine via foreman start
, but it would be desirable to run it as a service that would restart if it crashes.
Currently I'm running it through RunAsService, but this doesn't really have the desired behavior, as it doesn't restart the actual process if it fails. This could perhaps be due to my configuration (listed below), but there doesn't seem to be any other way to run it.
Since this is just a development server, I'm not too concerned about best practices - I just don't want to log into the box every time the bot goes down.
Am I going to have to write my own service, or is there a simpler way? Another answer mentioned using env
along with nodemon
, but AFAIK this is *nix-centric.
Does Windows have a similar method for reading in environment variables?
<service>
<name>hubot</name>
<executable>C:\Ruby200-x64\bin\foreman</executable>
<parameters>start -d C:\node\hubot</parameters>
</service>