|
| 1 | +# Development Guide: feast-java |
| 2 | +> The higher level [Development Guide](https://docs.feast.dev/contributing/development-guide) |
| 3 | +> gives contributing to Feast codebase as a whole. |
| 4 | +
|
| 5 | +### Overview |
| 6 | +This guide is targeted at developers looking to contribute to Feast components in |
| 7 | +the feast-java Repository: |
| 8 | +- [Feast Core](#feast-core) |
| 9 | +- [Feast Serving](#feast-serving) |
| 10 | +- [Feast Java Client](#feast-java-client) |
| 11 | + |
| 12 | +> Don't see the Feast component that you want to contribute to here? |
| 13 | +> Check out the [Development Guide](https://docs.feast.dev/contributing/development-guide) |
| 14 | +> to learn how Feast components are distributed over multiple repositories. |
| 15 | +
|
| 16 | +#### Common Setup |
| 17 | +Common Environment Setup for all feast-java Feast components: |
| 18 | +1. feast-java contains submodules that need to be updated: |
| 19 | +```sh |
| 20 | +git submodule init |
| 21 | +git submodule update --recursive |
| 22 | +``` |
| 23 | +2. Ensure following development tools are installed: |
| 24 | +- Java SE Development Kit 11, Maven 3.6, `make` |
| 25 | + |
| 26 | +#### Code Style |
| 27 | +feast-java's codebase conforms to the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html). |
| 28 | + |
| 29 | +Automatically format the code to conform the style guide by: |
| 30 | + |
| 31 | +```sh |
| 32 | +# formats all code in the feast-java repository |
| 33 | +mvn spotless:apply |
| 34 | +``` |
| 35 | + |
| 36 | +> If you're using IntelliJ, you can import these [code style settings](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml) |
| 37 | +> if you'd like to use the IDE's reformat function. |
| 38 | +
|
| 39 | +#### Project Makefile |
| 40 | +The Project Makefile provides useful shorthands for common development tasks: |
| 41 | + |
| 42 | + |
| 43 | +Run all Unit tests: |
| 44 | +``` |
| 45 | +make test-java |
| 46 | +``` |
| 47 | + |
| 48 | +Run all Integration tests: |
| 49 | +``` |
| 50 | +make test-java-integration |
| 51 | +``` |
| 52 | + |
| 53 | +Building Docker images for Feast Core & Feast Serving: |
| 54 | +``` |
| 55 | +make build-docker REGISTRY=gcr.io/kf-feast VERSION=develop |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | +## Feast Core |
| 60 | +### Environment Setup |
| 61 | +Setting up your development environment for Feast Core: |
| 62 | +1. Complete the feast-java [Common Setup](#common-setup) |
| 63 | +2. Boot up a PostgreSQL instance (version 11 and above). Example of doing so via Docker: |
| 64 | +```sh |
| 65 | +# spawn a PostgreSQL instance as a Docker container running in the background |
| 66 | +docker run \ |
| 67 | + --rm -it -d \ |
| 68 | + --name postgres \ |
| 69 | + -e POSTGRES_DB=postgres \ |
| 70 | + -e POSTGRES_USER=postgres \ |
| 71 | + -e POSTGRES_PASSWORD=password \ |
| 72 | + -p 5432:5432 postgres:12-alpine |
| 73 | +``` |
| 74 | + |
| 75 | +### Configuration |
| 76 | +Feast Core is configured using it's [application.yml](https://docs.feast.dev/reference/configuration-reference#1-feast-core-and-feast-online-serving). |
| 77 | + |
| 78 | +### Building and Running |
| 79 | +1. Build / Compile Feast Core with Maven to produce an executable Feast Core JAR |
| 80 | +```sh |
| 81 | +mvn package -pl core --also-make -Dmaven.test.skip=true |
| 82 | +``` |
| 83 | + |
| 84 | +2. Run Feast Core using the built JAR: |
| 85 | +```sh |
| 86 | +# where X.X.X is the version of the Feast Core JAR built |
| 87 | +java -jar core/target/feast-core-X.X.X-exec.jar |
| 88 | +``` |
| 89 | + |
| 90 | +### Unit / Integration Tests |
| 91 | +Unit & Integration Tests can be used to verify functionality: |
| 92 | +```sh |
| 93 | +# run unit tests |
| 94 | +mvn test -pl core --also-make |
| 95 | +# run integration tests |
| 96 | +mvn verify -pl core --also-make |
| 97 | +``` |
| 98 | + |
| 99 | +## Feast Serving |
| 100 | +### Environment Setup |
| 101 | +Setting up your development environment for Feast Serving: |
| 102 | +1. Complete the feast-java [Common Setup](#common-setup) |
| 103 | +2. Boot up a Redis instance (version 5.x). Example of doing so via Docker: |
| 104 | +```sh |
| 105 | +docker run --name redis --rm -it -d -p 6379:6379 redis:5-alpine |
| 106 | +``` |
| 107 | + |
| 108 | +> Feast Serving requires a running Feast Core instance to retrieve Feature metadata |
| 109 | +> in order to serve features. See the [Feast Core section](#feast-core) for |
| 110 | +> how to get a Feast Core instance running. |
| 111 | + |
| 112 | +### Configuration |
| 113 | +Feast Serving is configured using it's [application.yml](https://docs.feast.dev/reference/configuration-reference#1-feast-core-and-feast-online-serving). |
| 114 | + |
| 115 | +### Building and Running |
| 116 | +1. Build / Compile Feast Serving with Maven to produce an executable Feast Serving JAR |
| 117 | +```sh |
| 118 | +mvn package -pl serving --also-make -Dmaven.test.skip=true |
| 119 | + |
| 120 | +2. Run Feast Serving using the built JAR: |
| 121 | +```sh |
| 122 | +# where X.X.X is the version of the Feast serving JAR built |
| 123 | +java -jar serving/target/feast-serving-X.X.X-exec.jar |
| 124 | +``` |
| 125 | + |
| 126 | +### Unit / Integration Tests |
| 127 | +Unit & Integration Tests can be used to verify functionality: |
| 128 | +```sh |
| 129 | +# run unit tests |
| 130 | +mvn test -pl serving --also-make |
| 131 | +# run integration tests |
| 132 | +mvn verify -pl serving --also-make |
| 133 | +``` |
| 134 | + |
| 135 | +## Feast Java Client |
| 136 | +### Environment Setup |
| 137 | +Setting up your development environment for Feast Java SDK: |
| 138 | +1. Complete the feast-java [Common Setup](#common-setup) |
| 139 | + |
| 140 | +> Feast Java Client is a Java Client for retrieving Features from a running Feast Serving instance. |
| 141 | +> See the [Feast Serving Section](#feast-serving) section for how to get a Feast Serving instance running. |
| 142 | + |
| 143 | +### Configuration |
| 144 | +Feast Java Client is [configured as code](https://docs.feast.dev/v/master/reference/configuration-reference#4-feast-java-and-go-sdk) |
| 145 | + |
| 146 | +### Building |
| 147 | +1. Build / Compile Feast Java Client with Maven: |
| 148 | + |
| 149 | +```sh |
| 150 | +mvn package -pl sdk/java --also-make -Dmaven.test.skip=true |
| 151 | +``` |
| 152 | + |
| 153 | +### Unit Tests |
| 154 | +Unit Tests can be used to verify functionality: |
| 155 | + |
| 156 | +```sh |
| 157 | +mvn package -pl sdk/java test --also-make |
| 158 | +``` |
0 commit comments