From 7b57b2223d11fa6801683955fb2af7e58a7dec98 Mon Sep 17 00:00:00 2001 From: vmelikyan Date: Wed, 10 Sep 2025 18:12:19 -0700 Subject: [PATCH 1/2] add steps for configuring BUILDKIT_HOST --- src/lib/static/blogcontent/blogcontent.json | 2 +- src/lib/static/blogcontent/blogcontent.ts | 2 +- src/pages/docs/setup/create-github-app.mdx | 58 +++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/lib/static/blogcontent/blogcontent.json b/src/lib/static/blogcontent/blogcontent.json index ee5da89..39cc041 100644 --- a/src/lib/static/blogcontent/blogcontent.json +++ b/src/lib/static/blogcontent/blogcontent.json @@ -81,7 +81,7 @@ "description": null, "date": null, "path": "docs/setup/create-github-app", - "body": "To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments." + "body": "To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n## Configure BuildKit Endpoint\n\nBefore creating the GitHub app, you need to configure the BuildKit endpoint in the database:\n\n\n Replace `my-lifecycle` in the commands below with your actual Helm release name before running them.\n\n\n### Option 1: Using kubectl exec with psql\n\nExecute the following command to connect to the PostgreSQL pod and run the query:\n\n```bash\nkubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c \"\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\\\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\\\"'::jsonb,\n true\n),\n\\\"updatedAt\\\" = NOW()\nWHERE key = 'buildDefaults';\"\n```\n\nNote: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name.\n\n### Option 2: Direct SQL query\n\nIf you have direct database access, run the following SQL query:\n\n```sql\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,\n true\n),\n\"updatedAt\" = NOW()\nWHERE key = 'buildDefaults';\n```\n\n### Refresh Configuration Cache\n\nAfter running either option above, refresh the configuration cache:\n\n```bash\ncurl -X 'PUT' \\\n 'https://app./api/v1/config/cache' \\\n -H 'accept: application/json'\n```\n\nReplace `` with your actual domain (e.g., `0env.com`).\n\n## Create GitHub App\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments." }, { "title": "Deploy Issues", diff --git a/src/lib/static/blogcontent/blogcontent.ts b/src/lib/static/blogcontent/blogcontent.ts index 06b664d..99a05fe 100644 --- a/src/lib/static/blogcontent/blogcontent.ts +++ b/src/lib/static/blogcontent/blogcontent.ts @@ -85,7 +85,7 @@ export const blogContent = [ description: null, date: null, path: "docs/setup/create-github-app", - body: "To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments.", + body: "To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n## Configure BuildKit Endpoint\n\nBefore creating the GitHub app, you need to configure the BuildKit endpoint in the database:\n\n\n Replace `my-lifecycle` in the commands below with your actual Helm release name before running them.\n\n\n### Option 1: Using kubectl exec with psql\n\nExecute the following command to connect to the PostgreSQL pod and run the query:\n\n```bash\nkubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c \"\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\\\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\\\"'::jsonb,\n true\n),\n\\\"updatedAt\\\" = NOW()\nWHERE key = 'buildDefaults';\"\n```\n\nNote: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name.\n\n### Option 2: Direct SQL query\n\nIf you have direct database access, run the following SQL query:\n\n```sql\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,\n true\n),\n\"updatedAt\" = NOW()\nWHERE key = 'buildDefaults';\n```\n\n### Refresh Configuration Cache\n\nAfter running either option above, refresh the configuration cache:\n\n```bash\ncurl -X 'PUT' \\\n 'https://app./api/v1/config/cache' \\\n -H 'accept: application/json'\n```\n\nReplace `` with your actual domain (e.g., `0env.com`).\n\n## Create GitHub App\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments.", }, { title: "Deploy Issues", diff --git a/src/pages/docs/setup/create-github-app.mdx b/src/pages/docs/setup/create-github-app.mdx index 59aec99..771d8b7 100644 --- a/src/pages/docs/setup/create-github-app.mdx +++ b/src/pages/docs/setup/create-github-app.mdx @@ -12,6 +12,64 @@ import { Image } from "@lifecycle-docs/components"; To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps: +## Configure BuildKit Endpoint + +Before creating the GitHub app, you need to configure the BuildKit endpoint in the database: + + + Replace `my-lifecycle` in the commands below with your actual Helm release + name before running them. + + +### Option 1: Using kubectl exec with psql + +Execute the following command to connect to the PostgreSQL pod and run the query: + +```bash +kubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c " +UPDATE global_config +SET config = jsonb_set( + COALESCE(config::jsonb, '{}'::jsonb), + '{buildkit,endpoint}', + '\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb, + true +), +\"updatedAt\" = NOW() +WHERE key = 'buildDefaults';" +``` + +Note: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name. + +### Option 2: Direct SQL query + +If you have direct database access, run the following SQL query: + +```sql +UPDATE global_config +SET config = jsonb_set( + COALESCE(config::jsonb, '{}'::jsonb), + '{buildkit,endpoint}', + '"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234"'::jsonb, + true +), +"updatedAt" = NOW() +WHERE key = 'buildDefaults'; +``` + +### Refresh Configuration Cache + +After running either option above, refresh the configuration cache: + +```bash +curl -X 'PUT' \ + 'https://app./api/v1/config/cache' \ + -H 'accept: application/json' +``` + +Replace `` with your actual domain (e.g., `0env.com`). + +## Create GitHub App + Make sure you have admin access to the Github organization or account where you want to create the app. From 146b7c00496c59d9c428b5179be231eab00f22c7 Mon Sep 17 00:00:00 2001 From: vmelikyan Date: Wed, 10 Sep 2025 18:38:31 -0700 Subject: [PATCH 2/2] update --- src/lib/static/blogcontent/blogcontent.json | 2 +- src/lib/static/blogcontent/blogcontent.ts | 2 +- src/pages/docs/setup/create-github-app.mdx | 46 +++++++++++++++------ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/lib/static/blogcontent/blogcontent.json b/src/lib/static/blogcontent/blogcontent.json index 39cc041..f88a8a1 100644 --- a/src/lib/static/blogcontent/blogcontent.json +++ b/src/lib/static/blogcontent/blogcontent.json @@ -81,7 +81,7 @@ "description": null, "date": null, "path": "docs/setup/create-github-app", - "body": "To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n## Configure BuildKit Endpoint\n\nBefore creating the GitHub app, you need to configure the BuildKit endpoint in the database:\n\n\n Replace `my-lifecycle` in the commands below with your actual Helm release name before running them.\n\n\n### Option 1: Using kubectl exec with psql\n\nExecute the following command to connect to the PostgreSQL pod and run the query:\n\n```bash\nkubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c \"\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\\\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\\\"'::jsonb,\n true\n),\n\\\"updatedAt\\\" = NOW()\nWHERE key = 'buildDefaults';\"\n```\n\nNote: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name.\n\n### Option 2: Direct SQL query\n\nIf you have direct database access, run the following SQL query:\n\n```sql\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,\n true\n),\n\"updatedAt\" = NOW()\nWHERE key = 'buildDefaults';\n```\n\n### Refresh Configuration Cache\n\nAfter running either option above, refresh the configuration cache:\n\n```bash\ncurl -X 'PUT' \\\n 'https://app./api/v1/config/cache' \\\n -H 'accept: application/json'\n```\n\nReplace `` with your actual domain (e.g., `0env.com`).\n\n## Create GitHub App\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments." + "body": "## Configure BuildKit Endpoint\n\nBefore creating the GitHub app, you need to configure the BuildKit endpoint in the database:\n\n\n Set the `HELM_RELEASE` environment variable to your actual Helm release name\n before running the commands below.\n\n\n\n The following commands will create the `buildkit` object and `endpoint`\n configuration if they don't exist, or update them if they do.\n\n\n### Option 1: Using kubectl exec with psql\n\nExecute the following commands to connect to the PostgreSQL pod and run the query:\n\n```bash\n# Set your Helm release name (replace with your actual release name)\nexport HELM_RELEASE=\n\n# Get the database password from the secret\nexport PGPASSWORD=$(kubectl get secret ${HELM_RELEASE}-postgres -n lifecycle-app -o jsonpath='{.data.POSTGRES_USER_PASSWORD}' | base64 -d)\n\n# Run the query\nkubectl exec -it ${HELM_RELEASE}-postgres-0 -n lifecycle-app -- env PGPASSWORD=$PGPASSWORD psql -U lifecycle -d lifecycle -c \"\nUPDATE global_config\nSET config = jsonb_set(\n jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit}',\n COALESCE(config::jsonb->'buildkit', '{}'::jsonb),\n true\n ),\n '{buildkit,endpoint}',\n '\\\"tcp://${HELM_RELEASE}-buildkit.lifecycle-app.svc.cluster.local:1234\\\"'::jsonb,\n true\n),\n\\\"updatedAt\\\" = NOW()\nWHERE key = 'buildDefaults';\"\n```\n\n### Option 2: Direct SQL query\n\nIf you have direct database access, run the following SQL query (replace `` with your actual Helm release name):\n\n```sql\nUPDATE global_config\nSET config = jsonb_set(\n jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit}',\n COALESCE(config::jsonb->'buildkit', '{}'::jsonb),\n true\n ),\n '{buildkit,endpoint}',\n '\"tcp://-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,\n true\n),\n\"updatedAt\" = NOW()\nWHERE key = 'buildDefaults';\n```\n\n### Refresh Configuration Cache\n\nAfter running either option above, refresh the configuration cache:\n\n```bash\ncurl -X 'PUT' \\\n 'https://app./api/v1/config/cache' \\\n -H 'accept: application/json'\n```\n\nReplace `` with your actual domain (e.g., `0env.com`).\n\n## Create GitHub App\n\nTo create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments." }, { "title": "Deploy Issues", diff --git a/src/lib/static/blogcontent/blogcontent.ts b/src/lib/static/blogcontent/blogcontent.ts index 99a05fe..c8b6b07 100644 --- a/src/lib/static/blogcontent/blogcontent.ts +++ b/src/lib/static/blogcontent/blogcontent.ts @@ -85,7 +85,7 @@ export const blogContent = [ description: null, date: null, path: "docs/setup/create-github-app", - body: "To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n## Configure BuildKit Endpoint\n\nBefore creating the GitHub app, you need to configure the BuildKit endpoint in the database:\n\n\n Replace `my-lifecycle` in the commands below with your actual Helm release name before running them.\n\n\n### Option 1: Using kubectl exec with psql\n\nExecute the following command to connect to the PostgreSQL pod and run the query:\n\n```bash\nkubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c \"\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\\\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\\\"'::jsonb,\n true\n),\n\\\"updatedAt\\\" = NOW()\nWHERE key = 'buildDefaults';\"\n```\n\nNote: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name.\n\n### Option 2: Direct SQL query\n\nIf you have direct database access, run the following SQL query:\n\n```sql\nUPDATE global_config \nSET config = jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit,endpoint}',\n '\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,\n true\n),\n\"updatedAt\" = NOW()\nWHERE key = 'buildDefaults';\n```\n\n### Refresh Configuration Cache\n\nAfter running either option above, refresh the configuration cache:\n\n```bash\ncurl -X 'PUT' \\\n 'https://app./api/v1/config/cache' \\\n -H 'accept: application/json'\n```\n\nReplace `` with your actual domain (e.g., `0env.com`).\n\n## Create GitHub App\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments.", + body: "## Configure BuildKit Endpoint\n\nBefore creating the GitHub app, you need to configure the BuildKit endpoint in the database:\n\n\n Set the `HELM_RELEASE` environment variable to your actual Helm release name\n before running the commands below.\n\n\n\n The following commands will create the `buildkit` object and `endpoint`\n configuration if they don't exist, or update them if they do.\n\n\n### Option 1: Using kubectl exec with psql\n\nExecute the following commands to connect to the PostgreSQL pod and run the query:\n\n```bash\n# Set your Helm release name (replace with your actual release name)\nexport HELM_RELEASE=\n\n# Get the database password from the secret\nexport PGPASSWORD=$(kubectl get secret ${HELM_RELEASE}-postgres -n lifecycle-app -o jsonpath='{.data.POSTGRES_USER_PASSWORD}' | base64 -d)\n\n# Run the query\nkubectl exec -it ${HELM_RELEASE}-postgres-0 -n lifecycle-app -- env PGPASSWORD=$PGPASSWORD psql -U lifecycle -d lifecycle -c \"\nUPDATE global_config\nSET config = jsonb_set(\n jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit}',\n COALESCE(config::jsonb->'buildkit', '{}'::jsonb),\n true\n ),\n '{buildkit,endpoint}',\n '\\\"tcp://${HELM_RELEASE}-buildkit.lifecycle-app.svc.cluster.local:1234\\\"'::jsonb,\n true\n),\n\\\"updatedAt\\\" = NOW()\nWHERE key = 'buildDefaults';\"\n```\n\n### Option 2: Direct SQL query\n\nIf you have direct database access, run the following SQL query (replace `` with your actual Helm release name):\n\n```sql\nUPDATE global_config\nSET config = jsonb_set(\n jsonb_set(\n COALESCE(config::jsonb, '{}'::jsonb),\n '{buildkit}',\n COALESCE(config::jsonb->'buildkit', '{}'::jsonb),\n true\n ),\n '{buildkit,endpoint}',\n '\"tcp://-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,\n true\n),\n\"updatedAt\" = NOW()\nWHERE key = 'buildDefaults';\n```\n\n### Refresh Configuration Cache\n\nAfter running either option above, refresh the configuration cache:\n\n```bash\ncurl -X 'PUT' \\\n 'https://app./api/v1/config/cache' \\\n -H 'accept: application/json'\n```\n\nReplace `` with your actual domain (e.g., `0env.com`).\n\n## Create GitHub App\n\nTo create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:\n\n\n Make sure you have admin access to the Github organization or account where\n you want to create the app.\n\n\n- Navigate to your installed Lifecycle app at `https://app./setup` (replace `` with your actual domain. e.g. `https://app.0env.com/setup`).\n \n- Select `Personal` or `Organization` based on your needs.\n- Fill in the required fields:\n\n - **Github App Name**: A name for your app. (should be unique, use a prefix with your name or organization. Refer Github app naming convention [here](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/)\n - **Organization Name**: Github organization name where the app will be created. Required if you selected `Organization`.\n\n- Click `Create App`\n- On the Github app creation page, confirm the app name and click `Create`\n- Once the app is created, you will be redirected to the app installation page where you can choose one or more repositories to install the the newly minted app.\n\n \n Make sure to select the repositories you want the app to have access to. You\n can always change this later in the app settings but **adding atleast one\n repository is required to proceed with the setup**.\n \n\n \n\n- Voila! 🎉 Your Github app is now created and installed.\n\n\n\n- Click `Configure and Restart` to apply the changes and start using the app.\n\n\n The step above, sets up the global config values that Lifecycle app will use\n creating ephemeral environments and processing pull requests. And restarts the\n `deployment` for the github app secrets to take effect.\n\n\n---\n\nLet's move on the final step where we will configure the Lifecycle app config for processing pull requests and creating ephemeral environments.", }, { title: "Deploy Issues", diff --git a/src/pages/docs/setup/create-github-app.mdx b/src/pages/docs/setup/create-github-app.mdx index 771d8b7..7a67fad 100644 --- a/src/pages/docs/setup/create-github-app.mdx +++ b/src/pages/docs/setup/create-github-app.mdx @@ -10,46 +10,64 @@ tags: import { Callout } from "nextra/components"; import { Image } from "@lifecycle-docs/components"; -To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps: - ## Configure BuildKit Endpoint Before creating the GitHub app, you need to configure the BuildKit endpoint in the database: - Replace `my-lifecycle` in the commands below with your actual Helm release - name before running them. + Set the `HELM_RELEASE` environment variable to your actual Helm release name + before running the commands below. + + + + The following commands will create the `buildkit` object and `endpoint` + configuration if they don't exist, or update them if they do. ### Option 1: Using kubectl exec with psql -Execute the following command to connect to the PostgreSQL pod and run the query: +Execute the following commands to connect to the PostgreSQL pod and run the query: ```bash -kubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c " +# Set your Helm release name (replace with your actual release name) +export HELM_RELEASE= + +# Get the database password from the secret +export PGPASSWORD=$(kubectl get secret ${HELM_RELEASE}-postgres -n lifecycle-app -o jsonpath='{.data.POSTGRES_USER_PASSWORD}' | base64 -d) + +# Run the query +kubectl exec -it ${HELM_RELEASE}-postgres-0 -n lifecycle-app -- env PGPASSWORD=$PGPASSWORD psql -U lifecycle -d lifecycle -c " UPDATE global_config SET config = jsonb_set( - COALESCE(config::jsonb, '{}'::jsonb), + jsonb_set( + COALESCE(config::jsonb, '{}'::jsonb), + '{buildkit}', + COALESCE(config::jsonb->'buildkit', '{}'::jsonb), + true + ), '{buildkit,endpoint}', - '\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb, + '\"tcp://${HELM_RELEASE}-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb, true ), \"updatedAt\" = NOW() WHERE key = 'buildDefaults';" ``` -Note: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name. - ### Option 2: Direct SQL query -If you have direct database access, run the following SQL query: +If you have direct database access, run the following SQL query (replace `` with your actual Helm release name): ```sql UPDATE global_config SET config = jsonb_set( - COALESCE(config::jsonb, '{}'::jsonb), + jsonb_set( + COALESCE(config::jsonb, '{}'::jsonb), + '{buildkit}', + COALESCE(config::jsonb->'buildkit', '{}'::jsonb), + true + ), '{buildkit,endpoint}', - '"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234"'::jsonb, + '"tcp://-buildkit.lifecycle-app.svc.cluster.local:1234"'::jsonb, true ), "updatedAt" = NOW() @@ -70,6 +88,8 @@ Replace `` with your actual domain (e.g., `0env.com`). ## Create GitHub App +To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps: + Make sure you have admin access to the Github organization or account where you want to create the app.