Skip to content

Commit 146b7c0

Browse files
committed
update
1 parent 7b57b22 commit 146b7c0

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

src/lib/static/blogcontent/blogcontent.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"description": null,
8282
"date": null,
8383
"path": "docs/setup/create-github-app",
84-
"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."
84+
"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."
8585
},
8686
{
8787
"title": "Deploy Issues",

src/lib/static/blogcontent/blogcontent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const blogContent = [
8585
description: null,
8686
date: null,
8787
path: "docs/setup/create-github-app",
88-
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.",
88+
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.",
8989
},
9090
{
9191
title: "Deploy Issues",

src/pages/docs/setup/create-github-app.mdx

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,64 @@ tags:
1010
import { Callout } from "nextra/components";
1111
import { Image } from "@lifecycle-docs/components";
1212

13-
To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:
14-
1513
## Configure BuildKit Endpoint
1614

1715
Before creating the GitHub app, you need to configure the BuildKit endpoint in the database:
1816

1917
<Callout type="warning">
20-
Replace `my-lifecycle` in the commands below with your actual Helm release
21-
name before running them.
18+
Set the `HELM_RELEASE` environment variable to your actual Helm release name
19+
before running the commands below.
20+
</Callout>
21+
22+
<Callout type="info">
23+
The following commands will create the `buildkit` object and `endpoint`
24+
configuration if they don't exist, or update them if they do.
2225
</Callout>
2326

2427
### Option 1: Using kubectl exec with psql
2528

26-
Execute the following command to connect to the PostgreSQL pod and run the query:
29+
Execute the following commands to connect to the PostgreSQL pod and run the query:
2730

2831
```bash
29-
kubectl exec -it my-lifecycle-postgres-0 -- psql -U lifecycle -d lifecycle -c "
32+
# Set your Helm release name (replace with your actual release name)
33+
export HELM_RELEASE=<YOUR-HELM-RELEASE>
34+
35+
# Get the database password from the secret
36+
export PGPASSWORD=$(kubectl get secret ${HELM_RELEASE}-postgres -n lifecycle-app -o jsonpath='{.data.POSTGRES_USER_PASSWORD}' | base64 -d)
37+
38+
# Run the query
39+
kubectl exec -it ${HELM_RELEASE}-postgres-0 -n lifecycle-app -- env PGPASSWORD=$PGPASSWORD psql -U lifecycle -d lifecycle -c "
3040
UPDATE global_config
3141
SET config = jsonb_set(
32-
COALESCE(config::jsonb, '{}'::jsonb),
42+
jsonb_set(
43+
COALESCE(config::jsonb, '{}'::jsonb),
44+
'{buildkit}',
45+
COALESCE(config::jsonb->'buildkit', '{}'::jsonb),
46+
true
47+
),
3348
'{buildkit,endpoint}',
34-
'\"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,
49+
'\"tcp://${HELM_RELEASE}-buildkit.lifecycle-app.svc.cluster.local:1234\"'::jsonb,
3550
true
3651
),
3752
\"updatedAt\" = NOW()
3853
WHERE key = 'buildDefaults';"
3954
```
4055

41-
Note: `my-lifecycle-postgres-0` is the pod name where `my-lifecycle` is your Helm release name.
42-
4356
### Option 2: Direct SQL query
4457

45-
If you have direct database access, run the following SQL query:
58+
If you have direct database access, run the following SQL query (replace `<YOUR-HELM-RELEASE>` with your actual Helm release name):
4659

4760
```sql
4861
UPDATE global_config
4962
SET config = jsonb_set(
50-
COALESCE(config::jsonb, '{}'::jsonb),
63+
jsonb_set(
64+
COALESCE(config::jsonb, '{}'::jsonb),
65+
'{buildkit}',
66+
COALESCE(config::jsonb->'buildkit', '{}'::jsonb),
67+
true
68+
),
5169
'{buildkit,endpoint}',
52-
'"tcp://my-lifecycle-buildkit.lifecycle-app.svc.cluster.local:1234"'::jsonb,
70+
'"tcp://<YOUR-HELM-RELEASE>-buildkit.lifecycle-app.svc.cluster.local:1234"'::jsonb,
5371
true
5472
),
5573
"updatedAt" = NOW()
@@ -70,6 +88,8 @@ Replace `<your_domain>` with your actual domain (e.g., `0env.com`).
7088

7189
## Create GitHub App
7290

91+
To create a Github app that will send events to the Lifecycle with necessary permissions, follow these steps:
92+
7393
<Callout type="info">
7494
Make sure you have admin access to the Github organization or account where
7595
you want to create the app.

0 commit comments

Comments
 (0)