Giter VIP home page Giter VIP logo

Comments (7)

Julusian avatar Julusian commented on September 25, 2024 1

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:

  • install companion like normal
  • Use some tool (not sure if there is anything builtin to windows for this, or if something needs to be found) to create the service
    • This should run c:\program files\companion\resources\node-runtime\node.exe c:\program files\companion\resources\main.js
    • Some arguments will be needed to that command.
      • Possibly just --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 needs
    • The service may need to be run as a specific user, probably doesnt need to be an administrator

It 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

from companion.

brianteeman avatar brianteeman commented on September 25, 2024

Thanks - will try that

from companion.

swamiforlife2 avatar swamiforlife2 commented on September 25, 2024

@brianteeman where you able to get this to work as a service in windows?

from companion.

lfrisk avatar lfrisk commented on September 25, 2024

Also interested in if you were able to get this to work.

from companion.

IMBArator avatar IMBArator commented on September 25, 2024

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:

  1. Download and install Companion as usual. Disable companion's Autostart in your user if already enabled.
  2. Create a folder to store the wrapper and the companion config data -> C:\ProgramData\companion
  3. Download Winsw to C:\ProgramData\companion and rename it to companion.exe
  4. Create the winsw config file C:\ProgramData\companion\companion.xml. I've uploaded mine with this Comment.
  5. Start a cmd with admin privileges and cd into C:\ProgramData\companion.
  6. Run companion.exe install ... This now creates the service called companion which can be found in the services.msc.
  7. Now run 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.

from companion.

brianteeman avatar brianteeman commented on September 25, 2024

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.

from companion.

mwb9aa avatar mwb9aa commented on September 25, 2024

@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.

  1. Install Companion as normal.
  2. Uncheck the Run at Login box (to avoid the error Companion is already running).
  3. Change the GUI interface dropdown to All Interfaces 0.0.0.0.
  4. Open Task Scheduler.
  5. Create a Task
    • Choose a task trigger as "At startup". (Choose a delay if you have services or connections that need to run on that machine before starting Companion).
    • Choose to start a program from a location such as "C:\Program Files\Companion\Companion.exe".
    • Modify Conditions or Settings as needed. I suggest checking "Allow task to be run on demand", and "If the running task does not end when requested, force it to stop".
    • After creating the task, modify the General properties to select "Run whether the user is logged on or not. You don't have to use as password unless you would need Companion to access more resources than normal.

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.

from companion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.