7 ms·
I just recently started hosting my personal website in my closet on a laptop: https://notryan.com https://notryan.com. I also host a Discourse forum. It's pret
by ryanmjacobs 6y ago
I just recently started hosting my personal website in my closet on a laptop: https://notryan.com https://notryan.com.
I also host a Discourse forum. It's pretty snappy for being in my closet (https://forum.webfpga.com https://forum.webfpga.com) Beats paying DigitalOcean $15/month ($180/year!) for a machine with 2vCPU + 2 GB RAM (the minimum for Discourse).
I think more people should consider self-hosting, especially if it's not critical. It makes the Internet more diverse for sure.
- afterwalk 6y agoThe static ip is free?
- ryanmjacobs 6y agoI've searched far and wide haha; the cheapest I can find them is $3.50/month from Vultr. I'm almost ready to switch to DDNS though. The threat of DDOS scares me a little bit. We have 300 mbps down though, so I don't forsee it being a terrible problem. I guess I would just call my ISP if something sketchy was going on. I'd like to imagine that my content is not DDOS-worthy though :)
- Riverheart 6y agoIs the server doing the hosting isolated from your regular network?
- ryanmjacobs 6y agoYup :) I'm running 5 KVM virtual machines, all behind a KVM NAT interface. They're not necessarily all on one laptop haha, but still on-premise. I can do live migrations between the hardware boxes with KVM without restarting the machines. Pretty cool stuff. Then they connect to a public-facing VPS that shuttles traffic to and from. I've tested out different ratelimiting strategies too. KVM's ratelimitter is surprisingly accurate. Probably gonna stick with a 10 mbps uplink and downlink pipe. Seems consistent and reliable, and still a fraction of my 300 mbps up / 30 mbps down home internet. Doubt my ISP cares about my uploading. Literally if a couple people hop on Zoom, they would be using more internet bandwidth than my servers do.
- znpy 6y agoMy ISP gives a public and static IPv4 if you ask for it. Yes it's free. Also, with IPv6 you have plenty of IPs...
- ryanmjacobs 6y agoOh damn, I never even thought about asking for a static IP. I should really just ask nicely...
- lstamour 6y agoIn my case I have a dynamic IP but I use a Linux box as a router and set up Google DNS record sets for my domains and after every reconnect to Internet (or PPP connection in this case), a shell script checks to see if the IP address changed by comparing with a text file, and if it has, it updates the IP address using the gcloud CLI utility. The DNS timeout is set relatively low, 5 minutes. I used Google Cloud DNS because it’s scalable, cheap (the setup costs under $2/month for low traffic) and has a great API and command line tool. Just took a half day of tinkering to get it all set up and most days I forget it’s there. (I should probably set up monitoring, but it’s fine most days...) If using CloudFlare, it’s possible you could push your dynamic IP to CF as a DNS host. Haven’t looked into it yet. And of course there’s the DynDNS approach but most of those approaches seemed more complicated or costly these days. I also use gcloud to update the DNS for LetsEncrypt roughly once a month, so it does double duty. The language for the gcloud DNS CLI tool is a bit technical but try it, test it out, and it’ll start to make more sense by example: https://cloud.google.com/sdk/gcloud/reference/dns https://cloud.google.com/sdk/gcloud/reference/dns For a bit more security, the apps I’m running are in their own virtual machines and I’ve tried to enable default auto updates everywhere. I keep telling myself I’ll set up something more complicated to create a continuous deployment pipeline with test cases and automatic rollback but I haven’t yet gotten around to it. (Though it would be fun to set up my own virtual PPP server at some point for running test scenarios, etc.)
- xrisk 6y agothere’s ddclient which can handle dynamic DNS updates. also has cloudflare integration.
- ajayyy 6y agoMy ISP gives a "dynamic" IP, but it only changes if the router is shut off.
- serf 6y agodo you get the same IP once the lease is up? I once had an ISP with a 3600 hour lease on a dynamic IP. For small things like game servers or short-term file hosting it may as well have been static, but the bi-annual IP change was usually pretty jarring.
- ajayyy 6y agoI haven't had an IP change in the last year since I last restarted the router. There might be a lease time, but it is long. I also have DDNS setup
- aembleton 6y agoJust use Cloudflare for your name severs. Then you can have a script that runs every 5 minutes on a cron to update your dns A records via the Cloudflare API
- jventura 6y agoJust to let you know that the link to server.c (at least in the blog index) is not working.. Cool project by the way! I'm thinking doing the same with a Rpy..
- ryanmjacobs 6y agoShould be up! There are moments of brief, brief downtime when I switch binary versions. Guess you refreshed in the 5 second window when I was recompiling. I run Ctrl+c then up-arrow in tmux. Next step is to write a general supervisor the listens for SIGHUP :) (Of course, as many people will tell me, this already exists. But sometimes, it's okay to do things for the sake of learning... come on, HN)
- jventura 6y agoIt's working now! But check the content-type for https://blog.notryan.com/ https://blog.notryan.com/. It's returning text/plain, and I see the html src in firefox instead of the rendered web page..
- ryanmjacobs 6y agoOh shoot, agh! I was messing around with rendering different content-types based on mobile/desktop -- to prevent text-wrapping on mobile phones. The index.html case slipped through my mind. I need to write some solid tests.
- giantrobot 6y agoJust serve html and use the viewport meta tag with width=device-width. Don't serve mobile devices plain text as they'll render at whatever their default viewport width is set to, 980px for Safari on iOS, which makes the text super annoying to read. Desktop browsers ignore the viewport tag and mobile browsers respect it. The page is rendered how you want everywhere for little effort.
- sneak 6y agoI agree with it from an architectural standpoint, but it violates the TOS of most residential ISPs in the US and endangers your internet connection if it starts seeing any significant traffic. ISPs there are usually monopolies or duopolies so you run the risk of having to buy slower/pricier service, or being totally offline, if one shuts you off.
- dillonmckay 6y agoEndangers internet connection? The guy has less than 1Mbps upload bandwidth.
- dakna 6y agoI'd think that most ISP's terms and conditions don't specify the amount of bandwidth used for hosting public websites. They just don't allow server use in general, so it's a grey area and it could be enforced if needed.
- _wldu 6y agoThe ISPs happily allow brute-force bots to smash away at anything that provides remote access (SSH, RDP, VNC). Why would a web server be considered different?
- blaser-waffle 6y agoBecause they can nail you on a TOS violation.
- shodan666 6y agoOracle Cloud does offer two free virtual machines(guaranteed to be free forver!) in their cloud (plus guaranteed free 30GB Oracle database). https://www.oracle.com/cloud/free https://www.oracle.com/cloud/free
- speedgoose 6y agoScaleway or OVH (kimsufi) offer 2vCPU and 2GB of ram for around 3€ to 4€ per month.
- ClumsyPilot 6y agoI have never used them specifically, but usually its shared compute - you are not getting an entire cpu core for yourself. In my benchmarks I have found that a laptop with 4th gen i5 beats a $80/month Azure VM. You are paying thoufh the nose for redundancy and stuff
- speedgoose 6y agoWith a 80$/month vm on Azure, you may get some CPU cycles but dont expect a lot of storage IOs. Azure is particularly shitty and slow if you don't spend a lot. In my experience a 3€ Scaleway vm is better than much more expensive Azure or AWS vms. You don't get as many cloud features though. Scaleway and OVH also have cheap bare metal offers if you don't like to share.
- ViViDboarder 6y agoYep. I host on Scaleway for services I want accessible from the internet. Can’t really beat the price. Also, despite living in the US, I like that my server is in in Paris. It’s EU and sounds super posh. Ha
- celicaraptor 6y agoHave a look at Hetzner also.I also used Scaleway since i a am french but i found better performance on Hetzner(i use the CPX11 for 4.19E)
- ViViDboarder 6y agoWill do. I’ve heard that they also have less expensive HDD options. Scaleway disk storage is all SSD and not cheap.
- hundchenkatze 6y agoIt's great to see someone self-hosting, and I noticed your note about seeing a blue header if running ipfs. I'm running ipfs with the companion extension. However, I can't resolve your dnslink. ipfs resolve -r /ipns/notryan.com > Error: context deadline exceeded I tried the ipns multihash too: ipfs resolve -r /ipns/QmZaQZyPXjyXWB2FZUUXV9Ft5qciCDMX6CPP2FmiuPSyAq > Error: context deadline exceeded You may not be forwarding your swarm address port, 4001 by default, to your laptop. I'm pretty new to ipfs so take this with a grain of salt. edit: It's worth noting that I can access other ipfs content using my gateway :) edit2: I also noticed you're hardcoding the local gateway port to 8080 for your header background image. This port is configurable, mine is set to 5080.
- ryanmjacobs 6y agoAh, yeah I don't have IPNS running right now. Also my website is not up to date on IPFS right now... maybe I'll resync it today. Anyways, this is a shortcut to it https://notryan.com/ipfs https://notryan.com/ipfs. IPNS was annoyingly slow (30+ second resolves) due to how it functioned in the past. So I stopped using it. I think they changed this in 0.5.0 so it might be better now. The blue banner was just a hack where the referenced jpeg loads if available. It's a call to url("http://127.0.0.1:8080/ipfs/QmX63Pan72CB2vMhNiFMKxKgEhmffbkgEnaEuagyEtmK8L"); http://127.0.0.1:8080/ipfs/QmX63Pan72CB2vMhNiFMKxKgEhmffbkgE... which is a Monet painting I like. Basically, if you've got IPFS you'll see a bar. If not, you'll see nothing. Did that at least work? If you had `ipfs daemon` running in the background on port 8080, you should've seen something.
- hundchenkatze 6y agoWhoops, I ninja'd an edit right as you commented. I'm running my gateway on 5080 so it didn't load, but I can access the image after updating the url.
- ryanmjacobs 6y agoHmm yeah I see. I wonder if there would be a way to programmatically detect it. Even still, I'm not running any JS on my website because I like to keep it snappy. Also how many people do you think are not running on port 8080? It's annoying for sure as a dev, when every program decides it wants its local web server to be 8080.
- geek_at 6y agoHaha that's how I started my business 15 years ago. I was still in school and I got a few old ThinkPads with broken displays so I installed debian on them, put them in my shelf and sold webhosting. Good times. I did a writeup 5 years ago how it looked like: https://blog.haschek.at/2015-my-company-just-turned-10.html https://blog.haschek.at/2015-my-company-just-turned-10.html (down at "Our Hardware")
- nathan-io 6y agoI'm running Discourse on a $5/mo droplet, 1 vcPU 1GB RAM. I just added 4GB of swap space. No issues so far.