Skip to content

Commit ebd143d

Browse files
Merge pull request #4 from metabase/readme-update
readme updates
2 parents 64f5ff1 + abc1d52 commit ebd143d

File tree

1 file changed

+99
-20
lines changed

1 file changed

+99
-20
lines changed

README.md

+99-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,107 @@
1-
# Metabase Node.js Interactive Embedding Sample
1+
# Metabase Node.js interactive embedding sample
22

3-
This is the sample code for the Metabase Node.js Interactive Embedding Quickstart.
3+
Sample code for the Metabase Node.js Interactive Embedding Quickstart LINK.
44

5-
Please check out the code for an example of how to integrate interactive embedding into your Node.js applications.
5+
You'll need a paid version of Metabase up and running. If you're not sure where to start, sign up for Metabase Cloud: Pro. LINK.
66

7-
## What is Metabase?
7+
## Set up your Metabase
88

9-
## Running the sample code
10-
1. Make sure you have updated enabled JWT for SSO under admin settings, and you have entered your app's SSO endpoint as the JWT Identity Provider URI. The path is `/sso/metabase`, e.g. `http://localhost:8080/sso/`metabase
11-
2. Make sure you define the following env vars defined:
12-
** `export METABASE_SITE_URL="https://myapp.metabaseapp.com"` - the root path of your Metabase instance,
13-
** `export METABASE_JWT_SHARED_SECRET="COPY_SECRET_FROM_JWT_CONFIG"` - you grab this from the SSO JWT config in admin settings
14-
3. Create a dashboard using X-ray on the invoices table in the sample dataset. If the ID is not 1, then update `METABASE_DASHBOARD_PATH` in `index.js`.
15-
3. Start the sample with `node index.js`. It runs by default on port 8080.
16-
4. Hit http://localhost:8080, sign in and hit `/analytics` with both users to populate them to Metabase.
17-
5. Create groups `Customer Acme` and `Customer Fake` and configure permissions so they can access the collection in which the dashboard is located. Also, setup data sandboxing on the Invoices table filtering on `accountId`.
18-
6. Under SSO then activate group membership syncing and map `Customer-Acme` and `Customer-Fake` to the groups you've created.
19-
7. You should be able to sign in with the two users and see the dashboard. If not, check the collection permissions for their respective groups.
20-
8. Both users should be able to see the same dashboard but with different data, beacuse of sandboxing.
9+
### Create a dashboard
2110

22-
## Create a free Metabase trial
11+
In the left nav, go to **Browse data** > **Sample Database**. Hover over the `Invoices` table and click on the lightning bolt to X-ray the table.
2312

24-
* For interactive embedding, you will need a Pro or Enterprise plan.
25-
* You can sign up for a free trial at https://store.metabase.com/checkout
13+
Click the button to **Save this** as a dashboard. Metabase will save this dashboard in the collection called "Automatically generated dashboards".
14+
15+
Visit that dashboard in the "Automatically generated dashboards" and make a note of its URL. If it's the first dashboard you created, it's probably `/dashboard/1` followed by a description.
16+
17+
### Enable SSO with JWT
18+
19+
From any Metabase page, click on the **gear** icon in the upper right and select **Admin Settings** > **Settings** > **Authentication**.
20+
21+
On the card that says **JWT**, click the **Setup** button.
22+
23+
### JWT Identity provider URI
24+
25+
In **JWT IDENTITY PROVIDER URI** field, paste `localhost:8080/login`.
26+
27+
### String used by the JWT signing key
28+
29+
Click the **Generate key** button. Copy the key.
30+
31+
## Running the server
32+
33+
### Install packages
34+
35+
Run:
36+
37+
```sh
38+
npm install
39+
```
40+
41+
### Set environment variables
42+
43+
You'll need to set some environment variables for your server.
44+
45+
- [METABASE_SITE_URL](#metabase_site_url)
46+
- [METABASE_JWT_SHARED_SECRET](#metabase_jwt_shared_secret)
47+
- [METABASE_DASHBOARD_PATH](#)
48+
49+
### METBASE_SITE_URL
50+
51+
```sh
52+
export METABASE_SITE_URL="https://myapp.metabaseapp.com"
53+
```
54+
55+
Replacing "https://myapp.metabaseapp.com" with the root path of your Metabase.
56+
57+
### METABASE_JWT_SHARED_SECRET
58+
59+
```sh
60+
export METABASE_JWT_SHARED_SECRET="COPY_SECRET_FROM_JWT_CONFIG"
61+
```
62+
You can get this key from your Metabase by clicking on the **gear** icon and going to **Admin Settings** > **Settings** > **Authentication** > **JWT**.
63+
64+
### METABASE_DASHBOARD_PATH
65+
66+
If the dashboard you created above doesn't have an ID of 1, you'll also need to update the path:
67+
68+
```sh
69+
export METABASE_DASHBOARD_PATH=`/dashboard/id`
70+
```
71+
72+
Replacing `id` with the ID number of your dashboard.
73+
74+
## Starting the app
75+
76+
Start the server by running:
77+
78+
```sh
79+
node index.js
80+
```
81+
82+
The app runs by default on port 8080.
83+
84+
Visit [http://localhost:8080/analytics](localhost:8080/analytics) and sign in with the following credentials:
85+
86+
```sh
87+
88+
password: foobar
89+
```
90+
91+
## Set up groups
92+
93+
TODO
94+
95+
Create groups `Customer Acme` and `Customer Fake` and configure permissions so they can access the collection in which the dashboard is located. Also, setup data sandboxing on the Invoices table filtering on `accountId`.
96+
97+
Under SSO then activate group membership syncing and map `Customer-Acme` and `Customer-Fake` to the groups you've created.
98+
8. You should be able to sign in with the two users and see the dashboard. If not, check the collection permissions for their respective groups.
99+
100+
## Set up sandboxing
101+
102+
TODO
103+
104+
Both users should be able to see the same dashboard but with different data, beacuse of sandboxing.
26105

27106
## Reporting issues
28107

@@ -34,4 +113,4 @@ Please report bugs or feature requests as issues in this reporsitory. Please do
34113

35114
## License
36115

37-
This project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.
116+
This project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.

0 commit comments

Comments
 (0)