[
https://issues.apache.org/jira/browse/GOBBLIN-1317?focusedWorklogId=519816&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-519816
]
ASF GitHub Bot logged work on GOBBLIN-1317:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 03/Dec/20 18:52
Start Date: 03/Dec/20 18:52
Worklog Time Spent: 10m
Work Description: Will-Lo commented on a change in pull request #3154:
URL: https://github.com/apache/incubator-gobblin/pull/3154#discussion_r535494160
##########
File path: gobblin-docs/user-guide/Docker-Integration.md
##########
@@ -12,74 +12,104 @@ For more information on Docker, including how to install
it, check out the docum
# Docker Repositories
-Gobblin currently has four different repositories, and all are on Docker Hub
[here](https://hub.docker.com/u/gobblin/).
+Gobblin currently has four different repositories, and all are on Docker Hub
[here](https://hub.docker.com/u/gobblin/). We are also starting to use
[Apache's
repository](https://hub.docker.com/r/apache/gobblin/tags?page=1&ordering=last_updated)
for our images.
The `gobblin/gobblin-wikipedia` repository contains images that run the
Gobblin Wikipedia job found in the [getting started guide](../Getting-Started).
These images are useful for users new to Docker or Gobblin, they primarily act
as a "Hello World" example for the Gobblin Docker integration.
The `gobblin/gobblin-standalone` repository contains images that run a
[Gobblin standalone service](Gobblin-Deployment#standalone-architecture) inside
a Docker container. These images provide an easy and simple way to setup a
Gobblin standalone service on any Docker compatible machine.
+The `gobblin/gobblin-service` repository contains images that run [Gobblin as
a
service](Building-Gobblin-as-a-Service#running-gobblin-as-a-service-with-docker),
which is a service that takes in a user request (a logical flow) and converts
it into a series of Gobblin Jobs, and monitors these jobs in a distributed
manner.
+
The `gobblin/gobblin-base` and `gobblin/gobblin-distributions` repositories
are for internal use only, and are primarily useful for Gobblin developers.
-## Gobblin-Wikipedia Repository
+# Run Gobblin Standalone
-The Docker images for this repository can be found on Docker Hub
[here](https://hub.docker.com/r/gobblin/gobblin-wikipedia/). These images are
mainly meant to act as a "Hello World" example for the Gobblin-Docker
integration, and to provide a sanity check to see if the Gobblin-Docker
integration is working on a given machine. The image contains the Gobblin
configuration files to run the [Gobblin Wikipedia job](../Getting-Started).
When a container is launched using the `gobblin-wikipedia` image, Gobblin
starts up, runs the Wikipedia example, and then exits.
+The Docker images for this repository can be found on Docker Hub
[here](https://hub.docker.com/r/gobblin/gobblin-standalone/). These images run
a Gobblin standalone service inside a Docker container. The Gobblin standalone
service is a long running process that can run Gobblin jobs defined in a `.job`
or `.pull` file. The job / pull files are submitted to the standalone service
by placing them in a directory on the local filesystem. The standalone service
monitors this directory for any new job / pull files and runs them either
immediately or on a scheduled basis (more information on how this works can be
found
[here](Working-with-Job-Configuration-Files#adding-or-changing-job-configuration-files)).
Running the Gobblin standalone service inside a Docker container allows
Gobblin to pick up job / pull files from a directory on the host filesystem,
run the job, and write the output back the host filesystem. All the heavy
lifting is done inside a Docker container, the user just needs to worry about
defining and submitting job / pull files. The goal is to provide a easy to
setup environment for the Gobblin standalone service.
-Running the `gobblin-wikipedia` image requires taking following steps (lets
assume we want to an Ubuntu based image):
+### Set working directory
-* Download the images from the `gobblin/gobblin-wikipedia` repository
+Before running docker containers, set a working directory for Gobblin jobs:
-```
-docker pull gobblin/gobblin-wikipedia:ubuntu-gobblin-latest
-```
+`export LOCAL_JOB_DIR=<local_gobblin_directory>`
-* Run the `gobblin/gobblin-wikipedia:ubuntu-gobblin-latest` image in a Docker
container
+We will use this directory as the
[volume](https://docs.docker.com/storage/volumes/) for Gobblin jobs and
outputs. Make sure your Docker has the
[access](https://docs.docker.com/docker-for-mac/#file-sharing) to this folder.
This is the prerequisite for all following example jobs.
-```
-docker run gobblin/gobblin-wikipedia:ubuntu-gobblin-latest
-```
+### Run the docker image with simple wikipedia jobs
-The logs are printed to the console, and no errors should pop up. This should
provide a nice sanity check to ensure that everything is working as expected.
The output of the job will be written to a directory inside the container. When
the container exits that data will be lost. In order to preserve the output of
the job, continue to the next step.
+Run these commands to start the docker image:
-* Preserving the output of a Docker container requires using a [data
volume](https://docs.docker.com/engine/tutorials/dockervolumes/). To do this,
run the below command:
+`docker pull apache/gobblin:latest`
-```
-docker run -v /home/gobblin/work-dir:/home/gobblin/work-dir gobblin-wikipedia
-```
+`docker run -v $LOCAL_JOB_DIR:/tmp/gobblin-standalone/jobs
apache/gobblin:latest`
-The output of the Gobblin-Wikipedia job should now be written to
`/home/gobblin/work-dir/job-output`. The `-v` command in Docker uses a feature
of Docker called [data
volumes](https://docs.docker.com/engine/tutorials/dockervolumes/). The `-v`
option mounts a host directory into a container and is of the form
`[host-directory]:[container-directory]`. Now any modifications to the host
directory can be seen inside the container-directory, and any modifications to
the container-directory can be seen inside the host-directory. This is a
standard way to ensure data persists even after a Docker container finishes.
It's important to note that the `[host-directory]` in the `-v` option can be
changed to any directory (on OSX it must be under the `/Users/` directory), but
the `[container-directory]` must remain `/home/gobblin/work-dir` (at least for
now).
+After the container spins up, put the
[wikipedia.pull](https://github.com/apache/incubator-gobblin/blob/master/gobblin-example/src/main/resources/wikipedia.pull)
in ${LOCAL_JOB_DIR}. You will see the Gobblin daemon pick up the job, and the
result output is in ${LOCAL_JOB_DIR}/job-output/.
-## Gobblin-Standalone Repository
+This example job is correspondent to the [getting started
guide](https://gobblin.readthedocs.io/en/latest/Getting-Started/). With the
docker image, you can focus on the Gobblin functionalities, avoiding the hassle
of building a distribution.
-The Docker images for this repository can be found on Docker Hub
[here](https://hub.docker.com/r/gobblin/gobblin-standalone/). These images run
a Gobblin standalone service inside a Docker container. The Gobblin standalone
service is a long running process that can run Gobblin jobs defined in a `.job`
or `.pull` file. The job / pull files are submitted to the standalone service
by placing them in a directory on the local filesystem. The standalone service
monitors this directory for any new job / pull files and runs them either
immediately or on a scheduled basis (more information on how this works can be
found
[here](Working-with-Job-Configuration-Files#adding-or-changing-job-configuration-files)).
Running the Gobblin standalone service inside a Docker container allows
Gobblin to pick up job / pull files from a directory on the host filesystem,
run the job, and write the output back the host filesystem. All the heavy
lifting is done inside a Docker container, the user just needs to worry about
defining and submitting job / pull files. The goal is to provide a easy to
setup environment for the Gobblin standalone service.
+### Use Gobblin Standalone on Docker for Kafka and HDFS Ingestion
+
+* To ingest from/to Kafka and HDFS by Gobblin, you need to start services for
Zookeeper, Kafka and HDFS along with Gobblin. We use docker
[compose](https://docs.docker.com/compose/) with images contributed to docker
hub. Firstly, you need to create a
[docker-compose.yml](https://github.com/apache/incubator-gobblin/blob/master/gobblin-docker/gobblin-recipes/kafka-hdfs/docker-compose.yml)
file.
+
+* Second, in the same folder of the yml file, create a
[hadoop.env](https://github.com/apache/incubator-gobblin/blob/master/gobblin-docker/gobblin-recipes/kafka-hdfs/hadoop.env)
file to specify all HDFS related config(copy the content into your .env file).
+
+* Open a terminal in the same folder, pull and run these docker services:
+
+ `docker-compose -f ./docker-compose.yml pull`
+
+ `docker-compose -f ./docker-compose.yml up`
+
+ Here we expose Zookeeper at port 2128, Kafka at 9092 with an auto created
Kafka topic “test”. All hadoop related configs are stated in the .env file.
+
+* You should see all services running. Now we can push some events into the
Kafka topic. Open a terminal from [docker
desktop](https://docs.docker.com/desktop/dashboard/) dashboard or [docker
exec](https://docs.docker.com/engine/reference/commandline/exec/) to interact
with Kafka. Inside the Kafka container terminal:
+
+ `cd /opt/kafka`
+
+ `./bin/kafka-console-producer.sh --broker-list kafka:9092 --topic test`
+
+ You can type messages for the topic “test”, and press ctrl+c to exit.
+
+* Put the
[kafka-hdfs.pull](https://github.com/apache/incubator-gobblin/blob/master/gobblin-example/src/main/resources/kafka-hdfs.pull)
in ${LOCAL_JOB_DIR}, so that the Gobblin daemon will pick up this job and
write the result to HDFS. You will see the Gobblin daemon pick up the job.
+
+After the job finished, open a terminal in the HDFS namenode container:
+
+`hadoop fs -ls /gobblintest/job-output/test/`
+
+You will see the result file in this HDFS folder. You can use this command to
verify the content in the text file:
+
+`hadoop fs -cat /gobblintest/job-output/test/<output_file.txt>`
+
+# Run Gobblin as a Service
+
+The goal of GaaS(Gobblin as a Service) is to enable a self service so that
different users can automatically provision and execute various supported
Gobblin applications limiting the need for development and operation teams to
be involved during the provisioning process. You can take a look at our [design
detail](https://cwiki.apache.org/confluence/display/GOBBLIN/Gobblin+as+a+Service).
+
+We use the same docker image as discussed above.
+
+### Set working directory
+
+Similar to standalone working directory settings:
+
+`export GAAS_JOB_DIR=<gaas_gobblin_directory>`
-Running the `gobblin-standalone` image requires taking the following steps:
+`export LOCAL_DATAPACK_DIR=<local_directory_of_templateUris>`
-* Download the images from the `gobblin/gobblin-standalone` repository
+### Start Gobblin as a Service
-```
-docker pull gobblin/gobblin-standalone:ubuntu-gobblin-latest
-```
+Run these commands to start the docker image:
-* Run the `gobblin/gobblin-standalone:ubuntu-gobblin-latest` image in a Docker
container
+`docker pull apache/gobblin:latest`
Review comment:
So this is sort of awkward but the apache image actually doesn't support
GaaS right now. I have a PR I will open later this week to support multiple
execution modes with the image but for the meantime could we use our own image
at `gobblin/gobblin-service` for GaaS specifically? I can change this doc in my
PR to update the image to keep the documentation up to date.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 519816)
Time Spent: 3h (was: 2h 50m)
> Add Docker Recipes and Documentations
> -------------------------------------
>
> Key: GOBBLIN-1317
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1317
> Project: Apache Gobblin
> Issue Type: Improvement
> Reporter: Hanghang Liu
> Priority: Major
> Time Spent: 3h
> Remaining Estimate: 0h
>
> Add documentation to run Gobblin on docker end to end, with latest version.
> Add docker recipes including example Wikipedias job, from/to Kafka and HDFS
> ingestion. Add guidance for these recipes.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)