Skip to main content

Git Workflow Integration

One of Raftt's unique benefits is its integration with your Git workflow, allowing you to switch between branches without worrying about the state of your dev environment. When leaving a branch while having an active environment, the whole env is deactivated but kept for future use, while the new branch enjoys a clean environment.

In the following section, we'll describe what happens when users switch to a different branch using git checkout. The details differ depending on whether the checked-out branch has a previously deactivated environment or not:

  1. A new branch - the newly checked-out branch doesn't have a deactivated environment.
  2. A branch with a deactivated env - the newly checked-out branch already had an active env that was deactivated by checking out another branch.

New Branch

  1. The user checks out the code on the local machine.
  2. Raftt recognizes it using githooks and notifies Raftt's backend.
  3. The backend deactivates the running environment.
  4. The container starts a new environment for the new branch, similar to what is described in how Raftt works?.

Branch with Deactivated Env

  1. The user checks out the code in the local machine.
  2. Raftt recognizes it using githooks and notifies Raftt's backend.
  3. The backend "deactivates" the running environment.
  4. Subsequently, the backend recognizes that the new branch has a "deactivated" environment.
  5. If the environment is "frozen", the environment is woken up:
    1. A new environment controller is built.
    2. All of its containers are loaded.
    3. The containers' states are restored from backup.
    4. The storage is restored from backup.

As you may notice, the first three steps remain the same in both configurations - regardless of the branch state.

Idle Environments

Environments that are idle for too long can become "frozen". This keeps the data stored but saves the computing resources. Moreover, you can always come back to a "frozen" environment - it will just take slightly longer.

Environments are also frozen when raftt down --hibernate is run in a repo with an active Raftt environment. Running raftt down destroys the environment without keeping the data.

When freezing the environment, Raftt performs the following operations:

  1. The containers' states are backed up.
  2. The storage is backed up.
  3. The containers are taken down.
Note

Raftt freezes the environment in the background and wakes them up as needed - this isn't something you need to track manually.