+ 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.",
0 commit comments