Skip to content

Virtual machines

Environments

Give every new VM the same environment variables, secret files and agent credentials, encrypted at rest and installed once at first boot.

An environment is what every new VM of your organization starts with: environment variables, secret files and, if you want, your organization's agent credentials. Set it up once, and each VM you create gets it on its first boot, ready in every shell.

Use it for the tokens and keys your VMs need: an API key for a staging backend, a .env file for the app you test, the Anthropic key your agents use.

Where to find it

Environments live on the Environment page of the dashboard, flockvm.com/dashboard/environment. Owners and admins create and change environments and reveal their values there. Members can pick an environment when they create a VM if its Members can use it switch is on (the default).

The same is available with an API key, through the Environments API, the flockvm command-line tool and the MCP server, with the same roles: everyone reads keys and paths, only owners and admins change environments and reveal values. The MCP server never reveals values.

Anyone who can create a VM with an environment can read its values

A member who creates a VM with an environment gets its variables and secret files in that VM, and can print them from a shell (env, cat). Reveal only limits who reads the values in the dashboard. To keep an environment's values from members, turn its Members can use it switch off: then only owners and admins can create VMs with it, and members do not see it in the create form.

Every region

Environments are kept on the host in France, the server that runs the VMs, and installed in a new VM on its first boot.

The base environment

Every organization has an environment named base. It exists from the first time you open the page, empty, and it is the default: a new VM gets it unless you pick another one.

You can create more, for example staging and prod, and switch the default:

Action How
Create New environment, then a name: 1 to 40 characters among lowercase letters, digits and dashes. Two environments of one organization cannot share a name.
Make default Click the star next to its name. Exactly one environment is the default.
Rename Change its name. VMs that use it keep working: they point at the environment, not at its name.
Delete Delete. The default environment cannot be deleted: make another one the default first.

Deleting an environment does not touch the VMs created with it: what was installed on their disk stays there.

What goes in a VM

Each environment has a switch and sections. Each section is a checkbox: turn it off and that part stays out of new VMs, without losing what you saved in it.

Section What reaches the VM
Secrets Your environment variables and secret files.
Agent credentials Your organization's Anthropic API key, as the variable ANTHROPIC_API_KEY. Only if the organization has one saved.
GitHub repositories Your repositories, cloned into the home folder. See GitHub repositories.
flockvm credentials Coming soon Not available yet.

Safe for third parties

Turn Safe for third parties on for an environment whose VMs are driven by someone else: your own customers, or an agent running code you don't trust. Nothing of your organization then goes into the VM: no variables, no secret files, no agent credentials, no repositories, whatever the sections say.

Per-VM variables (below) still reach the VM, because you give them for that one VM.

Secrets: environment variables

Add a variable with a key and a value. Once saved, the page shows its key and the last four characters of its value, never the whole value.

In the VM, the variable is set for the login user (user on the Agent image, root on Minimal) and for root, in every kind of shell (flockvm keeps them in /etc/flock/env, mode 0600, owned by the login user):

  • an interactive SSH login (ssh agent),
  • a command run over SSH without a shell (ssh agent 'echo $STRIPE_KEY'),
  • new windows and panes of tmux.

Programs started by those shells inherit it, like any environment variable.

Keys follow the usual shell rules: a letter or _, then letters, digits or _ (STRIPE_KEY, database_url, _TOKEN2). Keys that start with FLOCK_ are reserved for flockvm and refused.

Secrets: secret files

A secret file is written in the login user's home folder, at the path you give, relative to that folder: /home/user on the Agent image, /root on Minimal. Missing folders are created, owned by that user, and the file gets mode 0600 (only that user, and root, can read it). The examples below use the Agent image.

Path you give File in the VM
.npmrc /home/user/.npmrc
.config/gh/hosts.yml /home/user/.config/gh/hosts.yml
web-app/backend/.env /home/user/web-app/backend/.env

Absolute paths (/etc/…) and paths that leave the home folder (../, a/../../b) are refused.

A .env inside a repository

Give the file the path where the repository will be, such as web-app/backend/.env. If that repository is in the environment's GitHub repositories, that's all: flockvm clones it into ~/web-app and puts your file back in it, so ~/web-app/backend/.env is there next to the code. Unless the repository tracks it, the file is added to the clone's .git/info/exclude and git add -A never picks it up.

For a repository you clone yourself:

  1. Add the file

    In the environment, add a secret file with the path web-app/backend/.env and paste the file's content.

  2. Create a VM

    On first boot, flockvm writes /home/user/web-app/backend/.env, creating /home/user/web-app/backend.

  3. Clone into the existing folder

    git clone refuses a folder that is not empty, so initialize the repository in place:

    Inside your VM
    cd ~/web-app
    git init
    git remote add origin git@github.com:acme/web-app.git
    git fetch origin
    git checkout -t origin/main

    Keep .env in the repository's .gitignore so it is never committed.

Agent credentials

When Agent credentials is on and your organization has an Anthropic API key saved, new VMs get it as ANTHROPIC_API_KEY, in every shell like any other variable. Claude Code picks it up without a sign-in. See Claude Code.

The key is the one saved for your organization: the environment page neither shows nor edits it. An ANTHROPIC_API_KEY variable set in the environment replaces it, and a per-VM one replaces both.

GitHub repositories

Pick up to 10 repositories: every new VM clones them into the login user's home folder on its first boot, ~/web-app for acme/web-app (~/acme-web-app when two of them share a name).

  1. Connect GitHub

    Repositories come through the flockvm GitHub App, the same one that runs your CI. If your organization has not connected it yet, click Connect GitHub in the GitHub repositories section and install the App on the repositories you want. An owner or admin of the GitHub account does it.

  2. Pick the repositories

    Choose a repository in the list and click Add repository. Only those the App can reach are listed: to add another one, give the App access to it on GitHub (the link under the list), then reload the page.

  3. Create a VM

    Once the VM is up, the clone runs in the background: a large repository may take a few seconds more than SSH. journalctl -u flock-repos shows how it went.

flockvm asks GitHub for a token that can only read those repositories and expires within the hour. It is used for the clone and kept nowhere: the repository's origin is https://github.com/acme/web-app.git with no credential. To push, use your own credentials in the VM, for example a fine-grained GitHub token as a secret, or gh auth login.

Secret files of the environment inside the repository's folder, such as web-app/backend/.env, are kept: the repository is cloned and the files are put back in it. If the repository tracks the same file, yours replaces it in the working tree (git status shows it modified). If the repository has a folder or a symlink where one of your files goes, that repository is not cloned and your files stay as they are. Any other folder already at that path is left alone, and that repository is not cloned.

Per-VM variables

When you create a VM, you can give it variables of its own. They are merged over the environment's: if both have the same key, the VM's value wins. They follow the same rules and limits as the environment's variables.

Per-VM variables reach the VM even when its environment is Safe for third parties, and even with No environment.

No environment

To create one VM without anything of your organization in it, choose No environment when you create it. It is the same as Safe for third parties, for that VM only: no variables, no secret files, no agent credentials. Its per-VM variables still go in.

Versions

Every saved change to an environment makes a new version: v1, v2, v3… Adding, changing or deleting a variable, a file or a repository is a change, and so is turning a section or Safe for third parties on or off. Renaming it, making it the default or turning Members can use it on or off is not.

A VM takes the latest version when it is created and keeps it for its whole life. A later change applies to new VMs only: running, paused and stopped VMs keep what they got. To give an existing VM a new value, change it inside the VM, or create a new VM.

The environment page lists its recent versions, newest first, with how many VMs that still exist use each one. The VM page shows the environment and version it was created with.

Limits

What Limit
Environment name a-z, 0-9 and -, 1 to 40 characters
Variable key [A-Za-z_][A-Za-z0-9_]*, up to 128 characters, not starting with FLOCK_
Variable value 32 KiB
Variables per VM 100, environment and per-VM variables together, counting the injected ANTHROPIC_API_KEY
All variables of a VM 64 KiB in total, counting the injected ANTHROPIC_API_KEY
Secret files per environment 20
File path 256 bytes, relative to the login user's home, no ..
File size 256 KiB each, 512 KiB in total
Versions listed The 20 most recent

When Agent credentials is on and your organization has an Anthropic key, ANTHROPIC_API_KEY takes one of the 100 variables and its size counts in the 64 KiB. Saving a variable that would leave it no room is refused, and so is creating a VM whose merged variables are over a limit.

What not to put in secrets

Anything in an environment is readable by every program in every VM that gets it, and by anyone who can SSH into those VMs. A coding agent running without permission prompts can read it too, and print it or send it somewhere.

  • Use keys you can revoke and scope: a restricted Stripe key, a fine-grained GitHub token for one repository, an Anthropic key with a spend limit.
  • Don't put production credentials in an environment used for experiments. Use a separate environment, or Safe for third parties.
  • Don't put private SSH keys that open your other servers.
  • Revoke a key when the work is done, and rotate it if a VM ran code you don't trust.

Check from inside a VM

Print a variable with brackets around it, so an empty value shows:

ssh agent 'echo "[$STRIPE_KEY]"'
# [sk_test_51…]   the variable is set
# []              the VM did not get it

Check a secret file and its mode:

ssh agent 'ls -l ~/web-app/backend/.env'
# -rw------- 1 user user 812 Nov  1 09:12 /home/user/web-app/backend/.env

If a value is missing, check on the VM page which environment and version the VM was created with, and whether that environment has Secrets on and Safe for third parties off. A change made after the VM was created does not reach it.

Security

  • Encrypted at rest. Values and file contents are stored encrypted (AES-256-GCM), each bound to its organization, environment and key or path, so a value cannot be moved to another place and still decrypt.
  • Write-only in the dashboard. The environment page shows keys, the last four characters of values, file paths and sizes. Only owners and admins can Reveal the values, and each reveal is recorded in the audit log, as is every change (keys and paths, never values).
  • Not hidden from members inside a VM. Reveal is kept to owners and admins in the dashboard, the API and the CLI, not inside a VM. Anyone in your organization who can create a VM with an environment can read its values from inside that VM. Turn Members can use it off on an environment to keep it to owners and admins. See the warning at the top.
  • Delivered once. flockvm hands the values to the VM through its metadata service, on its first boot only. The guest installs them, and flockvm removes them from the metadata service as soon as the VM is running, so a process in the VM cannot read them from there later. If that removal keeps failing for two minutes, flockvm stops the VM (its disk is kept) and the VM page shows why, rather than leave the values readable there. flockvm keeps no plain copy: until that first boot the VM's record holds an encrypted copy (same encryption as above), and from then on only the environment and version.
  • They live on the VM's disk. Once installed, variables and files are on the VM's disk like any file you write. They survive pause, resume, stop and start, and a paused VM's memory snapshot holds them too. They go away when you delete the VM. See Isolation.

Next steps