Skip to content

metalbear-co/mirrord-vscode

Repository files navigation

mirrord

Discord License GitHub release (latest SemVer) Twitter Follow

mirrord lets developers run local processes in the context of their cloud environment. It’s meant to provide the benefits of running your service on a cloud environment (e.g. staging) without actually going through the hassle of deploying it there, and without disrupting the environment by deploying untested code. It comes as a Visual Studio Code extension, an IntelliJ plugin and a CLI tool. You can read more about it here.

This repository is for the VSCode extension. mirrord's main repository can be found here.

How to use

  • Click mirrord status bar item to switch mirrord from Disabled to Enabled
  • Start debugging your project
  • Choose pod to impersonate
  • The debugged process will start with mirrord, and receive the context of the impersonated pod. It will receive its environment variables and incoming traffic, will read and write files to it, and send outgoing traffic through it.

mirrord uses your machine's default kubeconfig for access to the Kubernetes API.

For incoming traffic, make sure your local process is listening on the same port as the remote pod.

Settings

mirrord allows for rich configuration of the environment it provides. The schema for it is documented here. You can also use toml or yaml format. However, the extension supports autocomplete only for json files.

mirrord reads its configuration from the following locations:

  1. Active config can be set for the whole workspace using the selectActiveConfig command or the link in the dropdown menu. If active config is set, mirrord always uses it.
  2. If active config is not set, mirrord searches process environment (specified in launch configuration) for MIRRORD_CONFIG_FILE variable. This path can use the ${workspaceFolder} variable.
  3. If no config is specified, mirrord looks for a default project config file in the .mirrord directory with a name ending with mirrord.{json,toml,yaml,yml}. If there is no default config file, mirrord uses default configuration values for everything. If there are many candidates for the default config file, mirrord sorts them alphabetically and uses the first one.

You can use the changeSettings command or the link in the dropdown menu to quickly edit detected configs.