-
Notifications
You must be signed in to change notification settings - Fork 71
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
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 serve
with "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-pushpin
fastly.toml
:What it does:
fastly compute serve
starts Pushpin before starting Viceroy, and detects its startup. It also sets up to shut it down when the CLI process ends.pushpin
must be started at this time, because routes are set based on the backends defined in thefastly.toml
manifest file.killProcess
.Pushpin routes are set up based on the
fastly.toml
manifest file.id=
condition. For example, a backend namedorigin
will 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_beg
configuration 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/user
to this backend ashttp://localhost:3000/realtime/api/user
.over_http
is set for every route target, as to always enable WebSocket-over-HTTP.ssl
is added.override_host
, then it will be set as thehost
value 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.pushpin
section of thefastly.toml
file, 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.pushpin
section of thefastly.toml
file, or--pushpin-publish-port=<port>
The
pushpin
binary is searched on the system path, but can be specified:pushpin_path=/path/to/pushpin
under thelocal_server.pushpin
section of thefastly.toml
file, 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-pushpin
flag, and does nothing if the new flag is not set.