sstent 4f163ec27b Dynamic registry and image name in workflow
This update modifies the GitHub Actions workflow to dynamically determine the container registry and image name based on the server environment. It also ensures that the image name is in lowercase and updates the login and build steps accordingly.
2025-11-19 17:57:39 -08:00
2025-09-20 10:58:44 -07:00
2025-09-20 09:52:24 -07:00
2025-11-17 06:26:38 -08:00

MiniHass - Smart Home Controller

Configuration Storage in Consul

The application now uses Consul for centralized configuration management. All settings and TV credentials are stored in Consul's key-value store.

Key Path Structure

  • App configuration: MiniHass/config
  • TV credentials: MiniHass/tv_credentials/<tv_ip>

Initial Setup

  1. Set environment variables in docker-compose.yml:
environment:
  - CONSUL_HOST=consul.service.dc1.consul
  - CONSUL_PORT=8500
  - TPLINK_IP=192.168.1.100
  - TV_IP=192.168.1.101
  - TV_MAC=AA:BB:CC:DD:EE:FF
  1. On first run, the app will:
    • Create initial configuration in Consul using environment variables
    • Store TV pairing keys in Consul when devices are paired

Managing Configuration

Health Monitoring

The health endpoint now includes Consul connectivity status:

GET /health

{
  "status": "healthy",
  "config": {...},
  "services": {
    "consul_connected": true
  }
}

Docker Deployment

  • Removed local volume for config storage
  • Requires network access to Consul cluster

Continuous Integration

We use GitHub Actions to automatically build and push Docker images to GitHub Container Registry.

Workflow Details

  • Triggers on pushes to main branch
  • Builds Docker image using the Dockerfile
  • Pushes image to GHCR with two tags: latest and commit SHA

Using the Image

# Example docker-compose snippet
services:
  smart-home:
    image: ghcr.io/your-username/your-repo:latest
    # ... rest of config

Status Badge

Build and Push Docker Image

Replace OWNER/REPO with your GitHub username and repository name

Nomad Deployment

For production deployments, use this Nomad job specification:

job "minihass" {
  datacenters = ["dc1"]

  group "smart-home" {
    network {
      mode = "host"
      port "http" {
        to = 5000
      }
    }

    service {
      name = "minihass"
      port = "http"
      
      check {
        type     = "http"
        path     = "/health"
        interval = "30s"
        timeout  = "5s"
      }
    }

    task "app" {
      driver = "docker"

      config {
        image = "ghcr.io/your-username/your-repo:latest"
        ports = ["http"]
      }

      env {
        CONSUL_HOST = "consul.service.dc1.consul"
        CONSUL_PORT = "8500"
        TPLINK_IP   = "192.168.1.100"
        TV_IP       = "192.168.1.101"
        TV_MAC      = "AA:BB:CC:DD:EE:FF"
      }

      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

Deployment Steps:

  1. Install and configure Nomad cluster
  2. Update environment variables in the job file
  3. Run: nomad job run minihass.nomad.hcl
  4. Access the app at: http://<nomad-node-ip>:5000
Description
No description provided
Readme 55 KiB
Languages
Python 71.7%
HTML 26.5%
HCL 1.8%