Skip to content

Commit 24a1b16

Browse files
committed
Update docker and CI configs
1 parent 50e9dca commit 24a1b16

File tree

9 files changed

+51
-26
lines changed

9 files changed

+51
-26
lines changed

.dockerignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.idea
2-
node_modules
3-
docker-compose.*
1+
**/.idea
2+
**/node_modules
3+
**/docker-compose.*
44
.dockerignore

.env.docker.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ CLIENT_PORT_APP_ROUTER=4400
66
CLIENT_PORT_PAGES_ROUTER=4401
77

88
WATCH="false"
9+
10+
# for development
11+
# MB_RUN_MODE="dev"
12+
# METASTORE_DEV_SERVER_URL=""

.github/workflows/e2e-tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
timeout-minutes: 10
1818
name: e2e-tests
1919
env:
20-
PREMIUM_EMBEDDING_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
20+
PREMIUM_EMBEDDING_TOKEN: ${{ secrets.STAGING_MB_ALL_FEATURES_TOKEN }}
21+
MB_RUN_MODE: dev
22+
METASTORE_DEV_SERVER_URL: ${{ secrets.METASTORE_DEV_SERVER_URL }}
2123
permissions:
2224
id-token: write
2325
contents: read
@@ -28,8 +30,7 @@ jobs:
2830
- name: Run Sample App in Docker
2931
run: |
3032
cp .env.docker.example .env.docker &&
31-
npm run docker:up -- -d &&
32-
while ! nc -z localhost 4400; do sleep 1; done
33+
npm run docker:e2e:up -- --wait
3334
3435
- name: Install Chrome v111
3536
uses: browser-actions/setup-chrome@v1

docker-compose.local-dist.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
metabase:
3+
volumes:
4+
- type: bind
5+
source: ./local-dist/metabase.jar
6+
target: /app/metabase.jar
7+
read_only: true
8+
bind:
9+
create_host_path: false

docker-compose.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
services:
22
metabase:
3-
build:
4-
context: .
5-
dockerfile: metabase/Dockerfile
3+
image: metabase/metabase-enterprise:v1.55.x
64
environment:
7-
MB_CONFIG_FILE_PATH: "./app/init-config.yml"
5+
MB_CONFIG_FILE_PATH: "./app/config.yml"
86
MB_JETTY_PORT: "${MB_PORT}"
97
MB_EDITION: "ee"
108
MB_SITE_URL: "http://localhost:${MB_PORT}/"
119
MB_JWT_SHARED_SECRET: "${METABASE_JWT_SHARED_SECRET}"
1210
MB_SETUP_TOKEN: "${PREMIUM_EMBEDDING_TOKEN}"
1311
MB_PREMIUM_EMBEDDING_TOKEN: "${PREMIUM_EMBEDDING_TOKEN}"
12+
MB_RUN_MODE: "${MB_RUN_MODE}"
13+
METASTORE_DEV_SERVER_URL: "${METASTORE_DEV_SERVER_URL}"
1414
MB_JWT_IDENTITY_PROVIDER_URI: "http://localhost:${AUTH_PROVIDER_PORT}/sso/metabase"
1515
healthcheck:
1616
test: curl --fail -X GET -I "http://localhost:${MB_PORT}/api/health" || exit 1
@@ -19,6 +19,8 @@ services:
1919
retries: 10
2020
ports:
2121
- "${MB_PORT}:${MB_PORT}"
22+
volumes:
23+
- ./metabase/config.yml:/app/config.yml
2224

2325
next-sample-app-router:
2426
depends_on:
@@ -38,6 +40,11 @@ services:
3840
NEXT_PUBLIC_METABASE_INSTANCE_URL: "http://localhost:${MB_PORT}"
3941
METABASE_INSTANCE_URL: "http://metabase:${MB_PORT}"
4042
METABASE_JWT_SHARED_SECRET: "${METABASE_JWT_SHARED_SECRET}"
43+
healthcheck:
44+
test: curl --fail -X GET -I "http://localhost:${CLIENT_PORT_APP_ROUTER}/" || exit 1
45+
interval: 2s
46+
timeout: 2s
47+
retries: 5
4148
ports:
4249
- "${CLIENT_PORT_APP_ROUTER}:${CLIENT_PORT_APP_ROUTER}"
4350
volumes:
@@ -51,7 +58,7 @@ services:
5158
context: .
5259
dockerfile: ./next-sample-pages-router/Dockerfile
5360
args:
54-
PORT: "${CLIENT_PORT_APP_ROUTER}"
61+
PORT: "${CLIENT_PORT_PAGES_ROUTER}"
5562
NEXT_PUBLIC_METABASE_INSTANCE_URL: "http://localhost:${MB_PORT}"
5663
METABASE_INSTANCE_URL: "http://metabase:${MB_PORT}"
5764
METABASE_JWT_SHARED_SECRET: "${METABASE_JWT_SHARED_SECRET}"
@@ -61,6 +68,11 @@ services:
6168
NEXT_PUBLIC_METABASE_INSTANCE_URL: "http://localhost:${MB_PORT}"
6269
METABASE_INSTANCE_URL: "http://metabase:${MB_PORT}"
6370
METABASE_JWT_SHARED_SECRET: "${METABASE_JWT_SHARED_SECRET}"
71+
healthcheck:
72+
test: curl --fail -X GET -I "http://localhost:${CLIENT_PORT_PAGES_ROUTER}/" || exit 1
73+
interval: 2s
74+
timeout: 2s
75+
retries: 5
6476
ports:
6577
- "${CLIENT_PORT_PAGES_ROUTER}:${CLIENT_PORT_PAGES_ROUTER}"
6678
volumes:

metabase/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.
File renamed without changes.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"scripts": {
66
"start": "npm run docker:up",
77
"docker:up": "docker compose --env-file .env.docker up",
8-
"docker:down": "docker compose --env-file .env.docker down --rmi all --volumes"
8+
"docker:e2e:up": "yarn docker:up",
9+
"docker:local-dist:up": "docker compose -f docker-compose.yml -f docker-compose.local-dist.yml --env-file .env.docker up",
10+
"docker:down": "docker compose --env-file .env.docker down",
11+
"docker:rm": "yarn docker:down --rmi all --volumes"
912
}
1013
}

readme.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ This option should be used if you don't want to test Metabase Embedding SDK with
3131

3232
From the root directory:
3333
- Copy `.env.docker.example` to `.env.docker` and replace `<your_enterprise_token>` with your premium embedding token
34-
- Start all services in Docker with `yarn start`
34+
- Start all services in Docker with `yarn docker:up`
3535

3636
It will:
37-
- poll a Metabase image and run it
38-
- build and run both `next-sample-app-router` and `next-sample-pages-router` apps
37+
- Poll a Metabase image and run it
38+
- Build and run containers with both `next-sample-app-router` and `next-sample-pages-router` apps and run it
3939

4040
The pages router sample will start on port 4401 and the app router sample will start on port 4400.
4141

42+
#### Local development (For Metabase developers)
43+
44+
- To run containers with a locally built `metabase.jar`, copy it to the `./local-dist` folder as `./local-dist/metabase.jar`.
45+
- To run containers with a locally built Embedding SDK package, copy it to the `./local-dist` folder as `./local-dist/embedding-sdk`.
46+
- Run `yarn docker:local-dist:up` to start containers and use locally built dist from the `./local-dist` folder.
47+
- To remove containers and images completely run `yarn docker:rm`.
48+
4249
## Authentication
4350

4451
Both apps provide an endpoint for user authentication, replace the logic to match your authentication system.

0 commit comments

Comments
 (0)