Giter Site home page Giter Site logo

flightctl's Introduction

Flight Control

Flight Control is a service for declarative, GitOps-driven management of edge device fleets running ostree-based Linux system images.

Note

Flight Control is still in early stage development!

Building

Prerequisites:

  • git, make, and go (>= 1.20), and podman-compose

Flightctl agent reports the status of running rootless containers. Ensure the podman socket is enabled:

systemctl --user enable --now podman.socket

Checkout the repo and from within the repo run:

make build

To run unit tests, use make unit-test. This requires installing gotestsum:

go install gotest.tools/gotestsum@latest

To generate API code and mocks, use make generate This requires installing mockgen:

go install github.com/golang/mock/[email protected]

Running

Note: If you are developing with podman on an arm64 system (i.e. M1/M2 Mac) change the postgresql image with:

export PGSQL_IMAGE=registry.redhat.io/rhel8/postgresql-12
podman login registry.redhat.io

The service can be deployed locally in kind with the following command:

make deploy

Note it stores its generated CA cert, server cert, and client-bootstrap cert in $HOME/.flightctl/certs and the client configuration in $HOME/.flightctl/config.yaml.

Use the flightctl CLI to apply, get, or delete resources:

bin/flightctl apply -f examples/fleet.yaml
bin/flightctl get fleets

Use an agent VM to test a device interaction, an image is automatically created from hack/Containerfile.local and a qcow2 image is derived in output/qcow2/disk.qcow2, currently this only works on a Linux host.

# will create the cluster, and the agent config files in bin/agent which will be embedded in the image
make deploy
make agent-vm agent-vm-console # user/password is redhat/redhat

The agent-vm target accepts multiple parameters:

  • VMNAME: the name of the VM to create (default: flightctl-device-default)
  • VMCPUS: the number of CPUs to allocate to the VM (default: 1)
  • VMMEM: the amount of memory to allocate to the VM (default: 512)
  • VMWAIT: the amount of minutes to wait on the console during first boot (default: 0)

It is possible to create multiple VMs with different names:

make agent-vm VMNAME=flightctl-device-1
make agent-vm VMNAME=flightctl-device-2
make agent-vm VMNAME=flightctl-device-3

Those should appear on the root virsh list:

$ sudo virsh list
 Id   Name                        State
-------------------------------------------
 13   flightctl-device-1          running
 14   flightctl-device-2          running
 15   flightctl-device-3          running

And you can log in the consoles with agent-vm-console:

make agent-vm-console VMNAME=flightctl-device-1

NOTE: You can exit the console with Ctrl + ] , and stty rows 80 and stty columns 140 (for example) are useful to resize your console otherwise very small.

If you created individual devices you need to clean them one by one:

make agent-vm-clean VMNAME=flightctl-device-1
make agent-vm-clean VMNAME=flightctl-device-2
make agent-vm-clean VMNAME=flightctl-device-3

Use the devicesimulator to simulate load from devices:

bin/devicesimulator --count=100

Running the server locally

For development purposes it can be useful to run the database in a container in kind, and the server locally. To do this, first start the database:

make deploy-db

Then start the server:

rm $HOME/.flightctl/client.yaml
bin/flightctl-server

Metrics

Start the observability stack:

podman-compose -f deploy/podman/observability.yaml up

The Grafana and Prometheus web UIs are then accessible on http://localhost:3000 and http://localhost:9090, respectively.

flightctl's People

Contributors

avishayt avatar fzdarsky avatar mangelajo avatar hexfusion avatar dependabot[bot] avatar oglok avatar sagidayan avatar filanov avatar akoserwal avatar aspanner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.