Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

systemd reload not working #250

@mr-miles

Description

@mr-miles

Describe the bug
The "reload" operation set up for systemd by run_consul does not work
https://github.com/hashicorp/terraform-aws-consul/blob/master/modules/run-consul/run-consul#L376

As set up, the reload operation called here cannot succeed unless it has access to the full set of environment variables including a valid acl token. If any items are missing there will be an error.

Log file entries

Running systemctl restart consul.service fails with the following entries:

Jun 27 19:35:42 ip-10-142-24-123 systemd[1]: Reloading "HashiCorp Consul - A service mesh solution".
Jun 27 19:35:47 ip-10-142-24-123 consul[2511144]: Error reloading: Put "http://127.0.0.1:8500/v1/agent/reload": dial tcp 127.0.0.1:8500: connect: connection refused
Jun 27 19:35:47 ip-10-142-24-123 systemd[1]: consul.service: Control process exited, code=exited, status=1/FAILURE
Jun 27 19:35:47 ip-10-142-24-123 systemd[1]: Reload failed for "HashiCorp Consul - A service mesh solution".

Suggested fix
Systemd can send a signal to the process which causes it to reload
The unit config looks like this (with escaping so it pastes directly into run-consul L376)

ExecReload=/bin/kill -HUP \$MAINPID

First question was - has this been considered already? It works fine for me but maybe there was a reason for using the consul binary directly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions