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

Watch config file for token changes #3418

Merged
merged 5 commits into from Apr 8, 2024
Merged

Watch config file for token changes #3418

merged 5 commits into from Apr 8, 2024

Conversation

btoews
Copy link
Member

@btoews btoews commented Apr 1, 2024

Change Summary

What and Why:

The macaroons that flyctl gets have a short lifespan. Commands with RequireSession refresh macaroons that are about to expire before the command runs. Similarly, the agent checks every minute if macaroons need to be refreshed soon. This setup works great for commands that run quickly, but I've had some slower deploys fail because my macaroons expired partway through. I've also had issues with long running fly logs where the NATS client has to reconnect but no longer has a valid token. This PR fixes that.

How:

This PR adds an API for watching for changes to the config file. Both the agent and other commands load changes to auth tokens that are written to the config. The agent still checks periodically if tokens need to be updated, and writes those updates to the config. This way, a long running command will start using the new macaroons that were refreshed by the running agent.

I had to submit a PR to the NATS library to allow dynamically changing tokens to be used when reconnecting after an error. I'm hoping nats-io/nats.go#1599 will merge soon so I don't need to point flyctl at my fork.

Related to:


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team
  • n/a

@btoews
Copy link
Member Author

btoews commented Apr 2, 2024

I'm going to sit on this for another day or two to see if the nats PR merges.

@btoews btoews force-pushed the watch-config branch 5 times, most recently from d3846a9 to 0bef372 Compare April 8, 2024 15:10
@btoews btoews merged commit 8ba3af5 into master Apr 8, 2024
39 checks passed
@btoews btoews deleted the watch-config branch April 8, 2024 16:42
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.

None yet

2 participants