-
Notifications
You must be signed in to change notification settings - Fork 70
feat: Add experimental "enable Pushpin" mode #1509
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
Conversation
c3b10ef to
e7d0a14
Compare
|
Reverting to draft, as I am going to add another feature. |
624e65c to
d09de5d
Compare
|
This is ready for review. |
d09de5d to
fe11084
Compare
anthony-gomez-fastly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
4a2b70a to
b0a0f73
Compare
|
I've added the following updates to the way this works: We write a routes file to disk to the OS temporary directory, and reference it from a fresh copy of the pushpin.conf file (which I've copied out from the Pushpin repo and made some modifications to), also written to the temporary directory. |
b0a0f73 to
7e58fcd
Compare
405c87b to
6cab8c0
Compare
|
@kpfleming thanks for the review! I've made fixes, please re-review =) |
b0d6946 to
2847f25
Compare
2847f25 to
aff91b3
Compare
This PR is a followup to #1509 that includes the following fixes: * Fix to Pushpin context that inadvertently left out the path to the routes file and the cleanup function when building the context * Adds an output message indicating when "Experimental Pushpin mode" is enable * Makes Pushpin-related logs slightly less noisy
This PR adds code to the CLI to enable
fastly compute servewith "enable Pushpin", a new mode that locates and runs Pushpin before starting Viceroy to run guest code.This is a companion PR to fastly/Viceroy#497, and will only function after that feature has landed.
How to enable it:
It can be invoked in one of two ways:
--experimental-enable-pushpinfastly.toml:What it does:
fastly compute servestarts Pushpin before starting Viceroy, and detects its startup. It also sets up to shut it down when the CLI process ends.pushpinmust be started at this time, because routes are set based on the backends defined in thefastly.tomlmanifest file.killProcess.Pushpin routes are set up based on the
fastly.tomlmanifest file.id=condition. For example, a backend namedoriginwill setid=origin. Viceroy handles Fanout handoff by forwarding a request for this backend to Pushpin and set the headerPushpin-Route: origin, allowing Pushpin to match the route.replace_begconfiguration on the route. For example, if a backend is configured forhttp://localhost:3000/realtime, then this is set asreplace_beg=realtime. Pushpin will forward a request for/api/userto this backend ashttp://localhost:3000/realtime/api/user.over_httpis set for every route target, as to always enable WebSocket-over-HTTP.sslis added.override_host, then it will be set as thehostvalue of the route target.When starting Viceroy,
--local-pushpin-proxy-port=<port>is appended as a command-line argument, which starts Viceroy in "enable Pushpin" mode.Pushpin proxy runs by default on port
7677, but this can be overridden:proxy_port=<port>underlocal_server.pushpinsection of thefastly.tomlfile, or--pushpin-proxy-port=<port>Pushpin's publishing endpoint runs by default on port
5561, but this can be overridden:publish_port=<port>underlocal_server.pushpinsection of thefastly.tomlfile, or--pushpin-publish-port=<port>The
pushpinbinary is searched on the system path, but can be specified:pushpin_path=/path/to/pushpinunder thelocal_server.pushpinsection of thefastly.tomlfile, or--pushpin-path=/path/to/pushpin.The CLI writes the config and routes to temporary files in the OS temporary directory. This is cleaned up as part of shutdown.
Pushpin runner places some runtime files into a temporary directory specified in pushpin.conf. We set this to an OS temporary directory, so that multiple instances can run if necessary. This is cleaned up as part of shutdown.
Pushpin runner places logs into a directory specified in pushpin.conf. This is placed in the ./pushpin-logs directory under the current project
All Submissions:
New Feature Submissions:
Changes to Core Features:
User Impact
Are there any considerations that need to be addressed for release?
The new feature is opt-in using the
--experimental-enable-pushpinflag, and does nothing if the new flag is not set.