Skip to content

Self-hosted Nextcloud on macOS using Docker with Colima, secured with Tailscale VPN and Caddy for automatic HTTPS. Access your private cloud from anywhere using MagicDNS, with Grafana and Prometheus for monitoring. A secure, remote-accessible alternative to Google Drive—fully under your control.

License

Notifications You must be signed in to change notification settings

100dollarguy/tailscale-nextcloud-docker

Repository files navigation

🗂️ Self-Hosted Nextcloud with Docker, Caddy, Prometheus, Grafana & Tailscale

This project lets me run a fully self-hosted, private cloud storage and monitoring stack on macOS using Colima, Docker Compose, with secure remote access through Tailscale’s MagicDNSHTTPS via Caddy, and real-time monitoring using Prometheus + Grafana. It’s secure, private, and entirely within my control.


🔧 Why I Built This

I wanted a private Google Drive alternative where I controlled my files completely. I also wanted to learn:

  • Docker containerization

  • VPN-based secure access using Tailscale

  • Configuring HTTPS with reverse proxies (Caddy)

  • Observability using Grafana and Prometheus


⚙️ Technologies Used

  • Nextcloud – cloud file syncing and collaboration

  • MariaDB – database backend

  • Redis – caching for Nextcloud performance

  • Caddy – reverse proxy with automatic HTTPS

  • Prometheus – metrics collection

  • Grafana – visual dashboards for system health

  • Tailscale – private VPN with MagicDNS

  • Colima – Docker on macOS with Linux networking


🧱 Architecture

architecture


🔐 Tailscale Access

tailscale


🧑‍💻 Account Creation Page

account


⭐ Recommended Nextcloud Apps

recommendation


📁 Nextcloud Dashboard

dashboard


📂 File Manager

filemanager


📊 Grafana login

Configure Grafana to monitor your container metrics and Nextcloud performance.

Grafana login

Grafana Dashboard

Grafana


🧪 Prometheus Metrics

Set up Prometheus to scrape Docker and system metrics for monitoring.

prometheus

prometheus


🧯 Troubleshooting: Blank Login Page on Nextcloud

When I first set up Nextcloud, the login page was completely blank. Here's what fixed it:

✅ Root Causes

  • Database not running or misconfigured

  • Incorrect config.php settings

  • File permission issues

  • Services not restarted after changes

  • Cached browser errors

🛠️ Fixes

  1. Checked MariaDB service

  2. Verified config/config.php database fields

  3. Ensured correct file permissions for web user

  4. Restarted containers

  5. Cleared browser cache and cookies

After doing all of the above, the login page loaded correctly.


🧯 Troubleshooting: Grafana Blank Page or Not Loading

When Grafana didn’t load its login/dashboard:

✅ Common Problems

  • Grafana not connected to its DB (SQLite or external)

  • Misconfigured grafana.ini (root URL or port)

  • Reverse proxy or firewall blocking access

🛠️ Fixes

  1. Checked docker logs and confirmed Grafana is running

  2. Verified grafana.ini config (port, URLs)

  3. Cleared browser cache

  4. Restarted Grafana container


🧯 Troubleshooting: Prometheus Not Scraping or Showing Metrics

Prometheus showed empty dashboards because it wasn’t scraping correctly.

✅ Common Problems

  • Misconfigured prometheus.yml

  • Scrape targets unreachable

  • Network or firewall blocking port 9090

🛠️ Fixes

  1. Checked Prometheus container logs

  2. Validated scrape target URLs in prometheus.yml

  3. Restarted Prometheus after edits

  4. Cleared cache in browser


📚 What I Learned

  • Docker Compose for multi-service orchestration

  • Linux-based networking with Colima

  • Reverse proxies and automatic TLS with Caddy

  • VPN routing and access control using Tailscale

  • Real-time monitoring using Prometheus and Grafana

  • Debugging blank pages, database issues, config problems


✅ Future Plans

  • Automated Nextcloud backups

  • Email configuration for password resets

  • Add Grafana alerts for system health

  • Enable 2FA in Nextcloud for better security

  • Explore external storage backends for Nextcloud


🏁 How to Run

  1. Clone the repo:
git clone https://github.com/100dollarguy/tailscale-nextcloud-docker.git

 cd tailscale-nextcloud-docker
  1. Start Colima (Docker for macOS):
colima start
  1. Start all containers:
docker compose up -d
  1. Access services:
- 📂 Nextcloud:  
    http://your-magicdns-name.ts.net
    
- 📊 Grafana:  
    http://your-magicdns-name.ts.net:3000
    
- 🔍 Prometheus:  
    http://your-magicdns-name.ts.net:9090

🔒 Important

This setup is intended for private use within a Tailscale VPN. Do not expose it publicly without adding extra security measures.


If you have any questions or want help extending or customizing this setup, feel free to open issues or reach out!


Happy self-hosting!

✨ License

License: MIT

This project is licensed under the MIT License. You're free to use, modify, and share it — personally or commercially.

Feel free to fork it, improve it for your own setup, or share with others!

About

Self-hosted Nextcloud on macOS using Docker with Colima, secured with Tailscale VPN and Caddy for automatic HTTPS. Access your private cloud from anywhere using MagicDNS, with Grafana and Prometheus for monitoring. A secure, remote-accessible alternative to Google Drive—fully under your control.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published