Hacker News new | past | comments | ask | show | jobs | submit login
Moving my website from Netlify to Caddy (alexwlchan.net)
29 points by twapi 3 months ago | hide | past | favorite | 20 comments



I really loves Caddy, it has replaced nginx in my go-to HTTP server. It's really simple and powerfull, one nice example is how simple you can deploy applications with zero downtine [1].

On testing HTTP requests, I'd suggest Hurl [2], (I'm one of the maintainer). You will trade Ruby unit tests for a tailored HTTP text file format but I think it can shine for this kind of migration. Tests will be run in parallel, really fast.

For instance, test_site_is_up.rb will be replaced by a simple text file:

  GET https://alexwlchan.net
  HTTP 200
  [Asserts]
  body contains "This website is a place to share stuff I find interesting or fun."
  
  
  GET https://alexwlchan.net/articles/
  HTTP 200
  [Asserts]
  body contains "Articles"
  
  # etc...
Testing alternate domains (test_alternate_domains.rb) could be:

  GET http://alexwlchan.net
  HTTP 308
  Location: https://alexwlchan.net/
  
  
  GET http://alexwlchan.net/contact/
  HTTP 301
  Location https://alexwlchan.net/
  
  # etc...

Give it a try!

[1]: https://www.lambrospetrou.com/articles/server-deploy-scripts...

[2]: https://hurl.dev


cloudflare pages github pages

/ basically any git provider provides pages like codeberg / framagit / disroot git

You don't need to pay literally anything.

You could point it to your own domain.

I have seen many professional people use github pages as their blog pages.

You can use ci / cd actions to basically just write markdown push it and it would convert to html and automatically reload github pages

Comments can be used via cactus and many many others I think https://rochacbruno.github.io/marmite/enabling-comments.html

I just installed caddy on my local linux archlinux system , I love golang but I had never bothered installing caddy locally , well it seems really cool , I have currently installed marmite as well locally .

My problem though to moving to caddy is why even pay 5$ when you can get it for free. I have installed it on my pc just for learning experiences :)


I don't get why anyone would use Netlify for a personal website or any website nowadays.

Unless I am missing something, there are places where you can host a website for as close to $0, even if you start to get over 100GB of traffic, wouldn't get a huge uncontrolled bill.


Inertia? I have a small project with basically zero visitors, doing basically zero traffic, being filled with a git commit via cron job every day, happily chugging along for a couple years. Why would I switch as long as it works?


Any tips on what you'd suggest as alternatives please?


Cloudflare, Render, etc.


https://news.ycombinator.com/item?id=42039972

Most websites don't require backend logic.


Caddy is great. But why didn't they just put any cdn in front of netlify (or caddy as well)? Not only would it reduce the traffic to the static site to essentially 0, it would serve requests nearly instantaneously from the edge.


Caddy and self-hosting's cool and all, but I think I'd miss push to git to deploy and just not having to manage 'stuff'. Although, I did move a site from netlify to cloudflare (free) and still have this facility.


If your content is static anyway, you can just rsync to deploy instead of push to deploy:

    rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --cvs-exclude --delete $(LOCAL_CONTENT) $(SSH_USER)@$(SSH_HOST):$(REMOTE_DIR)
Self-hosting then essentially just means doing apt install nginx once.


That would expose .git, unless other nginx config masked it. cvs-exclude is for cvs, right?


It was for cvs, because rsync is old, but nowadays also filters out .git, .svn, .hg etc.

In any case this is supposed to only sync the rendered content from $(LOCAL_CONTENT), not the templates used for rendering.


You think they'd change the name to vcs-exclude, then.


Backwards compatibility.


Can retain that and add a vcs-exclude, right?


You could setup a github action(if your repo is hosted on Github) or use something like gitea in your local environment to manage your repo and then you push changes to that gitea repo, it has an action runner like github's which does all the automating stuff for you.

It is only one time setup pain point, after that you are all set.


Yeah this, I too prefer hosting static websites via static storage or CDN, rather than having to operate anything.

CloudFlare Pages is great, and so is GitHub Pages for developer websites.


I also vouch for CF Pages! Killer features for $0.

EXCEPT redirects of .html to / (slash) that you can't control.


Going with Ruby for the test suite but not using RSpec and Capybara is an interesting choice. Why?


Netlify's pricing is pretty insane for bandwidth, yeah. They also are quite brutal when it comes to your site getting DOSed or some other form of traffic flood.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: