Skip to content

Commit 79c9529

Browse files
committed
Quick Start
1 parent 222239b commit 79c9529

File tree

11 files changed

+103
-106
lines changed

11 files changed

+103
-106
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
site/
2+
*.tar.gz

docs/pubsub/storm-drpc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Storm DRPC PubSub
1+
# Storm DRPC PubSub
22

33
Bullet on [Storm](https://storm.apache.org/) can use [Storm DRPC](http://storm.apache.org/releases/1.0.0/Distributed-RPC.html) as a PubSub layer. DRPC or Distributed Remote Procedure Call, is built into Storm and consists of a set of servers that are part of the Storm cluster.
44

@@ -12,7 +12,7 @@ You can communicate with DRPC using [Apache Thrift](https://thrift.apache.org) o
1212

1313
While DRPC exposes a [Thrift](http://thrift.apache.org) endpoint, the PubSub implementation uses REST. When you launch your topology with the DRPC PubSub, you can POST a JSON Bullet PubSubMessage containing a String JSON query to a DRPC server directly with the function name that you specify in the [Bullet configuration](#storm-backend). For example,
1414
```bash
15-
curl -s -X POST -d '{"id":"", "content":{}}' http://<DRPC_SERVER>:<DRPC_PORT>/drpc/<DRPC_FUNCTION_FROM_YOUR_BULLET_CONF>
15+
curl -s -X POST -d '{"id":"", "content":"{}"}' http://<DRPC_SERVER>:<DRPC_PORT>/drpc/<DRPC_FUNCTION_FROM_YOUR_BULLET_CONF>
1616
```
1717
to get a random record from your data instantly (if you left the Raw aggregation micro-batch size at the default of 1). The ```content``` above in the JSON is the actual (empty) Bullet query. This is a quick way to check if your topology is up and running!
1818

docs/quick-start.md

Lines changed: 51 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Quick Start
22

3-
This section gets you running a mock instance of Bullet to play around with. The instance will run using [Bullet on Storm](backend/storm-setup.md). Since we do not have an actual data source, we will produce some fake data and convert it into [Bullet Records](backend/ingestion.md) in a [custom Storm spout](https://github.com/yahoo/bullet-docs/blob/master/examples/storm/src/main/java/com/yahoo/bullet/storm/examples/RandomSpout.java). If you want to use Bullet for your data, you will need to do read and convert your data to Bullet Records in a similar manner.
3+
This section gets you running a mock instance of Bullet to play around with. The instance will run using [Bullet on Storm](backend/storm-setup.md) and use the [DRPC Pubsub](pubsub/storm-drpc.md). Since we do not have an actual data source, we will produce some fake data and convert it into [Bullet Records](backend/ingestion.md) in a [custom Storm spout](https://github.com/yahoo/bullet-docs/blob/master/examples/storm/src/main/java/com/yahoo/bullet/storm/examples/RandomSpout.java). If you want to use Bullet for your data, you will need to do read and convert your data to Bullet Records in a similar manner.
44

55
At the end of this section, you will have:
66

7-
* Setup the Bullet topology using a custom spout on [bullet-storm-0.5.0](https://github.com/yahoo/bullet-storm/releases/tag/bullet-storm-0.5.0)
8-
* Setup the [Web Service](ws/setup.md) talking to the topology and serving a schema for your UI using [bullet-service-0.0.1](https://github.com/yahoo/bullet-service/releases/tag/bullet-service-0.0.1)
7+
* Setup the Bullet topology using a custom spout on [bullet-storm-0.6.2](https://github.com/yahoo/bullet-storm/releases/tag/bullet-storm-0.6.2)
8+
* Setup the [Web Service](ws/setup.md) talking to the topology and serving a schema for your UI using [bullet-service-0.1.1](https://github.com/yahoo/bullet-service/releases/tag/bullet-service-0.1.1)
9+
* Setup the [DRPC PubSub](pubsub/storm-drpc.md) talking to the topology and Web Service.
910
* Setup the [UI](ui/setup.md) talking to the Web Service using [bullet-ui-0.4.0](https://github.com/yahoo/bullet-ui/releases/tag/v0.4.0)
1011

1112
**Prerequisites**
@@ -19,7 +20,7 @@ At the end of this section, you will have:
1920
Simply run:
2021

2122
```bash
22-
curl -sLo- https://raw.githubusercontent.com/yahoo/bullet-docs/v0.3.4/examples/install-all.sh | bash
23+
curl -sLo- https://raw.githubusercontent.com/yahoo/bullet-docs/v0.4.0/examples/install-all.sh | bash
2324
```
2425

2526
This will setup a local Storm cluster, a Bullet running on it, the Bullet Web Service and a Bullet UI for you. Once everything has launched, you should be able to go to the Bullet UI running locally at [http://localhost:8800](http://localhost:8800). You can then [**continue this guide from here**](#what-did-we-do).
@@ -42,7 +43,7 @@ mkdir -p $BULLET_HOME/backend/storm
4243
mkdir -p $BULLET_HOME/service
4344
mkdir -p $BULLET_HOME/ui
4445
cd $BULLET_HOME
45-
curl -LO https://github.com/yahoo/bullet-docs/releases/download/v0.3.4/examples_artifacts.tar.gz
46+
curl -LO https://github.com/yahoo/bullet-docs/releases/download/v0.4.0/examples_artifacts.tar.gz
4647
tar -xzf examples_artifacts.tar.gz
4748
export BULLET_EXAMPLES=$BULLET_HOME/bullet-examples
4849
```
@@ -154,7 +155,7 @@ Visit the UI and see if the topology is up. You should see the ```DataSource```
154155
Test the Bullet topology by:
155156

156157
```bash
157-
curl -s -X POST -d '{}' http://localhost:3774/drpc/bullet
158+
curl -s -X POST -d '{"id":"", "content":"{}"}' http://localhost:3774/drpc/bullet-query
158159
```
159160

160161
You should get a random record from Bullet.
@@ -165,38 +166,31 @@ You should get a random record from Bullet.
165166

166167
### Setting up the Bullet Web Service
167168

168-
#### Step 7: Install Jetty
169+
#### Step 7: Install the Bullet Web Service
169170

170171
```bash
171172
cd $BULLET_HOME/service
172-
curl -O http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.3.16.v20170120/jetty-distribution-9.3.16.v20170120.zip
173-
unzip jetty-distribution-9.3.16.v20170120.zip
173+
curl -Lo bullet-service.jar http://jcenter.bintray.com/com/yahoo/bullet/bullet-service/0.1.1/bullet-service-0.1.1-embedded.jar
174+
cp $BULLET_EXAMPLES/web-service/example* $BULLET_HOME/service/
175+
cp $BULLET_EXAMPLES/storm/*jar-with-dependencies.jar $BULLET_HOME/service/bullet-storm-jar-with-dependencies.jar
174176
```
175177

176-
#### Step 8: Install the Bullet Web Service
178+
#### Step 8: Launch the Web Service
177179

178180
```bash
179-
cd jetty-distribution-9.3.16.v20170120
180-
curl -Lo webapps/bullet-service.war http://jcenter.bintray.com/com/yahoo/bullet/bullet-service/0.0.1/bullet-service-0.0.1.war
181-
cp $BULLET_EXAMPLES/web-service/example_* $BULLET_HOME/service/jetty-distribution-9.3.16.v20170120
182-
```
183-
184-
#### Step 9: Launch the Web Service
185-
186-
```bash
187-
cd $BULLET_HOME/service/jetty-distribution-9.3.16.v20170120
188-
java -jar -Dbullet.service.configuration.file="example_context.properties" -Djetty.http.port=9999 start.jar > logs/out 2>&1 &
181+
cd $BULLET_HOME/service
182+
java -Dloader.path=bullet-storm-jar-with-dependencies.jar -jar bullet-service.jar --bullet.pubsub.config=example_drpc_pubsub_config.yaml --bullet.schema.file=example_columns.json --server.port=9999 --logging.path=. --logging.file=log.txt > log.txt 2>&1 &
189183
```
190184
You can verify that it is up by running the Bullet query and getting the example columns through the API:
191185

192186
```bash
193-
curl -s -X POST -d '{}' http://localhost:9999/bullet-service/api/drpc
194-
curl -s http://localhost:9999/bullet-service/api/columns
187+
curl -s -H 'Content-Type: text/plain' -X POST -d '{}' http://localhost:9999/api/bullet/query
188+
curl -s http://localhost:9999/api/bullet/columns
195189
```
196190

197191
### Setting up the Bullet UI
198192

199-
#### Step 10: Install Node
193+
#### Step 9: Install Node
200194

201195
```bash
202196
curl -s https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
@@ -205,7 +199,7 @@ nvm install v6.9.4
205199
nvm use v6.9.4
206200
```
207201

208-
#### Step 11: Install the Bullet UI
202+
#### Step 10: Install the Bullet UI
209203

210204
```bash
211205
cd $BULLET_HOME/ui
@@ -214,7 +208,7 @@ tar -xzf bullet-ui-v0.4.0.tar.gz
214208
cp $BULLET_EXAMPLES/ui/env-settings.json config/
215209
```
216210

217-
#### Step 12: Launch the UI
211+
#### Step 11: Launch the UI
218212

219213
```bash
220214
PORT=8800 node express-server.js &
@@ -233,15 +227,15 @@ Visit [http://localhost:8800](http://localhost:8800) to query your topology with
233227
If you were using the [Install Script](#install-script) or if you don't want to manually bring down everything, you can run:
234228

235229
```bash
236-
curl -sLo- https://raw.githubusercontent.com/yahoo/bullet-docs/v0.3.4/examples/install-all.sh | bash -s cleanup
230+
curl -sLo- https://raw.githubusercontent.com/yahoo/bullet-docs/v0.4.0/examples/install-all.sh | bash -s cleanup
237231
```
238232

239233
If you were performing the steps yourself, you can also manually cleanup **all the components and all the downloads** using:
240234

241235
| | |
242236
| -------------- | ---------------------------------------------------------------- |
243237
| UI | ```pkill -f [e]xpress-server.js``` |
244-
| Web Service | ```pkill -f [e]xample_context.properties``` |
238+
| Web Service | ```pkill -f [e]xample_drpc_pubsub_config.yaml``` |
245239
| Storm | ```pkill -f [a]pache-storm-1.0.3``` |
246240
| File System | ```rm -rf $BULLET_HOME /tmp/dev-storm-zookeeper /tmp/jetty-*``` |
247241

@@ -349,9 +343,34 @@ This method generates some fields randomly and inserts them into a BulletRecord.
349343

350344
If you put Bullet on your data, you will need to write a Spout (or a topology if your reading is complex), that reads from your data source and emits BulletRecords with the fields you wish to be query-able placed into a BulletRecord similar to this example.
351345

346+
### PubSub
347+
348+
We used the [DRPC PubSub](pubsub/storm-drpc.md) since we were using the Storm Backend. This code was included in the Bullet Storm artifact that we downloaded (the JAR with dependencies). We configured the Backend to use this PubSub by adding these settings to the YAML file that we passed to our Storm topology. Notice that we set the context to ```QUERY_PROCESSING``` since this is the Backend.
349+
350+
```yaml
351+
bullet.pubsub.context.name: "QUERY_PROCESSING"
352+
bullet.pubsub.class.name: "com.yahoo.bullet.storm.drpc.DRPCPubSub"
353+
bullet.pubsub.storm.drpc.function: "bullet-query"
354+
```
355+
356+
For the Web Service, we passed in a YAML file that pointed to our DRPC server that was part of the Storm cluster we launched. Notice that we set the context to ```QUERY_SUBMISSION``` since this is the Web Service.
357+
358+
```yaml
359+
bullet.pubsub.context.name: "QUERY_SUBMISSION"
360+
bullet.pubsub.class.name: "com.yahoo.bullet.storm.drpc.DRPCPubSub"
361+
bullet.pubsub.storm.drpc.servers:
362+
- 127.0.0.1
363+
bullet.pubsub.storm.drpc.function: "bullet-query"
364+
bullet.pubsub.storm.drpc.http.protocol: "http"
365+
bullet.pubsub.storm.drpc.http.port: "3774"
366+
bullet.pubsub.storm.drpc.http.path: "drpc"
367+
bullet.pubsub.storm.drpc.http.connect.retry.limit: 3
368+
bullet.pubsub.storm.drpc.http.connect.timeout.ms: 1000
369+
```
370+
352371
### Web Service
353372

354-
We launched the Web Service using two custom files - a properties file and JSON schema file.
373+
We launched the Web Service using two custom files - a PubSub configuration YAML file and JSON schema file.
355374

356375
The JSON columns file contains the schema for our data specified in JSON. Since our schema is not going to change, we use the Web Service to serve it from a file. If your schema changes dynamically, you will need to provide your own endpoint to the UI.
357376

@@ -383,20 +402,7 @@ The following is a snippet from the [JSON file](https://github.com/yahoo/bullet-
383402
}
384403
]
385404
```
386-
The [example properties file](https://github.com/yahoo/bullet-docs/blob/master/examples/web-service/example_context.properties) points to the DRPC host, port, and path as well points to the custom columns file.
387-
388-
```
389-
drpc.servers=localhost
390-
drpc.port=3774
391-
drpc.path=drpc/bullet
392-
drpc.retry.limit=3
393-
drpc.connect.timeout=1000
394-
columns.file=example_columns.json
395-
columns.schema.version=1.0
396-
```
397-
398-
```drpc.servers``` is a CSV entry that contains the various DRPC servers in your Storm cluster. If you [visit the Storm UI](http://localhost:8080) and search in the ```Nimbus Configuration``` section, you can find the list of DRPC servers for your cluster. Similarly, ```drpc.port``` in the properties file is ```drpc.http.port``` in ```Nimbus Configuration```. The ```drpc.path``` is the constant string ```drpc/``` followed by the value of the ```topology.function``` setting in bullet_settings.yaml.
399-
405+
The contents of the [PubSub configuration file](https://github.com/yahoo/bullet-docs/blob/master/examples/web-service/example_drpc_pubsub_config.yaml) was discussed in the [PubSub section above](#pubsub).
400406

401407
### UI
402408

@@ -406,10 +412,10 @@ Finally, we configured the UI with the custom environment specific settings file
406412
{
407413
"default": {
408414
"queryHost": "http://localhost:9999",
409-
"queryNamespace": "bullet-service/api",
410-
"queryPath": "drpc",
415+
"queryNamespace": "api/bullet",
416+
"queryPath": "query",
411417
"schemaHost": "http://localhost:9999",
412-
"schemaNamespace": "bullet-service/api",
418+
"schemaNamespace": "api/bullet",
413419
"helpLinks": [
414420
{
415421
"name": "Examples",

docs/ws/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ java -Dloader.path=bullet-kafka.jar -jar bullet-service.jar --bullet.pubsub.conf
9090

9191
This launches the Web Service using Kafka as the PubSub, no custom schema (the default sample columns) and the default values in [settings](https://github.com/yahoo/bullet-service/blob/master/src/main/resources/application.yaml). It also uses a root logging level of ```INFO```.
9292

93-
You could also tweak the various Bullet Web Service settings by passing them in to the command above. You could also have a custom ```application.yaml``` file (you can change the name using ```spring.config.name```) and pass it to the Web Service instead by running:
93+
You could also tweak the various Bullet Web Service or Spring Boot settings by passing them in to the command above. For instance, you could also provide a path to your schema file using ```--bullet.schema.file=/path/to/schema.json```. You could also have a custom ```application.yaml``` file (you can change the name using ```spring.config.name```) and pass it to the Web Service instead by running:
9494

9595
```bash
9696
java -Dloader.path=bullet-kafka.jar -jar bullet-service.jar --spring.config.location=application.yaml

examples/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ build:
1717
cp ui/* bullet-examples/ui
1818
tar -czf examples_artifacts.tar.gz bullet-examples/*
1919
rm -rf bullet-examples
20-
21-

examples/install-all.sh

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
set -euo pipefail
44

5-
BULLET_EXAMPLES_VERSION=0.3.4
5+
BULLET_EXAMPLES_VERSION=0.4.0
66
BULLET_UI_VERSION=0.4.0
7-
BULLET_WS_VERSION=0.0.1
8-
JETTY_VERSION=9.3.16.v20170120
7+
BULLET_WS_VERSION=0.1.1
98
STORM_VERSION=1.0.3
109
NVM_VERSION=0.33.1
1110
NODE_VERSION=6.9.4
@@ -21,7 +20,6 @@ print_versions() {
2120
println "Bullet Examples: ${BULLET_EXAMPLES_VERSION}"
2221
println "Bullet Web Service: ${BULLET_WS_VERSION}"
2322
println "Bullet UI: ${BULLET_UI_VERSION}"
24-
println "Jetty: ${JETTY_VERSION}"
2523
println "Storm: ${STORM_VERSION}"
2624
println "NVM: ${NVM_VERSION}"
2725
println "Node.js: ${NODE_VERSION}"
@@ -129,48 +127,39 @@ launch_bullet_storm() {
129127
println "Testing the Storm topology"
130128
println ""
131129
println "Getting one random record from the Bullet topology..."
132-
curl -s -X POST -d '{}' http://localhost:3774/drpc/bullet
133-
println "Done!"
134-
}
135-
136-
install_jetty() {
137-
local SERVICE="${BULLET_HOME}/service"
138-
local JETTY_DISTRIBUTION="jetty-distribution-${JETTY_VERSION}.zip"
139-
140-
println "Downloading Jetty ${JETTY_VERSION}..."
141-
download "http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${JETTY_VERSION}" "${JETTY_DISTRIBUTION}"
142-
143-
println "Installing Jetty..."
144-
unzip -qq "${BULLET_DOWNLOADS}/${JETTY_DISTRIBUTION}" -d "${SERVICE}"
130+
curl -s -X POST -d '{"id":"", "content":"{}"}' http://localhost:3774/drpc/bullet-query
145131
println "Done!"
146132
}
147133

148134
launch_bullet_web_service() {
149-
local BULLET_WS_WAR="bullet-service-${BULLET_WS_VERSION}.war"
150-
local JETTY_INSTALLATION="${BULLET_HOME}/service/jetty-distribution-${JETTY_VERSION}"
135+
local BULLET_WS_JAR="bullet-service-${BULLET_WS_VERSION}.jar"
136+
local BULLET_SERVICE_HOME="${BULLET_HOME}/service"
151137

152138
println "Downloading Bullet Web Service ${BULLET_WS_VERSION}..."
153-
download "http://jcenter.bintray.com/com/yahoo/bullet/bullet-service/${BULLET_WS_VERSION}" "${BULLET_WS_WAR}"
139+
download "http://jcenter.bintray.com/com/yahoo/bullet/bullet-service/${BULLET_WS_VERSION}" "${BULLET_WS_JAR}"
154140

155-
println "Configuring Bullet Web Service..."
156-
cp "${BULLET_DOWNLOADS}/${BULLET_WS_WAR}" "${JETTY_INSTALLATION}/webapps/bullet-service.war"
157-
cp "${BULLET_EXAMPLES}/web-service/"example_* "${JETTY_INSTALLATION}"
141+
println "Configuring Bullet Web Service and plugging in Storm DRPC PubSub..."
142+
cp "${BULLET_DOWNLOADS}/${BULLET_WS_JAR}" "${BULLET_SERVICE_HOME}/bullet-service.jar"
143+
cp "${BULLET_EXAMPLES}/storm"/*jar-with-dependencies.jar "${BULLET_SERVICE_HOME}/bullet-storm-jar-with-dependencies.jar"
144+
cp "${BULLET_EXAMPLES}/web-service/"example_* "${BULLET_SERVICE_HOME}/"
158145

159146
println "Launching Bullet Web Service..."
160-
cd "${JETTY_INSTALLATION}"
161-
java -jar -Dbullet.service.configuration.file="example_context.properties" -Djetty.http.port=9999 start.jar > logs/out 2>&1 &
147+
cd "${BULLET_SERVICE_HOME}"
148+
java -Dloader.path=bullet-storm-jar-with-dependencies.jar -jar bullet-service.jar \
149+
--bullet.pubsub.config=example_drpc_pubsub_config.yaml --bullet.schema.file=example_columns.json \
150+
--server.port=9999 --logging.path="${BULLET_SERVICE_HOME}" --logging.file=log.txt > log.txt 2>&1 &
162151

163-
println "Sleeping for 30 s to ensure Bullet Web Service is up..."
164-
sleep 30
152+
println "Sleeping for 15 s to ensure Bullet Web Service is up..."
153+
sleep 15
165154

166155
println "Testing the Web Service"
167156
println ""
168157
println "Getting one random record from Bullet through the Web Service..."
169-
curl -s -X POST -d '{}' http://localhost:9999/bullet-service/api/drpc
158+
curl -s -H 'Content-Type: text/plain' -X POST -d '{}' http://localhost:9999/api/bullet/query
170159
println ""
171160
println "Getting column schema from the Web Service..."
172161
println ""
173-
curl -s http://localhost:9999/bullet-service/api/columns
162+
curl -s http://localhost:9999/api/bullet/columns
174163
println "Finished Bullet Web Service test"
175164
}
176165

@@ -227,12 +216,12 @@ cleanup() {
227216

228217
pkill -f "[a]pache-storm-${STORM_VERSION}"
229218
pkill -f "[e]xpress-server.js"
230-
pkill -f "[e]xample_context.properties"
219+
pkill -f "[e]xample_drpc_pubsub_config.yaml"
231220

232221
sleep 3
233222

234223
rm -rf "${BULLET_EXAMPLES}" "${BULLET_HOME}/backend" "${BULLET_HOME}/service" \
235-
"${BULLET_HOME}/ui" /tmp/dev-storm-zookeeper /tmp/jetty-*
224+
"${BULLET_HOME}/ui" /tmp/dev-storm-zookeeper
236225

237226
set -e
238227
}
@@ -247,7 +236,7 @@ unset_all() {
247236
unset -f print_versions println download export_vars setup \
248237
install_bullet_examples \
249238
install_storm launch_storm launch_bullet_storm \
250-
install_jetty launch_bullet_web_service \
239+
launch_bullet_web_service \
251240
install_node launch_bullet_ui \
252241
cleanup teardown unset_all launch
253242
}
@@ -265,7 +254,6 @@ launch() {
265254
launch_storm
266255
launch_bullet_storm
267256

268-
install_jetty
269257
launch_bullet_web_service
270258

271259
install_node

examples/storm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2727
<maven.compiler.source>1.8</maven.compiler.source>
2828
<maven.compiler.target>1.8</maven.compiler.target>
29-
<bullet.storm.version>0.5.0</bullet.storm.version>
29+
<bullet.storm.version>0.6.2</bullet.storm.version>
3030
<bullet.core.version>0.1.2</bullet.core.version>
3131
<storm.version>1.0.3</storm.version>
3232
</properties>

0 commit comments

Comments
 (0)