DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Best way to turn spare laptop to server? (And turn on 24/7)

I also already have a domain name.

I can also choose to run on DigitalOcean, but 5 USD Droplet sucks. (Perhaps unless I build Docker first on my laptop.)

Can I just get a static IP address, then attach A name to domain server? Or, is localhost tunneling a bad option? (I find https://localhost.run slow to load, but it does work.)

My server is not just static files, but full stack, BTW.

Lastly, how I do ensure laptop (Xubuntu, BTW), is always awake?

Discussion (8)

Collapse
bobbyiliev profile image
Bobby Iliev

I use a $5 DigitalOcean Droplet and it is handling 50k hits per month smoothly.

A good server configuration is key. You could also add a 1GB swap file for some extra buffer.

At home, I have a raspberry pi 4 with 4GB RAM and I use it as a web server + VPN and I run OwnCloud on there, rather than running your laptop 24/7. I've configured port forwarding on my router and it works very well for external access as well.

Collapse
citizen428 profile image
Michael Kohl

50k hits per month

That's slightly more than 1rpm, you should be able to run that on pretty much anything, no?

Collapse
bobbyiliev profile image
Bobby Iliev • Edited on

Of course :) that’s why it runs on a 1GB ram droplet 😄

Not 100% sure if I get your comment right. Would you personally run your small blog on a laptop at home rather than a small SSD server?

Thread Thread
citizen428 profile image
Michael Kohl

Sorry, it was a bit late here when I wrote this. No, I probably wouldn't run it on an old laptop though one certainly could because it's small enough to run on anything.

Collapse
patarapolw profile image
Pacharapol Withayasakpunt Author • Edited on

It appears that building Nuxt on cheap droplet is a bad idea. It crashes with not enough memory.

Build on my laptop >> Upload to Docker Hub >> Download to DigitalOcean fixes it.

I am also considering spawnable stateless Docker images; with attached volume; as an alternative, but this may complicate stuff... (I have never successfully run k8s, only Google Cloud Run.)

Collapse
bobbyiliev profile image
Bobby Iliev

Hi there 👋,

As you are running low on ram, maybe try adding a swap file for some extra buffer:

digitalocean.com/community/tutoria...

Hope that this helps!

Collapse
patarapolw profile image
Pacharapol Withayasakpunt Author

Thanks. Much better than docker-compose restart always.