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! (ง •̀_•́)ง