As one of my ever ballooning side projects I decided to make a Solar Powered Raspberry Pi to drive my Twitter archive (note this is not the solar powered one, the solar powered one is mostly down). Thought there was something slightly poetic about the idea of hosting a website on a finite/un predictable power supply somewhat like Twitter itself under its new management.

These are the components for the project
- Raspberry Pi Zero W
- Lithium Ion Polymer 3.7v 350mAH battery
- Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger
- 6V 2W Solar Panel – ETFE – Voltaic P126
- 3d printed case via my recently purchases AnkerMake M5C 3D Printer
- WS2812B LED
- Some tape, solder, tears and hope
After a couple of failed attempts at soldering (I am so so bad at this) and a fried Raspberry Pi (electronics dont’ have an undo button). I managed to get the various connections working. At the time of writing I can charge a battery from the Solar power but not quite keep the PI running for more than a few hours. I’ll likely upgrade the battery to something that’s a little more chonky than 350mAH which according to ChatGPT1 would probably only power the Pi for 1.85 hours which is not ideal. Further it doesn’t seem to be able to power the Pi and charge the battery at the same time so again not quite what we want, but this is all fun and games so proof of concept is all I wanted right now.
I found this excellent post about how someone set up something similar to what I wanted and tl;dr it involves setting up Docker on top of Raspberry Pi OS Lite.
#Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ${USER}
groups ${USER}
#Docker compose
sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip
sudo pip3 install docker-compose
#Enable
sudo systemctl enable docker
#Run
sudo docker run hello-world
#Compose
touch docker-compose.yaml
docker compose -f docker-compose.yaml up -d
docker compose up -d
And this is the yaml file
version: "3.3"
services:
web:
image: joseluisq/static-web-server:latest
container_name: web
env_file: ./.settings.env
ports:
- 8080:80
volumes:
- ./web:/public:ro
restart: unless-stopped
command: -g info
watchtower:
image: containrrr/watchtower:latest
container_name: watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
cloudflared:
image: cloudflare/cloudflared:latest
container_name: cloudflared
restart: unless-stopped
network_mode: host
command: tunnel --no-autoupdate run --token ${CF_WEB_TOKEN}
depends_on:
- web
So far so good. Once the static web server was setup I could just pull down my static files of my twitter archive, pop them in the server root (e.g. /public) as defined in `.settings.env`. We were now live on http://10.0.0.0:8080/ (or whatever your local IP is)
But then the magic, via the cloudflared container we are able to set up a Cloudflare tunnel to the device’s IP and connected to a domain on Cloudflare. Pop in ${CF_WEB_TOKEN} to your docker-compose.yaml file and we are away. A fully working server on a Pi Zero. Amazing.
As I said, this is not properly working as a Solar powered Pi, but it’s a relatively mobile web server and that’s pretty awesome.
- Your milage and hallucinations may vary ↩︎














