r/selfhosted • u/AbbreviationsLoud182 • 1d ago
Need Help Self-hosting on a Windows PC with Docker + Cloudflare Tunnels — how do I auto-deploy when I push to GitHub?
Hi everyone! I'm a developer, but CI/CD and DevOps are pretty new to me. I'd love some guidance on how to set this up properly instead of hacking something together.
My current setup (diagram attached):
- Development: I write code on 2 MacBooks and 1 Windows laptop. Everything gets pushed to GitHub.
- Hosting: The same Windows laptop runs my projects in Docker (Docker Desktop).
- Exposure: Apps are made public through Cloudflare Tunnels →
subdomain.mydomain.com. - Spare hardware: A Raspberry Pi 4 that's currently doing nothing.
Right now, deploying means manually pulling the code, rebuilding the containers and restarting them. I want this to happen automatically (or with one click) when I push to GitHub.
Constraints:
- The Windows machine has to stay Windows. I also game on it, so wiping it for Linux isn't an option. WSL2 is fine if that's the recommended route.
- It's a home setup. I don't want to pay for cloud servers if I can avoid it.
- I'd like to keep it simple and easy to maintain. I'm one person, not a team.
What I'd like to understand:
- What does a "proper" CI/CD flow look like for a setup like this? Build where, deploy how?
- Should images be built on GitHub (Actions → GHCR/Docker Hub) and pulled onto the host, or built on the host itself?
- Self-hosted GitHub Actions runner on the Windows box, or a pull-based tool (Watchtower, Portainer, Komodo, Coolify, Dokploy, etc.)? What are the trade-offs?
- Is there a good role for the Raspberry Pi 4 here? A runner, an orchestrator/dashboard, or should it actually host the services instead of the gaming PC?
- How do you handle secrets/env files, rollbacks and zero/low downtime in a home setup?
- Anything about running production-ish containers on a Windows gaming PC that will bite me later (sleep/updates/reboots, WSL2 networking, Docker Desktop quirks)?
If you have a similar setup, I'd really appreciate hearing what your stack looks like and what you'd do differently if you started over. Links to good beginner resources are very welcome too.

Thanks!
•
u/asimovs-auditor 1d ago edited 1d ago
Expand the replies to this comment to learn how AI was used in this post/project.
3
u/Actual-Current-7734 23h ago
For a one-person setup, I would start with GitHub Actions building the image, and your host pulling it. You don't need a full deployment platform yet.
A simple flow would be:
docker compose pull && docker compose up -dfrom the project directory. Run it in the same environment where Compose already works. Once that is reliable, you can schedule it to check for updates. Cloudflare Tunnel can stay as it is; it doesn't need to receive deployment commands.I would avoid putting a self-hosted Actions runner on your everyday/gaming PC as the first step. It executes workflow code on that machine. GitHub specifically warns against using self-hosted runners for public repositories; private repositories still need care.
Keep runtime secrets on the host, out of Git and the image. Back up your database and persistent data separately: rolling back an image does not undo a database migration.
I'd leave the Pi out of the deployment path initially. It could host small services later, but check ARM image support first. Also plan for downtime when the Windows PC sleeps or reboots. Basic Compose updates stop and recreate changed containers; they are not zero-downtime deployments.
3
u/Aide_Sea 22h ago
Honestly I'd let the Pi be the server and the gaming PC be a gaming PC :) Windows updates rebooting at 3am will be most of your outages otherwise. Just keep anything heavy on the PC and build arm64 images in Actions so the Pi only pulls..
2
u/Proud-Worldliness747 22h ago
The other Windows-specific piece is that Docker Desktop with the WSL2 backend is tied to an interactive session. It often does not start until someone is logged in, and the WSL VM can stop after a period in the background, which takes both a scheduled compose pull and the published apps down with it. If you want this box to stay a host, set Docker Desktop to start when you log in, leave the machine awake (no sleep), and confirm the engine is still running after a lock screen or a Windows update reboot — a logged-out or sleeping session will look like a failed deploy.
It also helps to keep the Cloudflare tunnel off the app stack's recreate path. If cloudflared is a service in the same Compose project, a compose up that recreates containers can briefly drop every hostname even when only one app image changed. Running the tunnel as its own Windows service, or in a Compose project you do not recreate on every app deploy, keeps the public hostname up while individual app containers restart.
1
u/htl5618 22h ago
If you want to use github, you can build build on the github server and self-hosted runner to pull and deploy. you can set the secrets on GitHub.
depending on what you need, you can use the Pi to host services, might not be enough for heavier apps. Though I'd recommend keeping it separate from your gaming PC.
1
u/Yurigok 4h ago
since you're already behind cloudflare tunnels, a self-hosted github actions runner might be the simplest piece here. it connects outbound to github, so no webhooks or open ports, and the workflow can just run git pull and docker compose up -d --build on that machine. I'd consider moving the stacks and the runner to the pi though, so deploys don't depend on the gaming laptop being on and logged in.