Enable Maintenance Mode during initial startup
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
It would be useful to be able to enable Maintenance Mode on a node prior to initial startup.
In our environment, we use configuration management to provision Consul and application services onto a new VM. Those services are all registering with Consul and performing health checks. However, we have a procedural requirement to perform additional testing on services prior to enabling them in production.
Our current method to accomplish this is to install Consul, send a maintenance mode API request and then proceed to install services. This has proven to be mostly successful, but we have had some instances of the config tool not successfully executing this step (due to timing or other non-Consul related issues).
It would be useful to have a config option, so that if the data-dir is empty (or some other indicator of a newly installed agent), to have maintenance mode enabled on the node for the new agent at initial startup. Subsequent restarts of the consul service would detect that the data-dir is not-empty, and not enable maintenance mode on the node.
As another workaround, we are also thinking about using the config management tool to create /var/lib/consul/checks/e5b8f5ee703685797dee971addc24b9f prior to launching the consul service, and then using 'consul maint -disable' once the manual testing has been completed. Since the filename is an md5sum of the CheckID, the filename and contents are consistent, so this effectively simulates what consul maint -enable would do prior to running the consul service.
Contributor guide
Assessment
This issue has not been assessed yet.