Sep 14, 2024 3 min read

Dashy: The Ultimate Guide to Self-Hosting

Dashy: The Ultimate Guide to Self-Hosting
Table of Contents

Dashy is a highly customizable, open-source dashboard application designed for self-hosting. It allows users to centralize access to their self-hosted apps, services, and tools, all within a beautiful, responsive interface. Dashy is lightweight, easy to deploy, and gives you full control over your data, making it an excellent choice for developers and system administrators. This guide covers installing Dashy, reverse proxy setup with Nginx, logging and debugging, backups, updates, and leveraging its unique features.

Installing Dashy

📦 Docker/Docker Compose Setup

Docker Compose is the simplest and most flexible way to deploy Dashy. Below is an example docker-compose.yml file tailored for Dashy.


version: '3.8'

services:

dashy:

image: lissy93/dashy:latest

container_name: dashy

ports:

- "8080:80" # Map Dashy to port 8080 on your host

volumes:

- ./dashy_config:/app/public/conf # Persistent config storage

- ./dashy_data:/app/public # Optional: Store additional files

environment:

- NODE_ENV=production # Run Dashy in production mode

restart: unless-stopped

Save this file as docker-compose.yml and start Dashy using the following commands:


docker-compose up -d

## Verify that Dashy is running

docker ps

🚀 Manual Installation

For those who prefer a manual installation on a Linux server, follow these steps:

  1. Install Node.js and npm:

sudo apt update

sudo apt install -y nodejs npm

  1. Clone the Dashy repository:

git clone https://github.com/Lissy93/dashy.git

cd dashy

  1. Install dependencies and start the app:

npm install

npm run build

npm start

Access Dashy in your browser at http://<your-server-ip>:8080.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

To serve Dashy through a reverse proxy, create an Nginx server block configuration file:


server {

listen 80;

server_name yourdomain.com;

location / {

proxy_pass http://localhost:8080; # Point to Dashy's port

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

}

}

Save the file in /etc/nginx/sites-available/dashy and enable it:


sudo ln -s /etc/nginx/sites-available/dashy /etc/nginx/sites-enabled/

sudo nginx -t # Test the configuration

sudo systemctl reload nginx # Reload Nginx

🔒 SSL/TLS Setup

Secure Dashy with Let's Encrypt by installing Certbot and generating certificates:


sudo apt install certbot python3-certbot-nginx

sudo certbot --nginx -d yourdomain.com

Automate certificate renewal by adding this to your crontab (crontab -e):


0 3 * * * certbot renew --quiet

🛠️ Testing and Reloading Nginx

After making any changes to your Nginx configuration, always test and reload:


sudo nginx -t

sudo systemctl reload nginx

Logging and Debugging Dashy

🗃️ Enabling Debug Logs

To enable Dashy’s debug logging, edit the config.yml file located in your persistent volume (dashy_config):


appConfig:

logging: true

logLevel: debug

📄 Viewing Logs

If using Docker, view container logs with:


docker logs dashy

For manual installations, Dashy logs can be found in the logs directory of the project:


tail -f ./logs/server.log

🛠️ Troubleshooting Common Issues

  • Port conflicts: Ensure no other app is using Dashy's port (8080). Use sudo lsof -i -P -n | grep LISTEN to check.

  • Nginx misconfiguration: Test with sudo nginx -t and check /var/log/nginx/error.log.

📤 Exporting Logs

To forward logs to an ELK Stack, use this configuration in the Dashy Docker container:


environment:

- LOG_OUTPUT=stdout

- LOG_DRIVER=gelf

- LOG_OPTIONS={"gelf-address":"udp://<ELK_SERVER_IP>:12201"}

Backup and Restore

🗂️ File-Based Backups

Backup your Dashy configuration and data using the tar command:


tar -czvf dashy_backup_$(date +%F).tar.gz ./dashy_config ./dashy_data

To restore, extract the backup:


tar -xzvf dashy_backup_<date>.tar.gz -C /path/to/destination

📅 Automated Backup Scripts

Automate backups with a cron job. Add the following to crontab -e:


0 2 * * * tar -czvf /backups/dashy_backup_$(date +%F).tar.gz /path/to/dashy_config /path/to/dashy_data

Updating and Upgrading Dashy

⬆️ Updating Docker Images

Update to the latest Dashy version with:


docker-compose pull

docker-compose up -d

🛠️ Manual Updates

For manual installations, pull the latest changes from GitHub:


git pull origin main

npm install

npm run build

npm start

🔍 Checking for Updates

Visit Dashy’s GitHub repository (https://github.com/Lissy93/dashy) for release notes and updates.

Leveraging Dashy’s Unique Features

🔧 Enabling APIs

Enable Dashy’s API by adding this to your config.yml:


appConfig:

enableApi: true

Test the API with curl:


curl -X GET http://<your-domain-or-ip>/api/v1/status

🌟 Advanced Configurations

Add a custom background theme by modifying customStyles in config.yml:


appConfig:

customStyles:

backgroundImage: "url('https://example.com/background.jpg')"

Integrate third-party tools like Grafana by embedding links or iFrames in your dashboard widgets.

Wrapping Up

We’ve covered everything from installing Dashy to securing it with Nginx, logging, backing up, and leveraging its advanced features. Self-hosting Dashy gives you unparalleled flexibility and complete control over your dashboard. Start using the provided code examples, customize your setup, and make Dashy your go-to tool for managing your self-hosted ecosystem.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.