diff --git a/connector/docker/.gitignore b/connector/docker/.gitignore new file mode 100644 index 0000000000..480b0026b9 --- /dev/null +++ b/connector/docker/.gitignore @@ -0,0 +1 @@ +fluvio_profile.* diff --git a/connector/docker/Dockerfile b/connector/docker/Dockerfile new file mode 100644 index 0000000000..711db547fc --- /dev/null +++ b/connector/docker/Dockerfile @@ -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/http-source@0.3.8 +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"] diff --git a/connector/docker/Makefile b/connector/docker/Makefile new file mode 100644 index 0000000000..2d83d82918 --- /dev/null +++ b/connector/docker/Makefile @@ -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) \ No newline at end of file diff --git a/connector/docker/README.md b/connector/docker/README.md new file mode 100644 index 0000000000..86ec3c38f0 --- /dev/null +++ b/connector/docker/README.md @@ -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. \ No newline at end of file diff --git a/connector/docker/connector.yaml b/connector/docker/connector.yaml new file mode 100644 index 0000000000..1b3e5299e0 --- /dev/null +++ b/connector/docker/connector.yaml @@ -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 \ No newline at end of file