Build ephemeral environments from pull requests.
What is lifecycle?
lifecycle is a tool that transforms pull requests into ephemeral development environments that seamlessly connect to required dependencies while remaining isolated from unrelated changes.
Lifecycle in action
ephemeral-environments-with-lifecycle.mp4
Use Cases:
Development:
Isolated environments for feature branches to develop, without interference from others' work.Testing:
Fully connected and function environments for manual and automated testing.Design Review:
Live environments for product managers and designers to interact with new features.External Sandboxes:
Isolated sandboxes for partners and vendors that share only what’s necessary, avoiding full staging access.
Happy coding! Join the community on Discord
Install the following tools using Homebrew:
brew install tilt kind kubectx kubectl
brew install --cask dockerNgrok: The project uses
ngrokto create a public URL for your local instance. You will need to:- Sign up for an ngrok account to get an authtoken.
- Set the following environment variables. You can add them to your shell profile (e.g.,
~/.zshrcor~/.bash_profile).
export NGROK_AUTHTOKEN="<your_ngrok_authtoken>"export NGROK_LIFECYCLE_DOMAIN="<your_ngrok_domain>"# your ngrok domain. needs paid plan to get a static domain
AWS Credentials: (Optional, if using AWS ECR) Ensure your AWS credentials are set up in
~/.aws/credentials. The Tilt environment needs this to create a Kubernetes secret for the application.
- Create a local Kubernetes cluster using
kind:kind create cluster --config sysops/tilt/kind-config.yaml --name lfc
Important
We need to use a custom kind config file to allow insecure registries setup for local development.
The local kind config also publishes ports 80 and 443 from the control-plane node back to 127.0.0.1 so host-based ingress works without kubectl port-forward.
If you already have an older lfc cluster, recreate it so the new port mappings and fresh seeded domain defaults are applied.
Switch your Kubernetes context to the newly created cluster:
kx kind-lfc
Setup local env secrets at
helm/environments/local/secrets.yaml:secrets: databaseUrl: postgresql://lifecycle:lifecycle@local-postgres:5432/lifecycleredisUrl: redis://redis-master:6379githubPrivateKey: "<private_key_without_new_lines>"githubClientSecret: "<client_secret>"githubWebhookSecret: "<webhook_secret>"githubAppId: "<app_id>"githubClientId: "<client_id>"githubInstallationId: "<installation_id>"encryptionKey: "<64-char hex string, e.g. output of openssl rand -hex 32>"
Note
You can create the GitHub app with the app creation setup flow and then copy the secrets created for local development.
Start the development environment using
tilt:tilt up
Access deployed HTTP services directly from the host using the generated ingress host:
http://<deploy-uuid>.127.0.0.1.nip.io
Note
nip.io resolves names like foo.127.0.0.1.nip.io to 127.0.0.1, so local lifecycle deploys can use host-based ingress without editing /etc/hosts.