cross-posted from: https://packmates.org/users/Wander/statuses/111280488886937575
The future of selfhosted services is going to be... Android?
Wait, what?
Think about it. At some point everyone has had an old phone lying around. They are designed to be constantly connected, constantly on... and even have a battery and potentially still a SIM card to survive power outages.
We just need to make it easy to create APK packaged servers that can avoid battery-optimization kills and automatically configure an outbound tunnel like ngrok, zerotrust, etc...
The goal: hosting services like #nextcloud, #syncthing, #mastodon!? should be as easy as installing an APK and leaving an old phone connected to a spare charger / outlet.
It would be tempting to have an optimized ROM, but if self-hosting is meant to become more commonplace, installing an APK should be all that's needed. #Android can do SSH, VPN and other tunnels without the need for root, so there should be no problem in using tunnels to publicly expose a phone/server in a secure manner.
In regards to the suitability of home-grade broadband, I believe that it should not be a huge problem at least in Europe where home connections are most often unmetered: "At the end of June 2021, 70.2% of EU homes were passed by either FTTP or cable DOCSIS
3.1 networks, i.e. those technologies currently capable of supporting gigabit speeds."Source: https://digital-strategy.ec.europa.eu/en/library/broadband-coverage-europe-2021
PS. syncthing actually already has an APK and is easy to use. Although I had to sort out some battery optimization stuff, it's a good example of what should become much more commonplace.
Saw this post on !selfhosted@lemmy.world, want to get some thoughts on it, because the idea seems a bit crazy to me.
Geez, what's with all the Debbie Downers here?
Let me clarify some misconceptions ITT:
#"Android is not designed for this":
Whilst this is technically true, Android is still ultimately Linux at heart, which still allows you to do a lot of cool things - yes, that includes running servers. You could install Termux and run headless versions of pretty much every kind of server, or even run a full-blown Linux distro in proot mode if you need more flexibility. And if you've got a recent-ish Pixel, you could even use pKVM to run a distro at near baremetal speeds and greater flexibility compared to proot. But even without a Linux distro, you can just run a plain old server app and beat Android's OOM killer by using Tasker (or similar) as a watchdog/keepalive service. You can even simulate input using Tasker, which will prevent the phone from going into an idle state and killing your app.
However, the best option would be rooting your device - once rooted, you can directly tweak the kernel's OOM parameters to prevent your app from being killed, as well as change your CPU governor to "performance", plus enable/increase your zram swap and stuff - all of which allow you to reliably run a server with good performance, and little risk of being killed off.
There's a reason why there are already servers apps on the Play Store (which can make optional use of root access), because Android is more than capable of running servers - and there's no need for Termux/Tasker and all that fancy Linux stuff - but you can go down that rabbit hole if you wanted to.
#"Proxmox on an old x86 box is better":
Sure, but it's also completely overkill if all you want is say an FTP/NextCloud server or something. NextCloud has a minimum requirement of only 128MB RAM per process, and an overall recommend of 2GB + 2 CPU cores. Now compare this with my 5-year old OnePlus 6 with 8GB RAM and 8 CPU cores - this is more than enough to run NextCloud, with an external HDD/SSD attached via a USB-C dock. This setup will use far, far less power compared to a full-fledged PC, not to mention, make zero noise, and use a fraction of the space. I mean, if you've got a spare old PC lying around and you don't care about power consumption, then go right ahead, but for people who do care, using an old Android phone can certainly be a viable option.
#"Security nightmare":
True, but that's assuming you're using the stock OS. Use a trusted and up-to-date custom ROM like LineageOS or GrapheneOS and you'll be fine.
#"Unlockable bootloaders":
So don't buy/use a phone with a locked bootloader then? In all my history of Android phones dating back to 2009, I've never owned a phone with a bootloader which wasn't unlockable (whether officially or not), and this was a conscious buying decision on my part. Don't like locked bootloaders, then don't buy one, as simple as that! But even if you haven't had the same foresight as me, it's not really a big problem is it? Just sell your old locked device and buy an unlockable one from eBay or Swappa, they're pretty cheap too, so there's really no excuse here.
#"Zero repairability":
Untrue, assuming you're using an (ex) mainstream device, plenty of spares can be found on sites like iFixit and eBay for even very old phones. Heck, you could even buy an entire used/cosmetic fault phone on eBay and just swap out the parts you need. The main roadblock with repairing phones is usually the display, but if your phone is just going to be plugged in and sitting around, then that's not really a concern is it? Besides that, swapping out the mobo isn't an impossible task if you know how to follow instructions on iFixit.
#"Zero upgradability/storage runs short":
As mentioned earlier, just use an external HDD and you're all good to go. Why would you even consider using the onboard phone storage?! As for upgrading the rest of the system, well just swap out your old phone with your current one when you're gonna upgrade, problem solved!
Now come, fight me, naysayers! (ง •̀_•́)ง
you got the reparability totally wrong. if the motherboard fries, you have to replace basically the whole device. In a desktop you just replace the motherboard and keep the CPU, GPU and RAM.
you can obviously plug an external HDD, but can you upgrade RAM? can you upgrade to a better CPU or replace your current CPU without replacing half of the phone components? No, you can't.
and yes, Android uses the Linux kernel. But very few manufacturers release the kernel's code. No upstream kernel support makes it quite hard to keep updating after the manufacturer stops, even for custom ROMs that have to keep using the kernel as a blob, which eventually becomes inviable.
And if you're already limiting yourself to devices supported by LineageOS, you're discarding 90% of all phones, which let's be honest, if the primary reason to use a flawed OS to self-host was to recycle hardware, you're discarding most phones anyway so not a great reason.
And? A replacement motherboard, or an entire phone, for an old Android phone is pretty cheap. Now how much would a replacement CPU/GPU/RAM cost for a PC? And how likely would a phone's motherboard fail in the first place? In my experience, modularity increases failure chances, which is why you typically see more part failures on PCs. I still have my HTC Desire from 2010 (as a keepsake) and it still boots up and works. Not that I use it for anything or course, but this is really a non-issue. When people complain about "repairability" of a phone, they're typically talking about the display or battery, which isn't a concern in our use case here.
But why would you want to, when it already meets your needs? And when you're going to upgrade your main phone anyway? (it can replace your server phone).
That is incorrect, because not releasing the code is a serious violation of the GPL. Typically rando Chinese manufacturers get away with this, but most mainstream OEMs do release the kernel sources.
The kind of people who would even think of running a project like this (like running their own NextCloud etc) are usually the kind of people who'd most likely own a phone which is/can be supported by LineageOS. And once again, you can always sell your unsupported phone on eBay or something and get a supported one instead. The OnePlus 6 for instance goes for as low as $100, or even lower if you can find a faulty one like with a cracked screen or bad ESN or something, and it's good enough for most home server needs.
Power efficiency is pretty much the main reason preventing me from doing anything of the sorts.
I mean, I've got a pihole running on a first-gen Pi, and even that is overkill hardware for what it needs to do