I’m trying to run multiple argo tunnels from the same host running Windows server 2016.
has anyone figured out how to do install several argo services (using a different configuration for each tunnel) ?
How to tell a Cloudflared service to use a specific configuration file?
apparently it always picks the configuration from this location : C:\Windows\System32\config\systemprofile.Cloudflared\config.yml
I’ve tried using sc.exe to create a windows service to execute “D:\etc\Cloudflared\Cloudflared.exe --config D:\etc\Cloudflared\config-be-fr.yml”
but, when starting the service, it never picks-up this configuration and always look into some folders (userprofiles, etc…) for a file named config.yml and nothing else.
Am I missing something ?
I’m just adding screenshot of process monitor, showing the daemon looking for the configuration in the user profile folder instead of the using the one given in the command line argument.
running each service using a different user account is an option, but definitely not ideal…
Thanks for the detailed description, this looks like a bug. It seems that we’re ignoring --config when run as a service. I filed and issue and we should take care of this soon.
Have you tried starting the Argo Tunnel service from the Windows Service Manager, after you install it? If you double click on the service in the Services program, there should be a field called start parameters, in which you should be able to put
--config <path-to-config> . This will allow you to specify a custom path to a config file. Here’s a screenshot of how the service manager should look:
Note that the service must be stopped in order to edit the start params. This solution was not in our docs- I’ll be updating those shortly.
thanks for the reply. This indeed works (the configuration is picked up), but unfortunately, this parameter is not persistent.
This means that you can’t even restart the service, or if the windows machine restarts, the service will fail at start-up, and you then need to manually open the service property again, set the config path, and start the service.
I’m afraid this won’t be an option in a production environment.
@btexier is correct. The field that @rishabh mentions is not a saved persistent configuration field. It is a one-time use entry field.
Hello! I just wanted to reiterate what @webmaster said: @btexier is correct.
Windows Service Manager’s configuration is not persistent across service restarts. (Configuration set by “sc.exe” is not persistent either.)
We’ve updated the docs to refer to the persistent source of truth for Windows services: the Windows registry.
Cloudflared service install creates a service under the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cloudflared. You can use regedit to change the ImagePath value there, and in this way you can supply any desired arguments to the service.
If you’d rather work at a higher level than regedit, there are some utility programs to help manage the Windows service’s state. For my personal use case, NSSM has worked well.
(P.S. On a related note: there used to be an issue with Cloudflared where it didn’t receive arguments correctly when invoked as a Windows service. This was fixed in Cloudflared 2018.10.5.)
Thank you @nvollmar for the reply as well as the documentation update.
This thread doesn’t actually answer the original question.
How to create multiple tunnels (cloudflared.exe) running with different configs.
The answer here it’s that you simply need to create a new Windows service basically copying the automatically installed one, pointing to a different config file.
Thanks for your quick reply. The question is how?
The cloudflared.exe has a command --install to install as a service but no way to install two services.
Have just been browsing the source code and the name of the service is fixed https://github.com/cloudflare/cloudflared/blob/master/cmd/cloudflared/windows_service.go.
I used the Windows SC.EXE command about 15 years ago - is that what I need to use?
Basically yes, create a service the normal Windows way, it’s terrible, but unfortunately you can’t just copy a
.service like you do on Linux…