Can I run Envoy on Windows under SCM?

Note

This feature is still in Experimental state.

You can start Envoy as Windows Service that is managed under Windows Service Control Manager. First, you need to create the service. Assuming you have a custom configuration in the current directory named envoy-custom.yaml. After you create the service you can start it.

From an administrator prompt run the following commands (note that you need replace C:EnvoyProxywith the path to the envoy.exe binary and the config file):

  1. > sc create EnvoyProxy binpath="C:\EnvoyProxy\envoy.exe --config-path C:\EnvoyProxy\envoy-demo.yaml" start=auto depend=Tcpip/Afd
  2. [SC] CreateService SUCCESS
  3. > sc start EnvoyProxy
  4. SERVICE_NAME: envoyproxy
  5. TYPE : 10 WIN32_OWN_PROCESS
  6. STATE : 2 START_PENDING
  7. (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
  8. WIN32_EXIT_CODE : 0 (0x0)
  9. SERVICE_EXIT_CODE : 0 (0x0)
  10. CHECKPOINT : 0x0
  11. WAIT_HINT : 0x7d0
  12. PID : 3924
  13. FLAGS :
  14. > sc query EnvoyProxy
  15. SERVICE_NAME: envoyproxy
  16. TYPE : 10 WIN32_OWN_PROCESS
  17. STATE : 4 RUNNING
  18. (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
  19. WIN32_EXIT_CODE : 0 (0x0)
  20. SERVICE_EXIT_CODE : 0 (0x0)
  21. CHECKPOINT : 0x0
  22. WAIT_HINT : 0x0
  23. ...

Use sc.exe to configure the service startup and error handling.

Tip

The output of sc query envoyproxy contains the exit code of Envoy Proxy. In case the arguments are invalid we set it to E_INVALIDARG. For more information Envoy is reporting startup failures with error messages on Windows Event Viewer.