ubercontroller

package module
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 0 Imported by: 0

README

Ubercontroller

New controller for Odyssey Momentum platform.

Development

Prerequisites
  • Go environment
  • Connection information for a running Postgres database
TL;DR (quick start)

For local development:

  • copy config.example.yaml to config.yaml
  • configure the database connection in config.yaml
  • make run
Configuration

Configuration can be done through environment variables or a YAML file. A (minimal) configuration file example is included at config.example.yaml. Copy this file to config.yaml and it will be used by default. The minimal required configuration are the PostgreSQL database connection fields. All others have default values setup for a development environment.

The configuration is implemented with Go struct tags. For the available configuration options see config/config.go

API documentation

Documentation for the JSON API is automatically generated. For the develop branch this is done for every change and deployed.

To generate it locally NodeJS is required (npx should be available).

Run make docs-html. Then open build/docs/api.html in a web browser.

Database migrations

Changes to the database are managed as SQL scripts in database/migrations with go-migrate. See its documentation for detailed instructions. The short version:

go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
migrate create -ext sql -dir database/migrations/sql/ -seq <SHORT_NAME_FOR_MIGRATION>

Two empty .sql files will be created in database/migrations/sql. Implemented them and to test it:

go run ./cmd/service/ -migrate

And to revert the change:

go run ./cmd/service/ -migrate -steps -1

If something goes wrong, it will leave the database in a 'dirty' state. To resolve you have to manually bring back the database to a known state (so use a single transaction in the SQL scripts to make this easier). After that edit the schema_migration table and set the version number back and flip the dirty boolean.

Documentation

Index

Constants

View Source
const (
	APIMajorVersion = 4
	APIMinorVersion = 0
	APIPatchVersion = 0

	ControllerMajorVersion = 1
	ControllerMinorVersion = 0
	ControllerPathVersion  = 0
	ControllerGitVersion   = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
db
cmd
pkg
Package pkg can be used by third-parties
Package pkg can be used by third-parties
media/processor
Part of this code is borrowed from/inspired by https://github.com/iqhater/get-youtube-thumbnail, which is licensed by MIT license
Part of this code is borrowed from/inspired by https://github.com/iqhater/get-youtube-thumbnail, which is licensed by MIT license
posbus
The posbus package implements the custom protocol for communication between the backend and frontends.
The posbus package implements the custom protocol for communication between the backend and frontends.
service
Package services allows running the controller service from go without going through the cli.
Package services allows running the controller service from go without going through the cli.
attributes
Package attributes provides functionality for handling/using the plugin attributes system.
Package attributes provides functionality for handling/using the plugin attributes system.
iot
logic/api/dto
TODO: deal with this mess
TODO: deal with this mess
streamchat
Text chat functionality backed by getstream.io chat service.
Text chat functionality backed by getstream.io chat service.

Jump to

Keyboard shortcuts

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