Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Cloudflare caching #58

Open
ethanresnick opened this issue Mar 3, 2015 · 10 comments
Open

Cloudflare caching #58

ethanresnick opened this issue Mar 3, 2015 · 10 comments

Comments

@ethanresnick
Copy link
Member

prompted by @thebyrd's comment about cloudflare caching:

  1. can we ping cloudflare when we redeploy to invalidate its cache?
  2. just more generally, can we control the cloudflare ttl? we need to think about this for the updating event on our homepage
@thebyrd
Copy link

thebyrd commented Mar 3, 2015

  1. Yes
  2. Yes, I've made it 4 days, but can change that for you. If you're only updating html for each event, probs ok to make it 1 day?

@ethanresnick
Copy link
Member Author

Cool.

Re 2. Sometimes we get our events into the system pretty last minute, like ~6 hours before (not ideal, but hey). Also, during Startup Week, where we can have one event right after another, we kinda need the page to update in near-real time. So, if we had to pick one time that would cover the SW case too, we'd probably want something really aggressive, like every 15 minutes. Is that an option on whatever free tier we're using? If not, that goes to the next point...

Re 1. How do we set that up?

@thebyrd
Copy link

thebyrd commented Mar 3, 2015

  1. There's an API I'll cook up a bash script for you
  2. You guys are on the bowery business plan, so you can do all of this. I'd rather keep the TTL long and then just purge every time you deploy. Since people don't use the website that frequently, you loose a lot of the benefits of the cache if everything expires every 6 hours.

@thebyrd
Copy link

thebyrd commented Mar 3, 2015

This repo is public and it involved an API secret, so I'll send it to you and Abhi in slack. Don't show it to anyone. It's a simple curl statement.

@ethanresnick
Copy link
Member Author

@thebyrd Thanks David!

Keeping the TTL long and then purging only when necessary makes sense. I think that means purging in two cases:

  1. On deploy, purge everything. That's something that Abhi can easily add to the githook. I made an issue for that.
  2. Every time the contents of http://api.tnyu.org/v1.0/up-next-publicly change. Since the site is already polling that url to get the next event, it can pretty easily keep track of whether the next upcoming event has changed, and then alert cloudflare. But, when it does that, it only needs to clear cloudflare's cache of the html file, not the css or js. Is there an easy way to do that?

Alternatively, will cloudflare just respect our headers? Because the ideal scenario would be to treat it just like any other cache, rather than having to special case it. That is, we could tell cloudflare to check our site every fifteen minutes, but we'll send the with an etag that only changes when we redeploy or the next event changes. So we'd just send cloudflare a 304 if their cache is still good. And we could do the same thing for the static files.

@ethanresnick
Copy link
Member Author

Fuck. Moving to Cloudflare broke all our subdomains again, so I had to temporarily switch the nameservers back to namecheap.

@thebyrd can you make sure cloudflare is reflecting all our other dns records properly (see below/in the namecheap control panel) before switching back

screen shot 2015-03-03 at 6 09 23 pm

@thebyrd
Copy link

thebyrd commented Mar 4, 2015

🔥 🔥

adding a subdomain in cloudflare is pretty straightforward. A slack message would have solved the problem in 5 minutes. Now the site is down, when you're ready to get the site back up, please slack me the subdomains and ips you'd like.

Next time you don't know how something works don't freak out in ignorance. Instead, communicate.

@abhiagar
Copy link

abhiagar commented Mar 4, 2015

Don't keep switching dns please! Breaks a lot of things during events @ethanresnick

On Tuesday, March 3, 2015, David Byrd [email protected] wrote:

[image: 🔥] [image: 🔥]

adding a subdomain in cloudflare is pretty straightforward. A slack
message would have solved the problem in 5 minutes. Now the site is down,
when you're ready to get the site back up, please slack me the subdomains
and ips you'd like.


Reply to this email directly or view it on GitHub
#58 (comment)
.

@thebyrd
Copy link

thebyrd commented Mar 4, 2015

I haven't touched it yet

@ethanresnick
Copy link
Member Author

@thebyrd You're right that I could have asked you first, and then only made the change on my own if you didn't respond right away. I just felt a sense of urgency because I got a message from the bd team telling me that they were sending out sponsorship prospectuses and companies couldn't get them to load, so I reacted in a bit of a panic. I do appreciate your help with this.

@AbhiAgarwal Sorry that this broke stuff during the event! I just wanted to get the things back online for bd asap.

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

No branches or pull requests

3 participants