Open brianteeman opened 7 months ago
I think it is entirely possible to do this already, with some effort. I'm not sure what we should do on this here, other than perhaps a wiki page describing the process? Do you fancy drafting a guide for setting this up?
I think the process will be to:
c:\program files\companion\resources\node-runtime\node.exe c:\program files\companion\resources\main.js
--config-dir c:\some-dir-here
using some directory that this service will have write access to and should use to store the config--admin-address
or --admin-interface
may want to be set, depending on your needsIt is also worth noting, that this companion will not appear in the tray, but the interface will be accessible in a browser at http://localhost:8000 like normal
Thanks - will try that
@brianteeman where you able to get this to work as a service in windows?
Also interested in if you were able to get this to work.
Hey ... i think i found a solution/workaround...
As far as I've read it's not possible to run node as a native windows service. But ...
You can use a wrapper like WinSW (https://github.com/winsw/winsw) to run companion as Service. I used the following steps:
C:\ProgramData\companion
C:\ProgramData\companion
and rename it to companion.exe
C:\ProgramData\companion\companion.xml
. I've uploaded mine with this Comment.C:\ProgramData\companion
.companion.exe install
... This now creates the service called companion
which can be found in the services.msc
.companion.exe start
to start the service. At this point you should be able to open http://127.0.0.1:8000/
with your web browser :)My companion.xml
:
<service>
<id>companion</id>
<name>Companion</name>
<description>Run Bitfocus Companion as Service</description>
<executable>"c:\program files\companion\resources\node-runtime\node.exe"</executable>
<arguments>"c:\program files\companion\resources\main.js" "--config-dir" "C:\ProgramData\companion" "--admin-address" "127.0.0.1"</arguments>
</service>
For more info on WinSW have a look at their Readme and the doc folder inside the project.
Really sorry about the delay in replying. Life got in the way - these are my notes from doing it using nssm
Download the latest version and extract the contents to a directory of your choice.
Open a Command Prompt with Administrator Privileges:
Navigate to the NSSM Directory:
Install the Node.js Service:
nssm install YourServiceName "C:\Program Files\Companion\Resources\node-runtime\node.exe" "C:\Program Files\Companion\Resources\main.js"
Replace YourServiceName with the desired name for your service.
Configure Service Parameters: A graphical interface will appear. Here, you can configure parameters like startup directory, dependencies, etc. Make sure to set the correct paths and settings for your Node.js script.
Save Configuration:
Click on the "Install Service" button to save your configuration and install the service.
Start the Service:
net start YourServiceName
Replace YourServiceName with the name you provided before.
Now, your Node.js script should be running as a service on your Windows 11 system. You can manage the service using the "Services" application (services.msc) or other service management tools.
@Julusian, @swamiforlife2, @lfrisk, @brianteeman
I'm not sure if Companion is running as a service, but here are the steps I do to have Companion start with a machine running Windows.
Notes: Companion does not show up in the system tray. If you need to change the GUI interface, you will need to stop the Companion task from inside task schedular and start Companion from the app list/program location.
Is this a feature relevant to companion itself, and not a module?
Is there an existing issue for this?
Describe the feature
The ability to run companion as a windows service would be great. Then we can start companion automatically with windows and not have to login
Usecases
The remote PC used for companion will regularly reboot and sit at the windows login screen. Any attached surface or comapnion satellite will be unable to work until someone gets to the PC and logs in. (assuming they even know why nothing is working).