garden-app

command module
v0.0.0-...-e2cdd45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Garden App

This is a Go application with a CLI and web backend for working with the garden controller.

Getting Started

  1. Clonse this repository
    git clone https://github.com/calvinmclean/automated-garden.git
    
  2. Start up all services
    docker compose -f deploy/docker-compose.yml --profile demo up
    
  3. In a new terminal, create a config.yaml file from the provided example
    cd garden-app
    cp config.yaml.example config.yaml
    
  4. Create a gardens.yaml file from the provided example
    cp gardens.yaml.example gardens.yaml
    
  5. Run the server:
    go run main.go serve --config config.yaml
    

To run this in a more long-term setup, I recommend using K3s and deploying the manifests from /deploy/k8s.

Don't forget to update the config.yaml and gardens.yaml in the ConfigMap. Also, to use ConfigMap storage client you will have to enable the correct permissions in your cluster with this command:

kubectl create clusterrolebinding default --clusterrole=admin --serviceaccount=default:default

Additional Usage Details

Server

The server command is the main program that runs the webserver backend for managing Gardens.

Storage Clients

The storage package defines a Client interface and multiple implementations of it. The NewStorageClient will create a client based on the configuration. The available clients are:

  • YAMLClient
    • Writes objects to a YAML file on the local filesystem
    • Requires a filename to use
  • ConfigMapClient
    • Write objects to a YAML file in a Kubernetes ConfigMap
    • Requires a ConfigMap name and key to access the data
    • Additional setup may be required to enable the garden-app Pod to write to the ConfigMap:
      kubectl create clusterrolebinding default --clusterrole=admin --serviceaccount=default:default
      
Controller

The controller command behaves as a mock garden-controller that makes it easier to develop, test, and debug without using a standalone microcontroller. This has extensive options using flags to control different behaviors. In most cases, the defaults will work perfectly fine.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package clock provides time-related utilities and wrappers
Package clock provides time-related utilities and wrappers
Package cmd provides the CLI commands for the garden-app
Package cmd provides the CLI commands for the garden-app
Package controller provides the mock controller for testing
Package controller provides the mock controller for testing
pkg
Package pkg provides domain models and utilities for the garden application
Package pkg provides domain models and utilities for the garden application
action
Package action defines actions that can be performed on gardens and zones
Package action defines actions that can be performed on gardens and zones
concurrent
Package concurrent provides utilities for executing tasks concurrently with timeout support.
Package concurrent provides utilities for executing tasks concurrently with timeout support.
influxdb
Package influxdb provides an InfluxDB client for storing metrics
Package influxdb provides an InfluxDB client for storing metrics
mqtt
Package mqtt provides MQTT client functionality
Package mqtt provides MQTT client functionality
notifications
Package notifications provides notification client implementations
Package notifications provides notification client implementations
notifications/fake
Package fake provides a fake notification client for testing
Package fake provides a fake notification client for testing
storage
Package storage provides database storage implementations
Package storage provides database storage implementations
units
Package units provides unit conversion utilities for temperature and length
Package units provides unit conversion utilities for temperature and length
weather
Package weather provides weather client interfaces and implementations
Package weather provides weather client interfaces and implementations
weather/fake
Package fake provides a fake weather client for testing
Package fake provides a fake weather client for testing
weather/netatmo
Package netatmo provides a client for the Netatmo weather API
Package netatmo provides a client for the Netatmo weather API
weather/openmeteo
Package openmeteo provides a client for the Open-Meteo weather API
Package openmeteo provides a client for the Open-Meteo weather API
Package server provides the HTTP API server for the garden application
Package server provides the HTTP API server for the garden application
vcr
Package vcr provides VCR recording functionality for tests
Package vcr provides VCR recording functionality for tests
Package worker handles scheduled watering, health checks, and notifications
Package worker handles scheduled watering, health checks, and notifications

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL