this post was submitted on 11 Oct 2023
62 points (98.4% liked)

Selfhosted

37775 readers
299 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
62
Cost-cutting tips? (discuss.tchncs.de)
submitted 8 months ago* (last edited 8 months ago) by [email protected] to c/selfhosted
 

What are your favourite, or least favourite but necessary, cost-cutting methods?

I feel I am spending too many resources on unnecessary stuff.

Edit: I feel the need to reduce both – the resources, to host multiple things on one system, and cost, to buy/pay for multiple systems. Currently, I have 2 ARM VPSes and 1 old MacBook Air as a home server.

all 41 comments
sorted by: hot top controversial new old
[–] [email protected] 82 points 8 months ago (1 children)

Fasting allows you to waste less money on food and invest more money into your server.

[–] [email protected] 6 points 8 months ago

When I was younger, I'd save my lunch money for weeks to buy a game and fast during school. I'd do my best to fill my stomach with as much water as I could.

[–] [email protected] 37 points 8 months ago (1 children)

Cost-cutting is corporate-greed mindset, therefore you have to solve it with the same mindset.

Fire people ! Even you if needed. And let the end-users deal with the outcome.

(This is not a serious post ^^ )

[–] filister 17 points 8 months ago (1 children)

Fire your wife and kids and then you would have plenty of time and (hopefully) money to concentrate on your hobbies and the things that make you happy. /s

[–] [email protected] 9 points 8 months ago (1 children)

Not viable strategy, firing the wife incurs a 50% net worth severance package.

[–] EuroNutellaMan 4 points 8 months ago

Physically set yourself on fire so you don't have to lose 50% of everything

[–] [email protected] 22 points 8 months ago (3 children)

My favorite cost cutting tip is to avoid big webapps running on docker, and instead do with small UNIX utilities (cron instead of a calendar, text files instead of note taking app, rsync instead of a filehosting dropbox-like app, simple static webserver for file sharing, etc). This allows me to run my server on a simple Raspberry Pi, with less than 500mb of used RAM in average, and mininal energy consumption. So, total cost of the setup:

  • Raspberry Pi : 77€ x 2 = 144€ (I bought two to have a backup if the first one fails)
  • MicroSD 64gb : 13€ x 2 = 26€ (main and backup)
  • average energy consumption : 0.41€ (2kWh) per month

With that, I run all services I need on a single machine, and I have a backup plan for recovery of both hardware and software.

Getting used to a UNIX shell and to UNIX philosophy can take some time, but it's very rewarding in making everything more simple (thus more efficient).

[–] [email protected] 10 points 8 months ago (1 children)

cron instead of a calendar

What do you mean by that?

Do you use crontab to save events?

[–] [email protected] 13 points 8 months ago* (last edited 8 months ago) (2 children)

Basically, yes. You can configure most cron programs to mail task output to you (it's usually done by setting the MAILTO variable in the crontab, provided sendmail is available on your system).

I use that to do things like:

0 9 11 10 * echo 'lunch with John Doe at 12:20'

It sends me a mail, and I can see the upcoming events with crontab -l. If it's not a recurring event, I then delete the rule.

[–] [email protected] 6 points 8 months ago (1 children)

And to expand further on simplicity, one can avoid using email and send messages over ntfy with just a POST curl call.

I like your setup!

[–] MigratingtoLemmy 2 points 8 months ago

This is excellent. Thank you

[–] [email protected] 4 points 8 months ago

Damn, I'm doing *nixes for nearly 30 years. But never went to that level of minimalism. Nice trick.

[–] [email protected] 4 points 8 months ago (1 children)

Getting used to a UNIX shell and to UNIX philosophy can take some time, but it's very rewarding in making everything more simple (thus more efficient).

Yeah, and that's the problem for me. See my comment above. Nextcloud and those services are "bloated", yes, but very convenient. I never worked in an IT-environment, so I'm a total noob.

But stuff like NC AIO give me a whole pre-set-up LAMP stack without needing to know how everything works, and that's unbelievable for me.

[–] [email protected] 4 points 8 months ago

Honestly I've worked in technical fields (either support or engineering) for most of my life and sometimes I don't feel like reinventing the wheel. Sure I could combine rsync and crontab and sync files around that way on a regular basis, add lighthttpd for web browser access to the folder, and I do sometimes, but I'd also like to do things OTHER than more work. I know how to do those things, but I don't want to do those things.

Ask yourself what part of this is your hobby. Is it building the thing and making it do as much as possible with as little as possible? Is it getting a self hosted cloud that's polished like Google's? Is it something else like photography or music and this is just the way you want to share or archive that? Those are all three different scenarios and is make different suggestions for each.

[–] MigratingtoLemmy 1 points 8 months ago

The usage for curl is quite interesting. Personally, perhaps I'd like a simple GUI where I can select the date and time and the message for the reminder.

I use nfs or samba for filesharing, but a webserver works well too.

What is your opinion on OCI container orchestration tools? Specifically Podman. I am of the opinion that containerisation is a most excellent idea because it uses hardware to the fullest extent without polluting the base system. Also the "use like cattle" philosophy. For example: I would be much more comfortable having the GUI for cron in a container.

[–] [email protected] 13 points 8 months ago (1 children)
  • Use sqlite instead of Postgres, MariaDB
  • Avoid enterprise software (Kubernetes, Elastic Search)
  • Only use projects with efficient programming languages such as Go, Rust, etc.
  • Try to run things bare metal
  • Lookout for projects which name themself minimal or light-weight

I use a Raspberry Pi 2 to self host a Dashboard written in Rust (Axum), a RSS reader called yarr and a music streaming server Navidrome. The latter two are written in Go and very resource efficient. The electricity bill should be under a Euro a month (6.4W max power consumption).

[–] [email protected] 1 points 8 months ago

While I don't agree with your first point from my experience, the second one is very true. Especially for memory consumption, your typical Java app easily occupies five times as much as something more bare metal.

[–] [email protected] 10 points 8 months ago (1 children)

You only need to eat two meals a day, really.

[–] [email protected] 1 points 8 months ago

OMAD (one meal a day) and intermittent fasting is even healthier

[–] [email protected] 9 points 8 months ago* (last edited 8 months ago) (3 children)

My least favourite (and only) method for me to cut costs is reduce my energy consumption.

I already have a super cheap setup (used Mini-PC for 50 bucks, old SSDs I had lying around, etc.), so reducing the hardware costs more isn't possible.


But, without tweaks, this setup would eat 15W (idle) and 25W (under load) electricity. At least, thats the case atm.

I just started selfhosting to be fair, and I didn't have time to throttle the server. I use it mainly as NAS, so speed isn't as important in this case as for other services like webapps, where reactivity is needed.

The CPU isn't too bad, so, even when reducing the performance to 50%, it should still work.


Also, I will try to change the active cooling fan to a passive heat sink, that might reduce the bill further.


What mainly eats resources like crazy is my Nextcloud AIO. I try to follow the UNIX-principle as good as I can, and NC doesn't follow it well, at least for my use case.

I only need a file server, and NC is pretty "bloated" with talk, calender, and so on. So I disabled all of that.

But, I'm not capable enough to set up an Online-FTP-Server and secure it enough without ever working in that environment. NC AIO provides a lot of comfort and "just works". So, I'm fine with that.


Here in Germany, especially thanks to the energy crisis, electricity is absurdly expensive, and even reducing the TDP by a few % will save me much money over a year.

So, I try to reduce the load and increase efficiency wherever I can.

Still, even now, with an increased energy consumption + paid domain, it's still cheaper than using OneDrive or something like that, even when ignoring storage size.

[–] [email protected] 1 points 8 months ago

sftpgo is a nice project to host files in a secure way without too much hassle.

[–] [email protected] 0 points 8 months ago

Fortunately, energy cost is not a big deal for me. My state (Punjab, India) provides 300 units per month for free. In the past year, I had to pay for only 6–7 months of electricity. I do host Nextcloud in a docker, but I keep most plugins disabled to save resources. One of my main resource hog is LanguageTool. It is using about 800 MB RAM and 8 GB storage.

[–] lemming741 0 points 8 months ago

NextCloud is total bloat. HomeAssitant is trying it's damnedest to achieve that level of bloat, but I don't think they'll ever catch NC.

[–] [email protected] 9 points 8 months ago (2 children)

Running stuff on my bare metal servers is my go to cost saving measure. Why rent 2 VPSes if you can buy some old thin clients and turn them into linux servers, etc.

[–] [email protected] 3 points 8 months ago (1 children)

Two reasons, basically. First, I am behind CGNAT. Second, electricity in my area is somewhat cumbersome, I need some services to be always online.

[–] [email protected] 11 points 8 months ago (2 children)

These days you can use various services to expose your devices from behind cgnat:

[–] [email protected] 2 points 8 months ago (1 children)

They rely on TLS-termination. I self-host for privacy, so I need TLS-passthrough. Cloudflare wants me to buy their enterprise plans for that.

[–] [email protected] 1 points 8 months ago

If you want TLS passthrough, then the most cost effective option is to keep one of your arm vps and run haproxy there. You can connect the vps and your home network using tailscale, zerotier, or plain old autossh tunnel.

[–] thelittleblackbird 2 points 8 months ago* (last edited 8 months ago)

Something that is usually forgotten is that cgnats are only there for ipv4. Running your server in ipv6 is almost a safe bet to have good connectivity.

And you know, these days getting a real ipv4 is more expensive than running in ipv6

[–] [email protected] 1 points 8 months ago

Yeah this is probably my biggest.

Device which things can be hosted on a local server and which are best on a vps

[–] Curly722 8 points 8 months ago (2 children)

I see the question has been understood in two ways: cost in computer resources and money. Which one did you mean?

[–] [email protected] 7 points 8 months ago* (last edited 8 months ago) (1 children)

That's the same thing. :) If you reduce computing load, you reduce the need for costly hardware and you reduce the need for energy, thus you reduce the amount of money needed to build and run your setup. There's a saying in (software) engineering : "reducing energy consumption and increasing performances requires the same optimizations". Make your code faster (by itself, not by buffing up hardware) and it consumes less energy. Make your application simpler, and it will run faster, and it will consume less energy. It's not an absolute truth (it sometimes happen that you make your code faster and it consumes more energy), but it's true most of the time.

[–] Curly722 1 points 8 months ago

I guess that's true and I didn't think of it that way. I took it as buying one device over the other to run multiple vms in one machine vs running them in multiple single machines. I'm in that head space now as I'm playing that optimization game myself.

[–] [email protected] 1 points 8 months ago
[–] [email protected] 6 points 8 months ago

Make a spreadsheet of where your money is going.

https://paul.totterman.name/posts/free-clouds/

Or then you can just realize that the time you spend is spent not making money and you need to save time, not services.

[–] [email protected] 5 points 8 months ago* (last edited 8 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
CGNAT Carrier-Grade NAT
LAMP Linux-Apache-MySQL-PHP stack for webhosting
NAS Network-Attached Storage
NAT Network Address Translation
PSU Power Supply Unit
SSD Solid State Drive mass storage
SSL Secure Sockets Layer, for transparent encryption
TLS Transport Layer Security, supersedes SSL
VPS Virtual Private Server (opposed to shared hosting)

7 acronyms in this thread; the most compressed thread commented on today has 9 acronyms.

[Thread #208 for this sub, first seen 11th Oct 2023, 08:45] [FAQ] [Full list] [Contact] [Source code]

[–] [email protected] 5 points 8 months ago

Im quite new in selfhosting, but I highly recommend power meter for home server if you dont have one. Its easy to tell the difference after any change in your setup. I was surprised with numbers when I was testing different PSUs on DIY PC. All PSUs were overkill (550-750W) for my tiny server (they are not made for that low power), but some cheap models were better than more expensive PSU. I was meassuring from 22-28 W iirc on idle. Its only 6W difference, but thats like 25%. I dont use VPS because I have no need for that and even cheap ones are more expensive than running my home server. Some servers can run at <10W and raspberry pi use even less power

[–] SheeEttin 3 points 8 months ago (1 children)
[–] [email protected] 3 points 8 months ago
[–] [email protected] 3 points 8 months ago

It is a little dangerous to do in case you experience a crash or a power failure, but you can get a lot more bang for the buck from your server hardware if you have a decent amount of memory by tuning your different system components to keep more data in memory and write to disk less often. This can be done with sysctl.conf and dirty writes, or with php or MySQL using more working memory and not writing to disk as often.

It was particularly required when I was still using a spinning drive, since random io was a show stopper. Even using a decent sata SSD it can be beneficial however, letting the system choose to write at more opportune moments instead of doing it in the middle of read ops.