The Pocket Data Center: Running an Edge Node on a OnePlus 6
There is a graveyard of old flagship smartphones sitting in desk drawers around the world. I looked at my retired OnePlus 6—equipped with a Snapdragon 845, 8GB of RAM, and a built-in battery—and realized it vastly outpaced a standard Raspberry Pi 4. It already had a built-in UPS (Uninterruptible Power Supply) via its battery. The only thing holding it back was the heavy, consumer-focused Android OS.
I decided to wipe it clean, drop a mainline Linux kernel on it, and turn it into a high-efficiency edge compute node for my infrastructure.
The OS & Docker Payload
Running server workloads on Android via apps like Termux is a fun novelty, but it relies on a translation layer that kills performance and severely limits container orchestration. I needed bare metal.
I unlocked the bootloader and flashed PostmarketOS. Because PostmarketOS is based on Alpine Linux, it has an incredibly small footprint. Navigating OpenRC instead of systemd took a brief adjustment, but the result was a lightning-fast, headless Linux environment utilizing a fraction of the device's overhead.
Once the Docker daemon was up and running on the ARM64 architecture, I deployed a full stack of self-hosted, containerized infrastructure:
- Home Automation: Centralized routing for my local IoT devices.
- Gitea & Coolify: My personal CI/CD pipeline and code repository, allowing me to push code directly to the phone for edge deployment.
- The FragranceX Aggregator: A custom orchestration layer built in Node.js and Express that aggressively processes the Walmart API, transforms the payload, and dynamically feeds inventory data into the FragranceX API.
Overcoming Hardware Friction
Turning a smartphone into a 24/7 server introduces major hardware threats. I had to engineer solutions for thermal dynamics, storage degradation, and power management.
Challenge 1: The "Spicy Pillow" Effect
Leaving a lithium-ion battery plugged in continuously will inevitably cause it to swell and fail. I wrote a Node.js cron script that interacted with the kernel via /sys/class/power_supply/. I set strict charge limits, forcing the phone to stop charging at 60% and only resume when it dropped below 40%. This bypassed thermal throttling entirely and extended the battery's lifespan indefinitely.
Challenge 2: eMMC Death by IOPS
Databases and CI/CD tools require constant read/write operations. Smartphone internal storage (eMMC) will quickly burn out under database-level write amplification. My solution was to use a Type-C OTG adapter to mount an external SSD. I moved /var/lib/docker completely off the internal drive. The eMMC was reserved strictly for booting Alpine, while all heavy I/O operations were offloaded to the SSD.
Challenge 3: UPS Redundancy & Alerting
Because the device runs on a battery, it naturally acts as its own UPS during a power outage. However, I needed to know if the wall power failed before the server died. I expanded my battery monitoring script to watch the discharging state. If the device was running on battery and the capacity dropped below 15%, the system automatically triggered a webhook and an SMS alert to notify me of a critical power failure before gracefully shutting down the Docker containers.
The Cellular Uplink: Canadian SIM & Telephony Hacks
A true edge server is capable of out-of-band communication. I inserted a standard Canadian SIM card to leverage the Qualcomm cellular modem. Using ModemManager and oFono on PostmarketOS, I exposed the modem's messaging capabilities to the OS, turning the device into an automated SMS gateway for receiving Two-Factor Authentication (OTP) codes and sending out my power failure alerts.
The Audio Routing Hack: Making actual phone calls presented a fascinating challenge. On mainline Linux kernels for mobile devices, routing the modem's digital voice data (PCM) directly to the internal earpiece often fails due to missing proprietary DSP blobs. I bypassed the internal digital routing entirely.
By using the phone's built-in 3.5mm aux/headphone jack, I tapped into the modem's analog audio path. I connected a standard TRRS wired headset, forced the ALSA framework to route the voice stream directly to the 3.5mm port, and successfully made and received live cellular calls directly through the Linux system.
Zero Trust Exposure
To access the APIs and dashboards from the outside world without poking holes in my local firewall, I configured Cloudflare Zero Trust Tunnels (cloudflared). This securely routed traffic directly to the phone via port 443, providing immediate SSL termination, DDoS protection, and identity-based access control without any complicated port forwarding.
The Efficiency Metric: FinOps & Power Consumption
Engineering isn't just about making things work; it's about making them highly efficient. A standard older 1U rack server or traditional homelab setup pulls roughly 120 Watts at an idle/light load. My Alpine-powered OnePlus 6 edge node accomplishes the same API orchestration and container hosting while sipping an average of just 4 Watts.
Check the live calculation below to see the yearly FinOps impact of this edge architecture based on local electricity rates.
Note on hardware lifespan: The setup has been running 24/7. Monitoring metrics via Prometheus show zero thermal throttling events and 0% battery degradation due to the automated 60% charge limiter.