-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connector: provide sample Dockerfile (#4330)
* update * add README
- Loading branch information
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fluvio_profile.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM debian:stable-slim | ||
|
||
RUN apt-get update && apt-get -y upgrade | ||
RUN apt-get install -y tini | ||
RUN apt-get install -y curl | ||
|
||
# setup fluvio as non user | ||
ENV USER=fluvio | ||
RUN adduser \ | ||
--disabled-password \ | ||
--home "/home/$USER" \ | ||
"$USER" | ||
USER $USER | ||
WORKDIR /home/fluvio | ||
|
||
|
||
# install fluvio | ||
RUN curl -fsS https://hub.infinyon.cloud/install/install.sh | bash | ||
RUN ls -la /home/fluvio/.fluvio/bin | ||
ENV PATH="/home/fluvio/.fluvio/bin:$PATH" | ||
RUN export PATH | ||
RUN fluvio version | ||
|
||
# copy fluvio profile and test | ||
COPY ./fluvio_profile.toml /home/fluvio/.fluvio/config | ||
# RUN fluvio topic list | ||
|
||
WORKDIR /home/fluvio/connector | ||
|
||
|
||
# Download specific connector, you can configure this to download the connector you need | ||
RUN cdk hub download infinyon/[email protected] | ||
RUN tar xf infinyon-http-source-0.3.8.ipkg | ||
RUN tar -xzf manifest.tar.gz | ||
RUN ls -la | ||
|
||
|
||
# Copy connector configuration | ||
COPY ./connector.yaml /home/fluvio/connector | ||
RUN ls -la /home/fluvio/connector | ||
|
||
# run http-source, this will be different for each connector | ||
ENTRYPOINT ["/home/fluvio/connector/http-source", "--config", "/home/fluvio/connector/connector.yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ORG=myorg | ||
IMAGE=http-source | ||
VERSION=0.3.8 | ||
|
||
copy-profile: | ||
fluvio profile export > fluvio_profile.toml | ||
|
||
build: copy-profile | ||
docker build --progress=plain -t $(ORG)/$(IMAGE):$(VERSION) . | ||
|
||
run: build | ||
docker run --network host --rm $(ORG)/$(IMAGE):$(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Introduction | ||
|
||
This is sample project to demonstrate how to use the docker to run the connector. | ||
This examples is for http connector but can be used for any connector. | ||
|
||
# To build image | ||
|
||
To build docker image run: | ||
``` | ||
make build | ||
``` | ||
|
||
This will copy following files from your local file system: | ||
- your current fluvio profile | ||
- connector.yaml | ||
|
||
The connector.yaml is connector config for http source | ||
|
||
|
||
# To run image | ||
|
||
To run image, run: | ||
``` | ||
make run | ||
``` | ||
|
||
This setup will run `host` network mode. This means that connector will be able to access the local network. If you want to run in different network mode, you can modify the `Makefile` to change the network mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: 0.1.0 | ||
meta: | ||
version: 0.3.8 | ||
name: http-quotes | ||
type: http-source | ||
topic: quotes | ||
http: | ||
endpoint: https://demo-data.infinyon.com/api/quote | ||
interval: 2s |