15 ms·
Self-hosting a blog for cheap and lazy devs
- nopit 6y agoWhy isn't caddy in a container?
- yjftsjthsd-h 6y agoIt's a single binary file, so there's not a whole lot to be gained unless you're already doing containers in general. When the entire system is this few moving parts, I'm not sure that it's worth the trouble of containerizing it.
- meritt 6y agoThat makes no sense. You containerize both, or you containerize neither. I wager most people from both camps (for and against containers) would agree.
- chrisseaton 6y agoThis seems both more work and more expensive than GitHub Pages. Hardly the cheap or lazy option. And if the author is reading - your Author link is broken.
- thesandlord 6y agoYeah, creating a Docker container and setting up Caddy seems like a lot of work. Netlify, Firebase Hosting, GitHub pages, etc, all make it super easy to host a static blog for free, require zero maintenance, and are all backed by global CDNs. My blog setup uses Netlify to automatically build and deploy on a git push using the built in Hugo support. Now of course, there is the argument of what "self-hosting" is. Does it just mean you own your domain name and content? Or does it mean you are actually running the server? If its the latter, then sure this is a valid solution, but if all you care about is owning your domain and content I'd use one of the static hosting providers.
- mark212 6y agoagreed, seems like running your own server just for a blog is really overkill and has a lot of overhead for no reason
- andai 6y agoI heard Troy Hunt say about why he uses a blog service instead of hosting it himself, (roughly) "Do I want mess around with server configuration or do I want to write?"
- mark212 6y agoNot disagreeing, but the post is titled "Self-Hosting a Blog" which I would assume means that the blog author has already made the decision not to use GitHub or Netlify (for some reason, don't know why). The truly cheap would go with one of them and avoid the $2.50 monthly fee for a server.
- deleted 6y ago[deleted]
- giancarlostoro 6y agoI rather just install WordPress on a $5 a year shared hosting service, or as you said GitHub pages, so just convert WP to static files. I'm not big on WP but it just freaking works, and if it can generate decent static files, why not?
- andai 6y agoWP can generate static files? Is that built-in or a plugin? That's super cool.
- welterde 6y agoGithub pages still has no ipv6 support though. Either neocities, netlify or random web hosting company are better options than this imho. Granted one can also fix this problem by sticking a caching CDN with ipv6-support in front.
- chrisseaton 6y agoYes that's a problem... hopefully they'll fix it and then it's fixed for many sites. But this blog post doesn't set up IP version 6 either.
- mastermojo 6y ago+1 Github Pages if you are comfortable on the command line and with markdown I have some notes on how I played with it a couple years ago. https://www.growthalytics.com/programming/2015/07/19/setting-up-your-own-blog/ https://www.growthalytics.com/programming/2015/07/19/setting...
- staysaasy 6y agoWe host our blog using solely off-the-shelf tools, and I love the stack that we use. I highly recommend it if you're looking for a stack with 100% control and are ok with some light technical wrangling (eg using Git): - Jekyll for static site generation https://jekyllrb.com/ https://jekyllrb.com/ - We use the Hydeout Jekyll theme, you can see how it looks on our blog: http://staysaasy.com/ http://staysaasy.com/. What you see is out-of-the-box plus ~30 lines of custom CSS. - Git for storing our content - Gitlab for CI/CD and hosting - GoDaddy for domain management We manage all of the content in Git, and push it when it's ready. It's really easy. You can even run "code reviews" on posts if you like.
- MaxBarraclough 6y agoAll sounds good apart from GoDaddy. Why not use a more reputable registrar? https://news.ycombinator.com/item?id=4362478 https://news.ycombinator.com/item?id=4362478
- staysaasy 6y agoJust because it's what we already used. It's the most dispensable part of the stack (and arguably shouldn't even be considered part of our stack at all).
- MaxBarraclough 6y ago> arguably shouldn't even be considered part of our stack at all Why not? If your registrar screws you over, it's game over. It's a critical dependency.
- res0nat0r 6y agoFolks also seem to forget that an s3 bucket can host your static website, will cost mostly pennies and pretty much never go down. https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosti...
- 6y ago
- butz 6y agoNetlify has a free plan and you don't have to tinker with containers.
- joshmn 6y agoThere are a few things that genuinely please me in web development and one of them is how stupid-easy Netlify makes things.
- zo1 6y agoI've seen Netlify mentioned a few times now. Are there any downsides/negatives to using it?
- chrisdalke 6y agoI’ve wondered the same thing. It’s so ridiculously convenient that there has to a catch! I previously used the S3 + Cloudfront setup that many commenters have mentioned, but have switched to Netlify for static sites simply because I don’t have the overhead of setting up any configuration in AWS. With Netlify, you can be up and running with a new static site as soon as the DNS record propagates. I’ve always wondered if there was any throttling or performance impact at high traffic- but I haven’t built any high-traffic sites yet :)
- volkandkaya 6y agoOne catch is 100gb limit but for a personal site you will never hit that. Anyone recommending S3, github pages etc hasn't tried Netlify.
- badatcomputer 6y agoAnything that starts with "Install Docker" will not be cheap or easy
- lowwave 6y agoYup
- seph-reed 6y agoThis is exactly how far I got in before my "No fucking way" alarm went off. If you want to be truly cheap and lazy use github pages (free), static html (maybe with a markdown converter), and Disqus iframes for comments.
- codemonkey-zeta 6y agoDing ding ding, we have a winner! This is exactly the process I landed on this week when I decided to start a blog. There's literally nothing cheaper or more convenient (or resume-appropriate, since I already share my github) than github pages. Generating a static site is almost trivial (I landed on using Hugo, but a bunch of solutions are just as easy). To take the laziness a step further I use emacs and org-mode and publish with ox-hugo (https://ox-hugo.scripter.co/ https://ox-hugo.scripter.co/). Set up an org-capture for the blog template, and I'm only a few keystrokes away from creating and publishing a new post at any time.
- james-skemp 6y agoFair warning: keep up to date with your Hugo version locally, or use a set version in GitHub Pages. I'm using Gitlab Pages with latest version of Hugo pulled by default. I don't post as much as I did, and have twice had to spend over an hour getting a theme updated for the latest version of Hugo since I didn't update my version and there's been breaking changes. Outside of that, Hugo is fantastic. Good luck with your blog!
- skrtskrt 6y ago
- waffle_ss 6y agoThis doesn't cover IPv6 - you'll also need to create an AAAA record and (presumably, not familiar w/ Caddy) bind to an IPv6 address (e.g. ::1) in the reverse proxy config
- Ayesh 6y agoFurther, the Vultr's $2.5 VPS doesn't come with an IPv4 address, but a /64 IPv6.
- Insanity 6y agoI use github pages. Can't get more cheap or lazy than that I guess?
- SparkyMcUnicorn 6y agoGitLab pages is another great option. It has more generous limits than github pages.
- ferzul 6y agoyou missed the first word or two of the title?
- stevekemp 6y agoThe guide exposes the back-end webserver to the public, by accident. Instead of: ports: - "2368:2368" expose: - "2368" The author probably just needs: ports: - 127.0.0.1:2368:2368 That way "localhost:2368" will be routed to 2368 inside the container, such that caddy can access it, but not accessible externally, as it is right now: $ curl -v https://sphuff.com:2368 Though of course the ideal solution would be to run caddy as another container, and link them together.
- deleted 6y ago[deleted]
- dawnerd 6y agoI see this a lot with redis in docker compose as well. I've even done it by mistake. Also why the heck doesn't redis have auth by default. It's so ridiculously easy to get "hacked" and inadvertently run a crypto miner.
- WJW 6y agoCan you run a crypto miner as a lua script in Redis? That is actually kinda cool tbh. You'd notice pretty quickly since Redis won't respond anymore.
- dawnerd 6y agoLittle more complex than that. They issue a command that ends up downloading a bunch of shell scripts and goes from there. Does a lot of other nasty things too like trying to steal any ssh key on the machine to presumably use those machines to mine. Luckily running inside of docker prevents a lot of that by default. It is very noticeable though when you log into your dev server and the cpu is pegged at 100%. I copied some of what it did here: https://gist.github.com/dawnerd/50915749d05d865025b447d5941f3683 https://gist.github.com/dawnerd/50915749d05d865025b447d5941f...
- paxys 6y agoLocal storage on a VM instance should never be treated as a permanent data source.
- jpswade 6y agoI migrated away from Wordpress to github pages and Jekyll... https://wade.be/2016/01/30/welcome-to-jekyll.html https://wade.be/2016/01/30/welcome-to-jekyll.html Can’t get any easier, cheaper or lazier than that.
- andai 6y ago> Wordpress is bloated. It won’t even run on a basic free DigitalOcean instance. Woah, does it use an obscene amount of RAM or what? It's been a while since I used it. (Also, I think you meant the cheapest Droplet using the free $100 credit? I don't think there is a free tier. Would be nice tho :)
- ac29 6y agoNo, it doesn't. I run three sites on a $5 1GB VM and its rare to see over half the memory in use (aside from cache).
- lowlevel 6y agoLost me at step 1. There isn't an explanation as to why docker is a good idea... I feel it isn't, and I'm kind of too lazy to go figure if I'm wrong.
- randtrain34 6y agoOr make your blog static and use Netlify.
- julianeon 6y agoYeah, it seems like the 'hosted blog' has reached commodity status, going as low as $0/year if you make yours static. Doesn't seem to be much point in competing against $0, though the technical side is interesting.
- deleted 6y ago[deleted]
- decompiled_dev 6y agoHaving a static site and pushing to github pages is working pretty well for me.
- gourneau 6y agoAlso if y'all are looking for incredibly cheap servers https://www.serverhunter.com/ https://www.serverhunter.com/ has many listed that are less than $5 a year. Most of them are OpenVZ based, and very low performance but good for hobby projects. The other compromise is many don't have entire IPv4 addresses, just a few forwarded ports.
- dwheeler 6y agoThe key part about having your own personal blog site is owning your own domain. As long as you own the domain, you can change your mind. As long as you own your domain name, you can self-host today, host elsewhere, or whatever you want. If the domain name is owned by somebody else, then they own and control the site, not you.
- superkuh 6y agoThis brings up the related issue of the normal domain name system and it's governence. No one really owns their domains. They lease them at the whim of some corporate or government entity. But if you put up a tor onion service you actually own your domain name. I'm not saying only host on tor, but why not a .onion too?
- dwheeler 6y agoThat is an endless rabbit hole. In that case, no one owns land or any other kind of property either. Obviously a government entity could take any or all of it away from you if you are in their jurisdiction. And if you do not pay land taxes, you don't get to keep the land either. I mean ownership in the usual sense. There are laws and people who are supposed to enforce those laws so that once you purchase something and obey certain rules, you get to keep it. Perhaps more importantly, if a typical energy says they just want to take it from you, there are courts you can appeal to. If you post on Facebook, and Facebook takes it down, you have absolutely no right of appeal. If I post material on my personal site on a domain I own, it is harder to take down, and much easier to bring it back. I'm assuming here that the content is not illegal, that's a different issue.
- Alir3z4 6y agoGood stuff, but I never liked self hosting a blog when I can just pop it up on a hosted solution. I want to write and forget and not maintain. By the time that I setup a blog, I'd have lost my interest in writing. Probably, I'll just write about my pain about how did I deal with docker, exposing the port, nginx reverse, some vps provider and DNS stuff.
- thamer 6y agoI use Hugo (https://gohugo.io/ https://gohugo.io/) to generate static pages and host them on Amazon S3, with CloudFront on top of it for fast delivery. AWS also provides a free SSL certificate, and DNS with Route53. I couldn't be happier with the setup: it's cheap, fast, requires zero maintenance and pretty much never goes down. Cost is close to nil: the most expensive part is for Route53 at $0.50 per Hosted Zone, and then S3+CloudFront add a few cents more. If folks want to see how fast static pages can be on a CDN, the site is at https://re.kv.io https://re.kv.io P.S. I didn't have to install Docker or MySQL.
- waffle_ss 6y agoThe only problem with that setup is if a post goes viral CloudFront will cost you a pretty penny. I had one post with ~1MB of assets that was read (IIRC) 70k times in a month and got an ~$80 bill. I’ve since switched to Cloudflare.
- thamer 6y agoThe AWS Calculator[1] reports that 70 GB (70k times 1 MB) of transfer out of CloudFront costs ~$3 and another 70 GB to the origin costs about another $3 – this would only be the case if the 1 MB was dynamically generated. The free tier is 50 GB and 2 million requests per month, and beyond that it’s ~0.085/GB in the US so 70 GB would cost 70 * 0.085 = $5.95. You also need to count $0.01 per 10k HTTPS requests, or $0.07 for 70k. I'm not sure how you got this bill, none of these numbers are anywhere near $80. [1] https://calculator.s3.amazonaws.com/index.html https://calculator.s3.amazonaws.com/index.html
- waffle_ss 6y agoOK, I was off quite a bit and the total of all assets on the page is 27MB. That's mostly due to several HD pics on the page and one 2-second soundless looping MP4. The total CloudFront bill was $87.65, the bulk being $74.98 spent in North America (2.5M requests @ $2.52, 852.518 GB data transferred @ $72.46). Those prices are as of March 2019. Doing that math that's only 31.5K page loads in North America (my 70K view number is from Google Analytics worldwide and may have straddled months, or counted re-views, I dunno). Now, I remember running those pics through TinyJPG so they are as compressed as possible. And I could probably add some kind of JavaScript lazy loading library to only load images as users scroll down to them. Or, I could just use Cloudflare and not think about it. /shrug
- update 6y agoI coded[0] a very simple CMS for my blog around 8 years ago. I wanted something fast and I wanted to use python instead of PHP. so I went with nginx + uwsgi. The website[1] runs on an old laptop. 8 years later I've edited maybe a handful of lines of code. Perhaps I'm missing something, but I don't get why these articles pop up so frequently as if making a blog was some super complicated thing that required the latest CMS, etc. Most people here (including me) would suffice with a nginx and plain html/css, no CMS required, based on articles like these, at least. [0] https://github.com/sfttw/avanti https://github.com/sfttw/avanti [1] https://blog.sailingfasterthanthewind.com/ https://blog.sailingfasterthanthewind.com/
- herostratus101 6y agoThis seems more complicated and significantly more expensive than hosting a static site from S3 and using a Cloudfront distribution to enforce SSL.
- ro2nie 6y agoVuePress (which generates static pages) with netlify is completely free. I can push to a branch and automatically have it deploy new posts.
- 627467 6y agoNot directly related but: How readable are these mobile layouts for everybody else? https://postimg.cc/4HbvS38q https://postimg.cc/4HbvS38q https://postimg.cc/SjWGsZyd https://postimg.cc/SjWGsZyd
- hawski 6y agoIf you don't use SaaS blog platform and host it on a VPS it counts as self-hosting? In this case shared hosting will be even cheaper and maintenance free. System, server, Let's encrypt cert, database and language updates will be taken care of. Many of those PHP CMS-es or blogging systems have a one click updates in place. Some shared hosting providers can also take care of this for you. You can get something with ssh access and rsync so you can be lazy and edit HTML with Word and just sync it or an SSG if that strikes your fancy.