Seekier Posted July 22, 2020 Posted July 22, 2020 Hi, thank you for the good job on heliohost. Pls I would like the admin to help me set up an external cron job for my Ghost CMS website. The one I have is from https://cron-job.org/en/ and whenever I turned it on the red and blue bar on my account gragh climb between 90 to 100 in an hour which possible always leads to suspension. Server: TommyWebsite: fzmedia.cf For fear of being suspended, I have redirected my website to blogger pending when my request is met. Thanks in advance
Krydos Posted July 22, 2020 Posted July 22, 2020 An external cron that we set up is going to cause just as much load as an external cron from any other site. The way passenger works is this. Node applications take a lot of memory when they're running, but they only need to run when someone is actually looking at the website. The first time you request a node page it takes a second or two to load, and once the node app is running it responds quickly. After 5 minutes or so of no page hits passenger wisely unloads your node app from memory which helps keep your account and the whole server's load low. This is by design. The problem with ghost is it stupidly says 503 when it's loading instead of just taking a second longer to load like a normal node app and then showing the home page. People have asked ghost to change this behavior and they have stupidly refused. Obviously you've discovered that to avoid that 503 error you just keep ghost from unloading from memory by setting up a cron or site monitor to ping your website every once in a while. This is why you're getting suspended. Your ghost page is never unloading from memory. Your sitemonitor or cron or whatever is causing so much load that you're getting suspended. It doesn't matter if the page request comes from our servers or someone else's server. The solution to your high load is to just let passenger do it's thing and unload your ghost when it's not being viewed. The other option is of course you could also get a vps and then your ghost app could run constantly and you wouldn't even need a cron or sitemonitor to keep the 503's away. https://www.heliohost.org/vps/ Another option is you could edit the ghost code to not display the 503 error somehow.
Krydos Posted July 22, 2020 Posted July 22, 2020 (edited) The problem with ghost is it stupidly says 503 when it's loading instead of just taking a second longer to load like a normal node app and then showing the home page. People have asked ghost to change this behavior and they have stupidly refused. Obviously you've discovered that to avoid that 503 error you just keep ghost from unloading from memory by setting up a cron or site monitor to ping your website every once in a while.I just opened my ghost install in a browser https://krydos.heliohost.org/ghost/ and it took like 15 seconds, but it didn't show a 503. Maybe they changed the behavior in the newer version that I installed? EDIT: Nevermind, I guess it was a fluke. I killed the ghost process and tried loading it again and it gave the 503 this time. Edited April 3, 2021 by Krydos
Krydos Posted July 22, 2020 Posted July 22, 2020 (edited) I had another idea. You could make a loading page that would load instantly, and then check if ghost is running. Then if ghost is running redirect automatically. If ghost isn't running or gives a 503 error it just waits a second and tries again until ghost is functional, and then it redirects. Here's a quick example:<?php $url = "https://ghost.krydos.heliohost.org/"; $msg = "Loading ghost..."; if ($_GET['retry'] == "") { echo "$msg<meta http-equiv='refresh' content='0;url=?retry=yes' />"; exit; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_TIMEOUT, 10000); $f = curl_exec($ch); $h = curl_getinfo($ch); curl_close($ch); $status = $h['http_code']; if ($status == "200") { header("Location: $url"); exit; } else { echo "$msg<meta http-equiv='refresh' content='1;url=?retry=yes' />"; exit; } You can test it out at https://krydos.heliohost.org/ghost/ which redirects to ghost at ghost.krydos.heliohost.org Obviously if you're using this code on a production website you'd want to style it and make it a little prettier... haha. Also meta refreshes are kind of a dirty hack and are frowned upon and you shouldn't use them, but they still work. A better page refresh option would be javascript. Also this page the way it's written will just try again and again and again over and over forever, which could cause load problems if ghost wouldn't start and someone left this page open refreshing over and over all day. So it would be wise to implement a counter and after the page refreshes like 5 times, just give up and display an error message. Like I said, it's a quick example. Edited April 3, 2021 by Krydos
Seekier Posted July 22, 2020 Author Posted July 22, 2020 Thanks for the quick response. Obviously Ghost is as terrible as WordPress in terms of loads only it is not prune to hacking like WordPress.I will try the code above and set the number of try/refresh to 3, If unable to process request return back to it favorite 503 error. I would have love to try the JavaScript refresh option but I know nothing about java
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now