Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstart: Agents should gracefully leave cluster on stop #146

Merged
merged 2 commits into from
Jul 1, 2015

Conversation

jsok
Copy link
Contributor

@jsok jsok commented Jun 30, 2015

Similar to PR #87 but for upstart.

Tested with Ubuntu 14.04:

Jun 30 12:30:49 ip-10-0-3-159 puppet-user[19088]: (Class[Consul::Run_service]) Scheduling refresh of Service[consul]
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: agent.rpc: Accepted client: 127.0.0.1:32928
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: agent.rpc: Accepted client: 127.0.0.1:32929
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: agent.rpc: Graceful leave triggered
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: consul: client starting leave
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: serf: EventMemberLeave: ip-10-0-3-159 10.0.3.159
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: agent: requesting shutdown
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: consul: shutting down client
Jun 30 12:30:49 ip-10-0-3-159 consul[18056]: agent: shutdown complete
Jun 30 12:30:49 ip-10-0-3-159 puppet-user[19088]: (/Stage[main]/Consul::Run_service/Service[consul]) Triggered 'refresh' from 1 events
Jun 30 12:30:49 ip-10-0-3-159 consul[19801]: serf: EventMemberJoin: ip-10-0-3-159 10.0.3.159
Jun 30 12:30:49 ip-10-0-3-159 consul[19801]: agent: failed to sync remote state: No known Consul servers
Jun 30 12:30:49 ip-10-0-3-159 consul[19801]: agent: Joining cluster...
Jun 30 12:30:49 ip-10-0-3-159 consul[19801]: agent: (LAN) joining: [consul.staging.local]

pre-stop script
# Only leave the cluster if running as an agent
if (sudo -u $USER -g $GROUP $CONSUL info 2>/dev/null | grep -q 'server = false' 2>/dev/null); then
exec sudo -u $USER -g $GROUP $CONSUL leave
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everyone has sudo installed. Can we just run this as root?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep makes sense, will update.

solarkennedy added a commit that referenced this pull request Jul 1, 2015
upstart: Agents should gracefully leave cluster on stop
@solarkennedy solarkennedy merged commit d4e8345 into voxpupuli:master Jul 1, 2015
@solarkennedy
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants