Deploying a Self-Hosted Dashboard in Docker

To deploy a self-hosted dashboard in Docker, you primarily use Docker Compose with a docker-compose.yml file to manage the application and its dependencies (like a database). The general steps involve installing Docker, creating a configuration file, and running a single command to start the services. 
 
Prerequisites
  • A server or local machine with Docker Engine and Docker Compose installed.
  • SSH access to your server (if deploying remotely).
  • A chosen self-hosted dashboard application (e.g., Uptime Kuma, Grafana, or Portainer). 
 
Step-by-Step Deployment (using Uptime Kuma as an example)
 
Uptime Kuma is a popular, easy-to-use monitoring dashboard. 
 
1. Prepare your environment
Create a dedicated directory for your dashboard’s files and navigate into it: 
 
bash
 

 mkdir uptime-kuma-dashboard

 cd uptime-kuma-dashboard

 
2. Create a docker-compose.yml file 
Create a file named docker-compose.yml within your new directory. This file defines the services, volumes (for data persistence), and ports. 
 
bash
 
 # Open the file in a text editor like nano or vim
  nano docker-compose.yml
Add the following configuration to the docker-compose.yml file: 
 
yaml
 
version: "3.1"
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1 # The official Docker image
    container_name: uptime-kuma
    volumes:
      # Mount a local directory to the container's data directory for persistence
      - ./kuma_data:/app/data
    ports:
      # Map port 3001 on your host to port 3001 in the container
      - 3001:3001
    restart: unless-stopped # Ensure the container restarts automatically
    security_opt:
      - no-new-privileges:true
Note: The ./kuma_data folder will be automatically created on your host machine to store application data. 
 
3. Deploy the dashboard 
From the directory containing your docker-compose.yml file, run the following command to start the application in detached mode (background): 
 
bash
 
docker compose up -d
Docker will pull the necessary image (if not already present) and start the container. You can verify the container is running by using the command docker ps. 
 
 
4. Access your dashboard
Open a web browser and navigate to http://<your-server-ip>:3001 or http://localhost:3001 if running locally. 
 
You will be prompted to create an admin account through an initial setup wizard. Once logged in, you can start adding services to monitor. 
 
Common Management Commands
  • Stop the dashboard: docker compose down
  • View status: docker compose ps
  • View logs: docker compose logs
  • Update the dashboard: Pull the new image version, stop the old container, and restart the service.
    bash
    docker compose pull
    docker compose down
    docker compose up -d

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *