How Raftt Works?
Raftt supports two basic modes of operation - "connect" and "orchestration". In "connect" mode, the environment is already deployed by other infrastructure, and Raftt is used to enable development on top. In orchestration
mode, Raftt also orchestrates the environment. Beyond that difference, the modes are remarkably similar.
We'll go through the mechanics of the raftt connect
operation, and note where raftt up
behaves a bit differently.
This is a concise explanation, more info is available under Key Concepts.
Connecting to an Environment
When a user runs raftt connect <namespace>
, the following actions happen:
- Raftt's CLI brings up Raftt's daemon, which handles all access to the remote environment controller, including file syncing and traffic handling.
- The daemon uses the user's KubeConfig to deploy Raftt's environment controller in the specified namespace.
- The daemon initializes the controller with the current user and repository.
- The contents of the current repo, including untracked files, are synced to the environment controller.
- A persistent connection is created between the daemon and the environment controller.
- Over the connection, a continuous low-latency file sync is set up.
- A "deploy" request is sent to the environment controller, which leads to...
- An evaluation in the environment controller of the
.raftt
file - Raftt's primary configuration file, defining the behavior of the Kubernetes resources during development. - Deployment of resources passed to
deploy_on_connect
- usually configurations or auxiliary workloads that are needed for development but not present in the "clean" environment.
At this point, the flow is complete, and the user can start working with their environment - converting workloads to dev mode and iterating on them.
How is Spawning an Environment Using Raftt Different?
When using raft up
there are some slight differences:
- The daemon contacts Raftt's Environment Manager, which provisions a new Kubernetes namespace, deploys the environment controller in it, and initializes it.
- The deploy request causes, along with evaluation of the
.raftt
file, as before, the deployment of all Kubernetes resources passed to thedeploy
method - generally, the entire environment.- In this mode, this step can also include things like mounting the synced source from the local machine, seeding databases, building images or running scripts.
- When using
raftt up
all workloads are always in dev mode.
Under the Hood of a Running Environment
Even after the environment has spawned, our job is not yet done. We make sure that your work is as easy and seamless as possible. We keep the remote environment synced with whatever you do locally by syncing file changes from the repo folder. The port mapping between your machine's localhost and the containers in the remote environment allows accessing the env using any tool you are used to working with locally. We even enhance the containers to allow easier access and debugging.