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?

Top comments (5)

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
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

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

Thanks. Much better than docker-compose restart always.

Collapse
 
bobbyiliev profile image
Bobby Iliev • Edited

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?