Traefik plugin which starts a machine when a request is received using wake-on-lan.
Based somewhat on go-wol
.
In this mode, the plugin will try to start the machine using the wake-on-lan service provided by the plugin.
For this to work, the plugin needs to be able to send a magic packet to the machine.
This means that the machine needs to be on the same network as the plugin.
In other words, when using docker the network mode needs to be host
.
Dynamic configuration example:
http:middlewares:traefik-wol:plugin:wol:healthCheck: http://192.168.0.10:8009 # REQUIRED The URL to use for the health checkmacAddress: 00:00:00:00:00:00 # REQUIRED The MAC address of the machine to startipAddress: 192.168.0.10 # REQUIRED The IP address of the machine to start
In order to not have to run the plugin in host
mode, you can use an external wake-on-lan service.
This service needs to be able to send a magic packet to the machine.
The plugin will then send a request to the service to start the machine.
A service that can be used for this is docker-wol_api
.
Dynamic configuration example:
http:middlewares:traefik-wol:plugin:wol:healthCheck: http://192.168.0.10:8009 # REQUIRED The URL to use for the health check#REQUIRED The URL to use for the start request# This is the URL of the "wake" servicestartUrl: http://192.168.0.11:8081/wol/00:00:00:00:00:00startMethod: POST # The method to use for the start requestnumRetries: 5 # The number of retriesrequestTimeout: 5 # The request timeout in seconds
The plugin can automatically stop the machine after a period of inactivity. This is done by sending a request to the machine to stop itself.
A service that can be used for this is sleep-on-lan
.
Dynamic configuration example:
http:middlewares:traefik-wol:plugin:wol:healthCheck: http://192.168.0.10:8009 # REQUIRED The URL to use for the health check# REQUIRED The URL to use for the start request# This is the URL of the "wake" servicestartUrl: http://192.168.0.11:8081/wol/00:00:00:00:00:00startMethod: POST # The method to use for the start requestnumRetries: 5 # The number of retriesrequestTimeout: 5 # The request timeout in secondsstopTimeout: 5 # The number of minutes to wait before stopping the serverstopUrl: http://192.168.0.10:8009/sleep # The URL to use for the stop request