In addition to the containers that are a part of you "original" environment, another "special" container is created when an environment is spawned - the dev container (named
dev by default).
The purpose of this container is to mimic the developer's computer's role when developing locally.
You can run scripts, build your code, run tests, and do anything you're used to doing while developing as if it were your computer.
The repository's folder is copied (except for what's explicitly in .gitignore) to the dev container when spawning an environment, and a two-way sync makes sure these directories stay synchronized.
Two important things happen in the dev container during environment spawning -
- The execution of the warmup script.
- The execution of the custom database seeding scripts.
Include all the dependencies for these scripts by editing the dev container's Dockerfile.
Defining the Dev Container
The dev container is defined using the
deploy_dev_container() function in the
.raftt env definition file.
Default Dev Container
The default dev container, generated when running
raftt setup, includes many useful tools for development and environment management. The docker image and the description of its content can be found here.
Running Raftt Commands
We added a reduced copy of Raftt's CLI into the dev container.
This allows users to run some of Raftt's commands after SSHing to the dev container using
raftt sh dev command.
The allowed commands affect the containers and not the images or the environment itself. The following commands are available -
status- Show statuses of workloads.
cp- Copy files to and from a workload.
help- Help with any command.
logs- Get the logs of a workload.
restart- Restart one or more workloads.
sh- Connect or run a command on a workload.
stop- Stop one or more workloads.
version- Show the Raftt version information.
Because Raftt depends on the dev container for running various scripts, the dev container may not depend on other workloads.