From ac4d97685236a3e9ee4f06ffc7eb26548cc104be Mon Sep 17 00:00:00 2001 From: Vigneshraj Sekar Babu Date: Thu, 19 Jun 2025 10:45:11 -0700 Subject: [PATCH 1/2] doc: init local dev docs --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Tiltfile | 11 ---------- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 31176071..5c4c1021 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,64 @@ lifecycle is a tool that transforms pull requests into ephemeral development env Isolated sandboxes for partners and vendors that share only what’s necessary, avoiding full staging access. Happy coding! Join the community on [Discord](https://discord.gg/TEtKgCs8T8) + + +## Development + +### Prerequisites + +Install the following tools using [Homebrew](https://brew.sh/): + +```shell +brew install tilt kind kubectx kubectl +brew install --cask docker +``` + +### Configuration + +- **Ngrok**: + The project uses `ngrok` to create a public URL for your local instance. You will need to: + - Sign up for an [ngrok account](https://dashboard.ngrok.com/signup) to get an authtoken. + - Set the following environment variables. You can add them to your shell profile (e.g., `~/.zshrc` or `~/.bash_profile`). + + ```shell + export NGROK_AUTHTOKEN="" + export NGROK_LIFECYCLE_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. + +### Running Locally + +- Create a local Kubernetes cluster using `kind`: + ```shell + 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. + +- Switch your Kubernetes context to the newly created cluster: + ```shell + kx kind-lfc + ``` + +- Setup local env secrets at `helm/environments/local/secrets.yaml`: + ```yaml + secrets: + databaseUrl: postgresql://lifecycle:lifecycle@local-postgres:5432/lifecycle + redisUrl: redis://redis-master:6379 + githubPrivateKey: "" + githubClientSecret: "" + githubWebhookSecret: "" + githubAppId: "" + githubClientId: "" + githubInstallationId: "" + ``` +> [!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`: + ```shell + tilt up + ``` \ No newline at end of file diff --git a/Tiltfile b/Tiltfile index 2d3b4dfa..350da070 100644 --- a/Tiltfile +++ b/Tiltfile @@ -192,17 +192,6 @@ k8s_resource( labels=["infra"] ) -# Helper function to add namespace to kubernetes resources -def kustomize_with_helm(yaml_path, namespace): - yaml = helm( - None, - name="custom-namespace", - namespace=namespace, - template=[yaml_path], - set=["namespace={}".format(namespace)] - ) - return yaml - ################################## # DISTRIBUTION ################################## From 4cd679efb4a39d801f933c9adaf41a86d877cfc6 Mon Sep 17 00:00:00 2001 From: Vigneshraj Sekar Babu Date: Thu, 19 Jun 2025 10:47:37 -0700 Subject: [PATCH 2/2] doc: fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c4c1021..84f35cf5 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ brew install --cask docker githubInstallationId: "" ``` > [!NOTE] -> You can create the Github app with the app creation setup flow and then copy the secrets created for local development. +> 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`: ```shell