Hi! This is not HASS-related, but since I’m just a hobbyist in server\website development, I don’t really know where else to go. And stack-overflow has a very agressive policy regarding off-topic questions. So I hope to get help from much more friendly HASS community. I’ll be happy with either redirection to some other proper and popular forum\question hub about such problems, or getting answer right here, if that’s allowed. So, with that said, here’s the question.
I’m thinking about setting up my flask based website\blog on my personal home-server machine. But I’m worried about downtime, and how search-engines will handle that, and how to inform people about this. This is my personal portfolio\cv\blog site, and I do need it to be properly indexed at all times.
Ideally, I think i’d need the following - if my home server machine is unreachable, then I need to present users with a “Site is temporary down, please come back in a few minutes” kind of page, with proper header codes and data for search robots to properly index my website as well. I know that there are header codes for that kind of thing. But how do I actually switch to this page, if i’m using my own server and it’s down?
How can this be achieved?
If that’s of any help, I’m using Reg.ru and yandex.ru as dns servers for my domains.
A service like Cloudflare between your server and the Internet that can handle it all automatically
An online service to monitor the accessibility and automatically update your DNS (you’ll need a short TTL, maybe 60) to somewhere that’s hosting your “Back shortly” page
Bite the bullet and stick it on a hosting platform somewhere
Option 3 is the last-resort option, because I can’t find any reasonably-priced flask hosting. In most cases it required switching to VPS or other linux server options, and setting everything up myself, which is a good thing, but only until you look at the price, most of those options have per-hour payments, on top of monthly payment. Which makes the price too much. Easier to stick it on a dedicated raspberry pi, or my much more powerful diy nas platform.
Option 1 looks most interesting. Is cloudflare acting as a dns provider, in this regard? I’m curious about this bit, because I do need to delegate my domain to yandex’s dns servers in order to use their email service, since I don’t want to handle email server, but I want a nice email with my domain.
What about a crazy idea of using something like an iframe?
Domain.com has just a single index with iframe to “data.domain.com”. And this single index page can have all the required headers. And if it can’t reach “data.domain.com”, it can redirect to “maintenance” page, hosted on domain.com.
Will this approach work? Or is it too bad?
I could use the cheapest available hosting option for this, since it only needs JS and a couple html pages… But then urls won’t work properly I guess? huh
Posted on reddit’s homelab, thanks for redirection.
If you care about downtime you should consider using a hosting service. If you don’t care - you’re OK hosting yourself! I don’t think there can be a balance between the two. You either decide to have your site up at 99% of the time and pay extra (linode, amazon and digital ocean offer $5/month VPSs) or you bite the bullet and live with some extra downtime.
Currently I use my local machine to host my ‘tech’ website, which is basically just a… well dashboard with links to all locally hosted services like plex, transmission, etc. So I don’t have to remember ports or mess with local DNS.
This ‘tech’ website with full domain name is also running through Cloudflare, so if my server is down everyone is presented with a proper… 502 error I believe it is, and not browser’s built-in error page.
As for my portfolio site, I went with renting a VPS, as it turned out it costs much less than I thought, and 1 2Ghz core and 512mb of ram is actually more than I even need for it. It’s local provider, reg.ru, and it costs even less than 5$ a month, something like 4-4.5.
But actually the main reason behind going for a vps was not just downtime, but security. If someone tries to hack into it, it will only hack into vps, and not into a PC that’s in my home, connected to my local network. They still do, but at least this local server is not exposed so much, and has far less traffic.