-
Notifications
You must be signed in to change notification settings - Fork 650
Installing As a Windows Service
Roy Adams edited this page Oct 28, 2015
·
11 revisions
Loosely based upon the instructions found here. I crafted the following and it provided me with a fully working sinopia service installation:
- Create a directory for sinopia
mkdir c:\sinopia
cd c:\sinopia
- Install sinopia locally (I ran into npm issues with global installs)
npm install sinopia
- Create your config.yaml file in this location (
c:\sinopia\config.yaml
) - Windows Service Setup
- Using WinSW
- Download WinSW
- Place the executable (e.g.
winsw-1.9-bin.exe
) into this folder (c:\sinopia
) and rename it tosinopia-winsw.exe
- Place the executable (e.g.
- Create a configuration file in
c:\sinopia
, namedsinopia-winsw.xml
with the following configuration
- Download WinSW
- Using WinSW
<service>
<id>sinopia</id>
<name>sinopia</name>
<description>sinopia</description>
<executable>node</executable>
<arguments>c:\sinopia\node_modules\sinopia\lib\cli.js -c c:\sinopia\config.yaml</arguments>
<logmode>roll</logmode>
<workingdirectory>c:\sinopia\</workingdirectory>
</service>
* Install your service
* ``cd c:\sinopia``
* ``sinopia-winsw.exe install``
* Start your service
* ``sinopia-winsw.exe start``
Some of the above config is more verbose than I had expected, it appears as though 'workingdirectory' is ignored, but other than that, this works for me and allows my sinopia instance to persist between restarts of the server, and also restart itself should there be any crashes of the sinopia process.
* _ALTERNATIVE METHOD_: Using NSSM (WinSW package was missing when I tried to download it)
* Download [NSSM](https://www.nssm.cc/download/) and extract
* Open an administrative command
* Browse to the nssm extract location
* Run `nssm install sinopia`
At a minimum you must fill in the _Application_ tab Path, Startup directory and Arguments fields.
Assuming an install with node in the system path and a location of c:\sinopia the below values will work:
* Path: node
* Startup directory: c:\sinopia
* Arguments: c:\sinopia\node_modules\sinopia\lib\cli.js -c c:\sinopia\config.yaml
You can adjust other service settings under other tabs as desired.
When you are done, click _Install service_ button