Consul: Difference between revisions
imported>Zie Added page about Consul and Consul-template |
→Consul: Use current channel for search.nixos.org link Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
== Consul == | |||
Consul by Hashicorp is a distributed key/value store along with other things. | Consul by Hashicorp is a distributed key/value store along with other things. | ||
| Line 7: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
But there are some [https://search.nixos.org/options? | But there are some [https://search.nixos.org/options?query=services.consul consul specific options] that might be useful. | ||
Setting up Consul in a production setting is beyond the scope of this wiki, see the consul documentation for particulars. | Setting up Consul in a production setting is beyond the scope of this wiki, see the consul documentation for particulars. | ||
One advice is that if you have systemd services depending on Consul via <code>After=consul.service</code>, you may want to switch consul service type no <code>notify</code>, to make sure that dependent services don't try to run until Consul is ready to accept connections: | |||
<syntaxhighlight lang="nix"> | |||
systemd.services.consul.serviceConfig.Type = "notify"; | |||
</syntaxhighlight> | |||
== Consul-template == | |||
currently consul-template is packaged, but does not have nixos options to configure it. Here is an haproxy example that might prove useful: | currently consul-template is packaged, but does not have nixos options to configure it. Here is an haproxy example that might prove useful: | ||
| Line 17: | Line 24: | ||
This turns on haproxy with essentially a blank config | This turns on haproxy with essentially a blank config | ||
then sets up a systemd unit to run haproxy-config, a consul-template service to generate the haproxy configuration from your template. | then sets up a systemd unit to run haproxy-config, a consul-template service to generate the haproxy configuration from your template. | ||
note, in the configuration below, you will need to change: /path/to/haproxy.consul to the path where your haproxy consul template resides. If you rename the file, be sure to fix the ExecReload line as well. | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 60: | Line 69: | ||
systemd.services.haproxy-config.enable = true; | systemd.services.haproxy-config.enable = true; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Applications]] | |||