diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d86fe394..81bf854627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ Current ### Added: +- [Add dockerfile and update README](https://github.com/yahoo/fili/pull/429) + * Make a Dockerfile for the Wikipedia example + - [Add Uptime Status Metric](https://github.com/yahoo/fili/pull/518) * Add a metric to show how long Fili has been running diff --git a/fili-generic-example/README.md b/fili-generic-example/README.md index c414199792..8b77e0b813 100644 --- a/fili-generic-example/README.md +++ b/fili-generic-example/README.md @@ -1,7 +1,7 @@ Fili Generic Loader Application ================================== -This application will automatically configure fili to work with **any** instance +This application will automatically configure Fili to work with **any** instance of Druid and show the basic metrics and dimensions. This lets you test what it's like using Fili without putting any effort into setting it up. @@ -72,11 +72,11 @@ Here are some sample queries that you can run to verify your server: } ``` -- Count of edits by hour for the last 72 hours: - +- Count of edits by hour for the last 72 hours: + GET http://localhost:9998/v1/data/wikiticker/day/?metrics=count&dateTime=PT72H/current - - Note: this will should be something like the response below since the + + Note: this will should be something like the response below since the wikiticker table doesn't have data for the past 72 hours from now. ```json { @@ -94,7 +94,7 @@ Here are some sample queries that you can run to verify your server: ## Notable Restrictions -- Using this is great for testing out fili and druid, but it can't do interesting things with metrics. +- Using this is great for testing out Fili and druid, but it can't do interesting things with metrics. - This can only use 1 timegrain even though a datasource in druid *could* have more. ## Importing and Running in IntelliJ diff --git a/fili-wikipedia-example/Dockerfile b/fili-wikipedia-example/Dockerfile new file mode 100644 index 0000000000..14c730dc3b --- /dev/null +++ b/fili-wikipedia-example/Dockerfile @@ -0,0 +1,29 @@ +FROM druidio/example-cluster:latest +LABEL maintainer="https://groups.google.com/forum/#!forum/fili-developers" + +# fili github information +ENV GITHUB_OWNER yahoo +ENV BRANCH master + +RUN apt-get update && apt-get install -y --no-install-recommends git curl + +RUN wget -q -O - http://archive.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz | tar -xzf - -C /usr/local \ + && ln -s /usr/local/apache-maven-3.2.5 /usr/local/apache-maven \ + && ln -s -f /usr/local/apache-maven/bin/mvn /usr/local/bin/mvn + +# fili code goes here +RUN mkdir -p /usr/local/fili + +# update in case of new commits +ADD https://api.github.com/repos/$GITHUB_OWNER/fili/git/refs/heads/$BRANCH fili-branch.json +RUN git clone -q --branch ${BRANCH} --depth 1 https://github.com/$GITHUB_OWNER/fili.git /usr/local/fili + +WORKDIR /usr/local/fili + +# install Fili in the container +RUN mvn -U -B install -DskipTests=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip + +EXPOSE 9998 + +RUN chmod +x /usr/local/fili/fili-wikipedia-example/entrypoint.sh +ENTRYPOINT ["/usr/local/fili/fili-wikipedia-example/entrypoint.sh"] diff --git a/fili-wikipedia-example/README.md b/fili-wikipedia-example/README.md index 22c25e3681..621c3d75cf 100644 --- a/fili-wikipedia-example/README.md +++ b/fili-wikipedia-example/README.md @@ -65,6 +65,49 @@ Here are some sample queries that you can run to verify your server: GET http://localhost:9998/v1/data/wikipedia/hour/?format=debug&metrics=count&dateTime=PT72H/current +## Running Fili with Docker + +There is a [Docker image](https://hub.docker.com/r/mpardesh/fili/) for Fili which can be found on +Dockerhub. If you would like to experiment with Fili without having to download its dependencies, you can +[install](https://www.docker.com/community-edition) and start Docker. Then run these commands: + + docker pull mpardesh/fili:1.0 + docker run --name fili-wikipedia-example -i --rm -p 3001:8081 -p 3000:8082 -p 9998:9998 mpardesh/fili:1.0 + +This will start a container. Please wait a few minutes for Druid to get ready. + +Once Druid is ready, you can start querying! Here is a +[sample query](http://localhost:9998/v1/data/wikipedia/day/?metrics=deleted&dateTime=2013-08-01/PT24H) +to get started: + + http://localhost:9998/v1/data/wikipedia/day/?metrics=deleted&dateTime=2013-08-01/PT24H + +If Druid isn't ready yet, you will see this message: + + { + "rows": [], + "meta": { + "missingIntervals": ["2013-08-01 00:00:00.000/2013-08-02 00:00:00.000"] + } + } + +If the query is successful, you should see this: + + { + "rows": [{ + "dateTime": "2013-08-01 00:00:00.000", + "deleted": -39917308 + }] + } + +To stop the container, run + + docker stop fili-wikipedia-example + +in a different terminal tab. + +Note: the data used with Docker is from a different day than the data used with Druid quickstart. + ## Importing and Running in IntelliJ 1. In IntelliJ, go to `File -> Open` diff --git a/fili-wikipedia-example/entrypoint.sh b/fili-wikipedia-example/entrypoint.sh new file mode 100644 index 0000000000..59f82fc9db --- /dev/null +++ b/fili-wikipedia-example/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +export HOSTIP="$(resolveip -s $HOSTNAME)" +/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf & +echo "Waiting for Druid to finish setting up" + +time_left=300 + +while ! curl http://localhost:8081/druid/coordinator/v1/datasources | grep -q "wikipedia"; do + if [ "$time_left" -le 0 ] + then + echo "Druid is having trouble setting up" + exit + fi + sleep 5 + time_left=$(( time_left - 5 )) +done + +echo "Druid finished setting up. Starting Fili" +mvn -pl fili-generic-example exec:java -Dbard__fili_port=9998 + -Dbard__druid_coord=http://localhost:8081/druid/coordinator/v1 + -Dbard__non_ui_druid_broker=http://localhost:8082/druid/v2 + -Dbard__ui_druid_broker=http://localhost:8082/druid/v2