In software development, developers write and test their code locally, then deploy it to a staging or pre-production environment in the cloud, where they perform additional tests. These tests often fail because the code is being introduced into a production-like environment for the first time and encounters new conditions. The code must then be fixed or rewritten, tested locally again, and deployed to staging, and so on, until the tests on staging pass.
Solution to this problem?
mirrord is a tool that enables developers to run local processes within the context of their cloud environment. It makes it incredibly easy to test your code in a cloud environment (e.g., staging) without the hassle of Dockerization, CI, or deployment, and without disrupting the environment by deploying untested code.
Deployment to staging can be costly for several reasons, including the involvement of a CI process, which may be slow or break at times. Additionally, since staging environments are shared, the environment is occasionally compromised when an engineer deploys unstable code.
mirrord removes the costs associated with deployment to staging by completely removing the ‘deployment’ step from the process. By plugging your local process directly into the staging environment, you can test your code in cloud conditions without going through a lengthy CI process, and without the risk of breaking the environment for other developers.
How does it work?
When you start your local process with mirrord, it creates a pod in your cloud environment, which listens in on the pod you’ve passed as an argument. It overrides your app’s system calls to use the remote pod’s network and file system. It listens to traffic from the cloud, sends outgoing requests from the remote pod, accesses remote files, and merges environment variables.
How is it different from other remocal solutions?
mirrord is not the first tool to allow you to run your code in the cloud. However, it does it in a way that’s completely different from all the other solutions. While all other remocal solutions use some version of a VPN to connect your local machine (or local Docker container) to the cluster, mirrord works at the level of your local process, overriding its syscalls and proxying them to the cloud. Similarly, at the cluster level, it operates at the level of the target pod, running on the same node and executing the system calls received from the client.
Attaching a video down below for more info: