garden-app

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

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 1 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.

Jump to

Keyboard shortcuts

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