You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/tutorials/just-in-time-database-access-part1.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ This tutorial will guide you through setting up Just-in-Time (JIT) access using
18
18
This is Part 1 of our tutorial series on implementing Just-in-Time (JIT) access:
19
19
20
20
- Part 1: JIT database access via Bytebase GUI
21
-
- Part 2: [Approve JIT database access via Slack](/docs/tutorials/just-in-time-part2)
21
+
- Part 2: [Approve JIT database access via Slack](/docs/tutorials/just-in-time-database-access-part2)
22
22
- Part 3: Request JIT database access via Slack
23
23
24
24
## Prerequisites
@@ -53,7 +53,7 @@ As a developer user, you will not have the access to query the production databa
53
53
54
54
1. Click `hr_prod`, you will see the SQL Editor icon is greyed out, which means you don't have access to this database in SQL Editor. Even you click **SQL Editor** button on the top bar to navigate to the SQL Editor page, you still don't have access to this database.
## Step 3 - DBA assign you access to the production database (Community and Pro Plan)
59
59
@@ -65,11 +65,11 @@ In Bytebase **Community** and **Pro Plan**, the Admin/DBA can assign you access
65
65
66
66
1. In the **Grant Access** modal, select the `SQL Editor User` role, then set 1 day Expiration, and click **Confirm** button. Here you may notice in Community and Pro Plan, you can only set access to all databases in the project.
1. After the access is granted, login as the developer user again, you should see the SQL Editor icon is no longer greyed out, which means you have access to the production database in SQL Editor. After one day, the access will expire automatically.
1. Click **CI/CD** > **Risk Center** on the left sidebar. Define a High risk policy for `Request Querier Role` which triggers when the environment is `Prod`.
1. Login as the developer user again, then go to SQL Editor page. Click **Connect to a database** or **Select a database to start**. You should see the `hr_prod` and `hr_test` databases listed, click **Request query** to request a JIT access.
1. In the **Request Querier Role** modal, choose **Manually select**, then `employee``salary` and `title` under `hr_prod` database, and click **OK** button. Here you may also specify the expiration time which can be a specific time, or relative time from now.
1. An request issue will be created, switch to the project owner (the admin user), go to **Issue** page, you should see the request issue. Click **Approve** button to approve the request.
1. Switch back to the developer user, go to SQL Editor page, you should be able to query from these three tables. If you query from other tables, you will get errors and suggest to request a JIT access.
1. After the developer user get the access, he can solve the incident. The admin user can revoke the access directly from the **Manage** > **Members** page or wait for the access expiration.
Copy file name to clipboardExpand all lines: content/docs/tutorials/just-in-time-database-access-part2.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,15 @@ estimated_time: '30 mins'
9
9
description: 'In this tutorial, we will demonstrate how to automate JIT access via Slack, utilizing Bytebase webhooks and API'
10
10
---
11
11
12
-
In the [previous tutorial](/docs/tutorials/just-in-time-part1), we demonstrated how to set up JIT access using the Bytebase GUI. In this tutorial, we will cover how to automate JIT access via Slack, utilizing Bytebase webhooks and API.
12
+
In the [previous tutorial](/docs/tutorials/just-in-time-database-access-part1), we demonstrated how to set up JIT access using the Bytebase GUI. In this tutorial, we will cover how to automate JIT access via Slack, utilizing Bytebase webhooks and API.
13
13
14
14
When developers need urgent production database access during incidents but lack permissions, they can request Just-in-Time (JIT) access. By triggering the Bytebase webhook, the DBA will receive a notification in Slack immediately and can approve there.
15
15
16
16
---
17
17
18
18
This is Part 2 of our tutorial series on implementing Just-in-Time (JIT) access:
19
19
20
-
- Part 1: [Grant JIT database access via Bytebase GUI](/docs/tutorials/just-in-time-part1)
20
+
- Part 1: [Grant JIT database access via Bytebase GUI](/docs/tutorials/just-in-time-database-access-part1)
21
21
- Part 2: Approve JIT database access via Slack (this one)
22
22
- Part 3: Request JIT database access via Slack
23
23
@@ -31,7 +31,7 @@ The complete code for this tutorial is available at: [slack-example](https://git
31
31
32
32
</HintBlock>
33
33
34
-
This tutorial skips the Bytebase setup part, if you haven't set up the Bytebase and registered admin and developer users, please follow instructions in the [previous tutorial](/docs/tutorials/just-in-time-part1).
34
+
This tutorial skips the Bytebase setup part, if you haven't set up the Bytebase and registered admin and developer users, please follow instructions in the [previous tutorial](/docs/tutorials/just-in-time-database-access-part1).
35
35
36
36
## Prerequisites
37
37
@@ -49,7 +49,7 @@ Before you begin, make sure you have:
49
49
50
50
## Step 1 - Finished the previous tutorial
51
51
52
-
Make sure you finished the [previous tutorial](/docs/tutorials/just-in-time-part1) and have the Bytebase instance running. Particularly, pay attention to **Step 4**, which is to request JIT access via Bytebase GUI.
52
+
Make sure you finished the [previous tutorial](/docs/tutorials/just-in-time-database-access-part1) and have the Bytebase instance running. Particularly, pay attention to **Step 4**, which is to request JIT access via Bytebase GUI.
53
53
54
54
The `Request role` feature is supported by **Enterprise Plan** which will be needed for this tutorial, other plans only allow the `Assign role` feature which is not enough. You may request a trial from [here](https://www.bytebase.com/contact-us/).
55
55
@@ -67,7 +67,7 @@ The `Request role` feature is supported by **Enterprise Plan** which will be nee
67
67
1. By using VS Code's [Port forwarding](https://code.visualstudio.com/docs/editor/port-forwarding), you can forward the local server's ports:
1. Go to [Slack apps](https://api.slack.com/apps) and click **Create New App**.
86
86
1. Choose **From scratch**, enter the **App name**, and select your **Workspace**.
87
87
1. Go to **OAuth & Permissions** and add the following permissions under **Scopes**:
88
-
-`chat:write`
89
-
-`chat:write.public`
88
+
-`chat:write` (send message)
89
+
-`channels:read` (read channel id for public channel)
90
+
-`groups:read` (read channel id for private channel)
90
91
1. Scroll up to **OAuth Tokens**, click **Install to YOUR_WORKSPACE**, and authorize the app.
91
92
1. Copy the **Bot User OAuth Token** and paste it into the `.env.local` file as **SLACK_BOT_TOKEN**.
92
93
1. Choose a channel and invite the bot to the channel by typing `/invite @YOUR_BOT_NAME`.
93
-
1. Get the **Channel ID** via copying the channel link and extracting the ID from the URL. Copy and paste it into the `.env.local` file as **SLACK_CHANNEL_ID**.
94
94
1. Go to **Interactivity & Shortcuts** in app settings, turn on **Interactivity** and add the **Request URL**: `YOUR_3000_FORWARDED_URL/api/slack/interact`. Click **Save Changes**.
95
95
96
96
## Step 6 - Verify the workflow
@@ -100,24 +100,24 @@ Now, everything is ready, let's verify the workflow:
100
100
1. Go to Bytebase, log in as the developer and go into the `Sample Project`.
101
101
1. By default, the developer has no permission to access the database. Click **Manage > Members** and you'll see the devloper only has **Project Developer** role. If you go to **SQL Editor**, you'll see the `hr_prod` database is not accessible.
102
102
1. Click **Database > databases**, select the `hr_prod` database, and click **Request Querier role**.
0 commit comments