[5.x] Add --header option to static warm command#11763
[5.x] Add --header option to static warm command#11763jasonvarga merged 2 commits intostatamic:5.xfrom
Conversation
c1cb8c2 to
32d9c3b
Compare
32d9c3b to
b4df7c8
Compare
…pt multiple values.
jasonvarga
left a comment
There was a problem hiding this comment.
Thank you for the PR.
The test was nice, thanks! But there was a false positive.
Since you can't pass an array from the CLI (but you can in the test), you need to use the option multiple times as you noted. But, you need to define it in the signature with an asterisk. Running the command from the CLI the way you had it only used the first one you passed in.
Also, since you need to use the option multiple times, and each time it's a singular header, I've changed the option from headers to header.
please static:warm --header="Foo: Bar" --header="Bar: Baz"
|
Always happy to help! Good to know that, thx for noticing and fixing it right away! The intricacies of artisan commands... |
|
Hey @ChristianPraiss sorry for misusing the thread but could you elaborate on your zero cache downtime solution? You can reach me in the Statamic Discord or on Bluesky. |
|
Hey @dominikfoeger, I don't have any of those networks, but I guess I can share this excerpt from our internal documentation here, that should clarify it a bit: SetupWe’re using the Basically that means all pages that are not dynamic will be fully rendered and stored on disk, where they will be served by nginx. All pages that nginx does not have statically will be forwarded to statamic to get a freshly rendered response. Because we are using Docker, a new image will also start out with an empty cache folder. Even if we stored that folder in a volume, it would still be cleared first before warming a new cache, leading to slower response times during cache warming. That’s why we are using separate folders for warming the cache and serving the cache. We keep the cache live between deploys by storing it in a docker volume that is being reused by newly deployed containers. This way we achieve a full zero-cache-downtime deployment by using that volume as the folder that nginx serves from. Deployment WorkflowDuring deployment we run the Once the cache warming is done, the staging-cache directory is copied to overwrite the live cache and will instantly be picked up by nginx. Folder Structure:
|
|
@ChristianPraiss that's smart, thank you very much for sharing! |
Add support for custom headers in
static:warmcommandThis PR introduces a new
--headersoption to thestatic:warmcommand, allowing users to specify custom HTTP headers for requests made during cache warming, e.g. for:Related docs here: statamic/docs#1674