Skip to content

Commit c613115

Browse files
author
Shu Heng
committed
Add batch serving functionality to docker compose setup
1 parent e6b5a00 commit c613115

16 files changed

Lines changed: 629 additions & 101 deletions

docs/getting-started/installing-feast.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,32 @@ A docker compose file is provided to quickly test Feast with official docker ima
2020
* Retrieve features for online serving
2121
* Updating the feature set
2222

23+
The docker compose setup uses Direct Runner for the Apache Beam jobs.
24+
2325
### 0. Requirements
2426

2527
1. [Docker compose](https://docs.docker.com/compose/install/) should be installed.
26-
2. Port 6565, 6566 and 8888 are not in used. Otherwise, modify the port mappings in `infra/docker-compose/docker-compose.yml` to use unoccupied ports.
28+
2. Port 6565, 6566 and 8888, 9094 are not in used. Otherwise, modify the port mappings in `infra/docker-compose/docker-compose.yml` to use unoccupied ports.
29+
3. For batch serving, you will also need a service account key that has access to GCS and BigQuery. Port 6567 will be used for the batch serving endpoint.
2730

28-
### 1. Step-by-step guide
31+
### 1. Step-by-step guide (Online serving)
2932
1. Navigate to `infra/docker-compose`.
3033
2. Copy `.env.sample` to `.env`.
3134
3. `docker-compose up -d`
3235
4. A jupyter notebook server should be accessible via `localhost:8888`
3336
5. Please wait a minute or two for the Feast services to be ready before running the notebook. You will know that the services are ready when port `6565` and `6566` starts listening.
3437

38+
### 2. Step-by-step guide (Batch serving)
39+
1. Navigate to `infra/docker-compose`.
40+
2. Copy `.env.sample` to `.env`.
41+
3. Copy your GCP account service key(s) to `infra/docker-compose/gcp-service-accounts`.
42+
4. Modify the value of `FEAST_<SERVICE_NAME>_GCP_SERVICE_ACCOUNT_KEY` in your `.env` file. It should be the json file name without extension.
43+
5. Modify the value of `infra/docker-compose/serving/bq-store.yml`. Alternatively, you can also point to a different store configuration file by modifying `FEAST_BATCH_STORE_CONFIG` in your `.env` file.
44+
5. `docker-compose -f docker-compose.yml -f docker-compose.batch.yml up -d`
45+
6. A jupyter notebook server should be accessible via `localhost:8888`
46+
7. Please wait a minute or two for the Feast services to be ready before running the notebook. You will know that the services are ready when port `6565` and `6567` starts listening.
47+
8. When you are done, run `docker-compose -f docker-compose.yml -f docker-compose.batch.yml down` to shutdown the services.
48+
3549
## Minikube
3650

3751
### Overview

infra/docker-compose/.env.sample

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
COMPOSE_PROJECT_NAME=feast
22

33
FEAST_VERSION=latest
4-
FEAST_GCP_SERVICE_ACCOUNT_KEY_PATH=/etc/gcloud/service-accounts/key.json
54

65
FEAST_CORE_IMAGE=gcr.io/kf-feast/feast-core
7-
FEAST_CORE_CONFIG=override
8-
FEAST_CORE_CONFIG_PATH=/etc/feast/feast-core/override.yaml
6+
FEAST_CORE_CONFIG=direct-runner
97
FEAST_CORE_GCP_SERVICE_ACCOUNT_KEY=placeholder
108

119
FEAST_SERVING_IMAGE=gcr.io/kf-feast/feast-serving
12-
FEAST_SERVING_STORE_CONFIG=redis-store
13-
FEAST_SERVING_STORE_CONFIG_PATH=/etc/feast/feast-serving/store.yaml
14-
FEAST_SERVING_GCP_SERVICE_ACCOUNT_KEY=placeholder
10+
FEAST_ONLINE_SERVING_CONFIG=online-serving
11+
FEAST_ONLINE_STORE_CONFIG=redis-store
12+
FEAST_BATCH_SERVING_CONFIG=batch-serving
13+
FEAST_BATCH_STORE_CONFIG=bq-store
14+
FEAST_BATCH_SERVING_GCP_SERVICE_ACCOUNT_KEY=placeholder
15+
FEAST_JOB_STAGING_LOCATION=gs://your-gcp-project/bucket
16+
17+
FEAST_JUPYTER_IMAGE=gcr.io/kf-feast/feast-jupyter
18+
FEAST_JUPYTER_GCP_SERVICE_ACCOUNT_KEY=placeholder
1519

16-
FEAST_JUPYTER_IMAGE=gcr.io/kf-feast/feast-jupyter
File renamed without changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "3.7"
2+
3+
services:
4+
batch-serving:
5+
image: ${FEAST_SERVING_IMAGE}:${FEAST_VERSION}
6+
volumes:
7+
- ./serving/${FEAST_BATCH_SERVING_CONFIG}.yml:/etc/feast/application.yml
8+
- ./serving/${FEAST_BATCH_STORE_CONFIG}.yml:/etc/feast/store.yml
9+
- ./gcp-service-accounts/${FEAST_BATCH_SERVING_GCP_SERVICE_ACCOUNT_KEY}.json:/etc/gcloud/service-accounts/key.json
10+
depends_on:
11+
- core
12+
- redis
13+
ports:
14+
- 6567:6567
15+
restart: on-failure
16+
environment:
17+
GOOGLE_APPLICATION_CREDENTIALS: /etc/gcloud/service-accounts/key.json
18+
FEAST_JOB_STAGING_LOCATION: ${FEAST_JOB_STAGING_LOCATION}
19+
command:
20+
- "java"
21+
- "-Xms1024m"
22+
- "-Xmx1024m"
23+
- "-jar"
24+
- "/opt/feast/feast-serving.jar"
25+
- "--spring.config.location=classpath:/application.yml,file:/etc/feast/application.yml"

infra/docker-compose/docker-compose.dev.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

infra/docker-compose/docker-compose.e2e.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

infra/docker-compose/docker-compose.override.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

infra/docker-compose/docker-compose.yml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ version: "3.7"
22

33
services:
44
core:
5+
image: ${FEAST_CORE_IMAGE}:${FEAST_VERSION}
56
volumes:
6-
- ./core/${FEAST_CORE_CONFIG}.yml:${FEAST_CORE_CONFIG_PATH}
7-
- ./gcp-service-accounts/${FEAST_CORE_GCP_SERVICE_ACCOUNT_KEY}.json:${FEAST_GCP_SERVICE_ACCOUNT_KEY_PATH}
7+
- ./core/${FEAST_CORE_CONFIG}.yml:/etc/feast/application.yml
8+
- ./gcp-service-accounts/${FEAST_CORE_GCP_SERVICE_ACCOUNT_KEY}.json:/etc/gcloud/service-accounts/key.json
89
environment:
910
DB_HOST: db
10-
GOOGLE_APPLICATION_CREDENTIALS: ${FEAST_GCP_SERVICE_ACCOUNT_KEY_PATH}
11+
GOOGLE_APPLICATION_CREDENTIALS: /etc/gcloud/service-accounts/key.json
12+
restart: on-failure
1113
depends_on:
1214
- db
1315
- kafka
@@ -17,34 +19,38 @@ services:
1719
- java
1820
- -jar
1921
- /opt/feast/feast-core.jar
20-
- --spring.config.location=classpath:/application.yml,file:${FEAST_CORE_CONFIG_PATH}
21-
restart: on-failure
22+
- --spring.config.location=classpath:/application.yml,file:/etc/feast/application.yaml
2223

23-
serving:
24+
online-serving:
25+
image: ${FEAST_SERVING_IMAGE}:${FEAST_VERSION}
2426
volumes:
25-
- ./serving/${FEAST_SERVING_STORE_CONFIG}.yml:${FEAST_SERVING_STORE_CONFIG_PATH}
26-
- ./gcp-service-accounts/${FEAST_CORE_GCP_SERVICE_ACCOUNT_KEY}.json:${FEAST_GCP_SERVICE_ACCOUNT_KEY_PATH}
27-
environment:
28-
FEAST_CORE_HOST: core
29-
FEAST_STORE_CONFIG_PATH: ${FEAST_SERVING_STORE_CONFIG_PATH}
30-
GOOGLE_APPLICATION_CREDENTIALS: ${FEAST_GCP_SERVICE_ACCOUNT_KEY_PATH}
27+
- ./serving/${FEAST_ONLINE_SERVING_CONFIG}.yml:/etc/feast/application.yml
28+
- ./serving/${FEAST_ONLINE_STORE_CONFIG}.yml:/etc/feast/store.yml
3129
depends_on:
3230
- core
3331
- redis
3432
ports:
3533
- 6566:6566
3634
restart: on-failure
35+
command:
36+
- java
37+
- -jar
38+
- /opt/feast/feast-serving.jar
39+
- --spring.config.location=classpath:/application.yml,file:/etc/feast/application.yml
3740

3841
jupyter:
42+
image: ${FEAST_JUPYTER_IMAGE}:${FEAST_VERSION}
3943
volumes:
4044
- ./jupyter/notebooks:/home/jovyan/feast-notebooks
4145
- ./jupyter/features:/home/jovyan/features
46+
- ./gcp-service-accounts/${FEAST_JUPYTER_GCP_SERVICE_ACCOUNT_KEY}.json:/etc/gcloud/service-accounts/key.json
4247
depends_on:
4348
- core
44-
- serving
49+
- online-serving
4550
environment:
46-
FEAST_SERVING_URL: serving:6566
4751
FEAST_CORE_URL: core:6565
52+
FEAST_SERVING_URL: online-serving:6566
53+
GOOGLE_APPLICATION_CREDENTIALS: /etc/gcloud/service-accounts/key.json
4854
ports:
4955
- 8888:8888
5056
command:
@@ -56,11 +62,16 @@ services:
5662

5763
kafka:
5864
image: confluentinc/cp-kafka:5.2.1
59-
restart: on-failure
6065
environment:
6166
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
62-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
6367
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
68+
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:9092,OUTSIDE://localhost:9094
69+
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9094
70+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
71+
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
72+
ports:
73+
- 9094:9092
74+
6475
depends_on:
6576
- zookeeper
6677

@@ -70,4 +81,4 @@ services:
7081
ZOOKEEPER_CLIENT_PORT: 2181
7182

7283
db:
73-
image: postgres:12-alpine
84+
image: postgres:12-alpine

0 commit comments

Comments
 (0)