Forem Creators and Builders 🌱

Discussion on: Can I use Fastly on Self-hosted Forem?

Collapse
 
ce7in profile image
Muhammed Cetin

Fitting the data on a 115 GB disk wasn't a problem, but publishing them fast enough is a big challenge. I don't know how to deal with this problem because I have not needed to do that before. I have been trying to find a solution for this performance issue for a few days, but I couldn't.

Anyway, when I try to access my Forem with Fastly, it redirects too many times to the same URL. Then, it says "Backend doesn't work.", but the backend already works.

Should I need to add VCL snippets manually or should I wait for it to be completed automatically thanks to API settings?

If there were a complete guide for Fastly and Forem settings, it would be so great for me.

Collapse
 
jamie profile image
Jamie Gaskins

publishing them fast enough is a big challenge

Understanding this kind of scale requires a lot of insight.

  • How fast is "fast enough"? What are your throughput requirements? What is your average/median/p90 latency?
  • How frequently are posts being published?
  • How certain are you that the database is the bottleneck? Could it be the application instead? Both?
  • How much compute capacity are you running on DigitalOcean for a service that size?
    • Are you running this all on a single DigitalOcean droplet or are you running several behind a load balancer?
    • What happens if you add more compute capacity (either larger droplets or more of them)?
  • How much of the CPU and RAM are the web processes using? Ditto for the Sidekiq workers? How many of each are you running?

when I try to access my Forem with Fastly, it redirects too many times to the same URL.

Is it Fastly doing this redirection? Can you provide the redirect chain? Please provide all of the details you can.

Then, it says "Backend doesn't work.", but the backend already works.

What backend are you pointing it at? Are you using a DNS name for it? Is that DNS name pointed at the right DO load balancer/droplet IP? Do you have TLS certificates setup for that DNS name? If you point your Fastly service at a different backend, does that work?

Please be very specific, this is the most likely place for this problem to be.

Should I need to add VCL snippets manually or should I wait for it to be completed automatically thanks to API settings?

It should be done automatically. You can check whether the snippets are in your VCL by clicking the "Service Configuration" tab on your Fastly service page and then clicking the "VCL Snippets" entry on the side nav. If they're not there, try running bin/rails fastly:update_configs manually on your Forem server and make sure it exits cleanly (status code 0).


Keep in mind, we can't see your configuration. In order for us to be able to help here, you'll need to be very detailed so we can understand what's going on. It sounds like there's some small detail being overlooked here, but we have no way of knowing what that is unless you tell us everything — not credentials, of course, but all the other details.

It currently looks like your domain name is resolving to a DigitalOcean IP address. I don't know if it was pointed at Fastly before and you changed it back, but I point it out because it further prevents us from being able to get insight into the problem, so we have to rely solely on what you tell us.

And when in doubt, make sure you're up to speed on the Forem Fastly docs.

Thread Thread
 
ce7in profile image
Muhammed Cetin • Edited

Edit: I have found how I can run the fastly:update-configs command. It can be run with foremctl rake because it was a rake command :)

I'm sorry about that. I'm a newbie at Rails ecosystem, and I can be confused sometimes because Rails isn't similar to PHP or Python.

Thread Thread
 
jamie profile image
Jamie Gaskins

No worries 😄 I'll update the docs to include using foremctl here. It is definitely not obvious that rake commands are now runnable by (and encouraged to be run by) the rails command.