Skip to content

Add dockerfile and update README#429

Closed
mpardesh wants to merge 19 commits intoyahoo:masterfrom
mpardesh:filiDocker
Closed

Add dockerfile and update README#429
mpardesh wants to merge 19 commits intoyahoo:masterfrom
mpardesh:filiDocker

Conversation

@mpardesh
Copy link
Contributor

No description provided.

@mpardesh mpardesh force-pushed the filiDocker branch 9 times, most recently from 4d635c7 to 51cabaf Compare July 16, 2017 21:02
@will-lauer will-lauer added REVIEWABLE and removed WIP labels Jul 17, 2017
# 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 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to use ${BRANCH} instead of $BRANCH.

@@ -58,26 +67,37 @@ Here are some sample queries that you can run to verify your server:

### Specific to Wikipedia data
Copy link
Member

@kevinhinterlong kevinhinterlong Jul 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to move the stuff you added here into a separate section because the wikipedia data in the docker conatiner is different from the wikipedia data in the druid quickstart tutorial

@michael-mclawhorn ?

EDIT: actually since this is embedding the generic example around wikipedia data we could move this into fili-wikipedia-example (still leaving a comment that the two datasets are different.)

Copy link
Contributor Author

@mpardesh mpardesh Jul 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinhinterlong Thank you for your comments! I updated the commands and added some links, and I pushed the (fixed) image to Dockerhub. I also moved the Docker instructions from the generic example to the wikipedia example. Please let me know if it's still not working, or if there's anything else I should change. I am just working on a bit of formatting in the readme now.

Copy link
Member

@kevinhinterlong kevinhinterlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good, I'm not sure what we'll end up doing about actually deploying the files to docker though

Maybe make a fili account? @michael-mclawhorn


EXPOSE 9998

RUN apt-get purge --auto-remove -y git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an error running the image from docker hub complaining that git wasn't available while fili was trying to start up. So we should probably keep git around

ERROR] Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "git" (in directory "/usr/local/fili/fili-generic-example"): error=2, No such file or directory

## Setup and Launching

### Docker
There is a Fili Dockerfile which is available on Dockerhub. To start playing around with Fili, you can download and open Docker. Then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a link to the page on docker hub.

Also maybe add a link to the docker install page

There is a Fili Dockerfile which is available on Dockerhub. To start playing around with Fili, you can download and open Docker. Then
run the command
```bash
docker run --name fili-generic-example -i --rm -p 3001:8081 -p 3000:8082 fili:1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were the commands I had to run to start it up

docker pull mpardesh/fili
docker run --name fili-generic-example -i --rm -p 3001:8081 -p 3000:8082 mpardesh/fili:1.0

also there should probably be a -p 9998:9998 so that people can connect to fili.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions. I have added those commands into the readme. I also thought that the 9998 mapping was necessary, but when I tried to run with -p 9998:9998 Docker gave me an error:

Error response from daemon: driver failed programming external connectivity on endpoint fili-wikipedia-example
Error starting userland proxy: Bind for 0.0.0.0:9998 failed: port is already allocated.

Copy link
Member

@kevinhinterlong kevinhinterlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like fili is starting up too quick (at least on my machine), so we should wait until druid has finished setting up before letting fili configure itself.

[install](https://www.docker.com/community-edition) and start Docker. Then run these commands:


docker pull mpardesh/fili
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add the version tag here as well mpardesh/fili:1.0


EXPOSE 9998

ENTRYPOINT export HOSTIP="$(resolveip -s $HOSTNAME)" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so I just ran it and it started up correctly, but unfortunately fili-generic-example started up too quickly and druid wasn't ready so it didn't detect any tables. You might have to write a startup.sh as your ENTRYPOINT and run all the commands there.

Then you could put something like

echo "Waiting for Druid to finish setting up"
while ! curl http://localhost:8081/druid/coordinator/v1/datasources | grep -q "wikipedia"; do
  sleep 5
done
echo "Druid finished setting up. Starting Fili"

before running the generic example so that it's forced to wait until druid is ready.

Copy link
Contributor Author

@mpardesh mpardesh Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'm working on the shell script right now. Quick question, since we mapped host port 3001 to container port 8081 should we use port 3001 in the while loop instead of 8081? I tried going to
http://localhost:8081/druid/coordinator/v1/datasources
while the container was running but I couldn't connect to port 8081. It seemed to work when I did this instead:
http://localhost:3001/druid/coordinator/v1/datasources

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the script is running inside the container it should only be able to see port 8081 (port 3001 is visible from outside the container which is why you could connect to that but not 8081). So it should connect on port 8081 inside the script.



docker pull mpardesh/fili
docker run --name fili-wikipedia-example -i --rm -p 3001:8081 -p 3000:8082 mpardesh/fili:1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In response to your earlier comment it looks like you must have already had something using that port.

The first part of the port argument is the host port, so you could always do something like -p 9996:9998, and then check the here to make sure it connected, but it should forward some port to the docker container.


To stop the container, run

docker stop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be docker stop fili-wikipedia-example

-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
COPY entrypoint.sh /entrypoint.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here since we're cloning the repository in although you will need to changeGITHUB_OWNER=mpardesh and BRANCH=filiDocker while working on it locally (i.e. don't commit that change).

That way when filiDocker gets merged into master everything should work the same.

You might still have to run chmod and you'll need to update the path to entrypoint.sh for the chmod and ENTRYPOINT

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the Dockerfile and entrypoint.sh and uploaded the new image to Dockerhub to test. It seems to work on my computer, but then I tried pulling and running the image from a different computer and got this message when I sent the query:

{
    "status" : 400,
    "statusName" : "Bad Request", 
    "reason" : "com.yahoo.bard.webservice.web.BadApiRequestException",
    "description" : "Table name 'wikipedia' does not exist.",
    "druidQuery" : null 
}

I'm not sure what's wrong.

#!/bin/sh

export HOSTIP="$(resolveip -s $HOSTNAME)"
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before you were backgrounding this process and I'm guessing you want to do the same here

/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &

It looks like it waits here and never tries to start up fili

@michael-mclawhorn
Copy link
Contributor

@kevinhinterlong did you change to 'needs 1 reviewer' because you were done reviewing? If so, you still need to accept changes.

@kevinhinterlong
Copy link
Member

kevinhinterlong commented Jul 19, 2017

@michael-mclawhorn I'm pretty confident this will work once the last comment I made is implemented.
The only other things I can think of is stuff you might have to decide on like if we should republish the file on docker hub under a fili account.

Copy link
Member

@kevinhinterlong kevinhinterlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small fix


# fili github information
ENV GITHUB_OWNER=yahoo BRANCH=master
ENV GITHUB_OWNER=yahoo BRANCH=fili
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should stay as master

# fili github information
ENV GITHUB_OWNER=yahoo BRANCH=master

RUN apt-get update && apt-get install -y --no-install-recommends git
Copy link
Member

@kevinhinterlong kevinhinterlong Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another smallfix: Looks like curl is somehow not installed

/usr/local/fili/fili-wikipedia-example/entrypoint.sh: 6: /usr/local/fili/fili-wikipedia-example/entrypoint.sh: curl: not found

EDIT: Ok I just tried it locally after adding curl and it worked so this should be the last fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add

RUN apt-get install -y curl

before the chmod in the Dockerfile. Is there a better way to do this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking just change the current line to

RUN apt-get update && apt-get install -y --no-install-recommends git curl

Copy link
Contributor Author

@mpardesh mpardesh Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinhinterlong After I added curl to the end of this line, Codacy had some complaints, like

  • either use wget or curl but not both

  • specify a version when you use apt get install

  • delete the apt-get lists after installing something

Should I try to fix these issues?

Codacy also complained about some things that I already fixed, like not specifying a maintainer. Strangely, it didn't have any issues with the previous commit.

Copy link
Member

@kevinhinterlong kevinhinterlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builds fine for me 👍 also we ended up at 1.35GiB RAM used while running which is nice.
@michael-mclawhorn I think the biggest thing left would be deciding about hosting it on docker hub.


script:
- travis/deploy.bash
- ssh-agent -k || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Or did this slip in because we haven't rebased this branch recently?

I ask mostly because I remember Mike saying we had an issue with Travis and the ssh-agent running continuously, and I want to make sure we don't regress once this gets merged in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got slipped in from Mike's PR


export HOSTIP="$(resolveip -s $HOSTNAME)"
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
echo "Waiting for Druid to finish setting up"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to block on this, but we may want to add a timeout here, so that docker doesn't just hang if Druid is having a problem loading up.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this line. The entrypoint script ensures that Druid will be fully up and running by the time the image is up and running.

Copy link
Member

@kevinhinterlong kevinhinterlong Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's true that druid is up and running it still has to index the data which can take some time (I believe the druid Dockerfile this is based on is fetching some data from S3 as well)

@archolewa
Copy link
Contributor

@kevinhinterlong That was my thought. We should probably create a fili-io user on the docker hub and upload the dockerfile there.

@mpardesh mpardesh changed the title Added dockerfile and updated README Add dockerfile and update README Jul 25, 2017
@kevinhinterlong
Copy link
Member

@michael-mclawhorn
Ok so with regards to automated builds, it looks like we have 2 options

  1. Use automated builds from Docker Hub
  2. Have travis builds which trigger ci-tag.bash also login, build, and push a new build to DockerHub.

The first is definitely easier and probably the way to go, but it looks like we could also do some combination of the two using Remote build triggers on Docker Hub.

The second option would look something like

# ... appended to ci-tag.bash

#Login to docker
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS

#Build the dockerfile
docker build -t fili-wikipedia-example -f fili-wikipedia-example/Dockerfile .

#only push a successful build
DOCKER_BUILD_RETURN_CODE=$?
if [[ ${DOCKER_BUILD_RETURN_CODE} -ne 0 ]]; then
    echo "ERROR Docker build did not succeed."
    exit ${DOCKER_BUILD_RETURN_CODE}
fi

#tag and push the new build
REPO=fili/fili-wikipedia-example
docker tag fili-wikipedia-example $REPO:$NEW_TAG
docker push $REPO

@kevinhinterlong
Copy link
Member

Ok we definitely want to go with the first option. I just played around with it and it should be much easier + it's independent of travis-ci so as long as the Dockerfile is fine it'll build fine (which we always expect to be the case on master)

@mpardesh mpardesh force-pushed the filiDocker branch 2 times, most recently from ba2a7c7 to e9c0395 Compare August 20, 2017 15:24
@archolewa
Copy link
Contributor

@QubitPi Can you verify that changes have been made to your satisfaction? @mpardesh is going back to school this weekend, so I want to get her stuff merged in nowish.

Since it has two approvals on it, and I don't want to leave this hanging in perpetuity, I'm going to discard your review and merge it tomorrow if you don't take a second look by then.

@mpardesh Please rebase this on top of master, so we can merge it in.

@mpardesh
Copy link
Contributor Author

@archolewa thanks! I have rebased this

@archolewa archolewa mentioned this pull request Aug 24, 2017
@archolewa
Copy link
Contributor

I've migrated this branch off of @mpardesh's fork and onto the main fork so that we can continue to rebase it and keep it up to date until we get a chance to create a fili dockerhub. See #523 for the new PR.

@archolewa archolewa closed this Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants