-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(examples): add docker compose example #3910
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cdec78a
chore(examples): add docker compose example
EstebanBorai a26681b
feat: readme with instructions
EstebanBorai 9872cfc
fix: rm justfile
EstebanBorai 68d278d
fix: remove `--build` option
EstebanBorai 60a2e42
fix: metadata volume
EstebanBorai 0a92722
fix: produce
EstebanBorai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,8 @@ | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y curl unzip | ||
RUN curl -fsS https://hub.infinyon.cloud/install/install.sh?ctx=dc | bash | ||
|
||
ENV PATH "$PATH:/root/.fluvio/bin" | ||
ENV PATH "$PATH:/root/.fvm/bin" |
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,60 @@ | ||
# Docker Compose + Fluvio | ||
|
||
You can run Fluvio Clusters in a Docker Compose setup, this could be useful for | ||
local development and POC development. | ||
|
||
In order to run a Fluvio Cluster through Docker, you will need to run Fluvio | ||
components separately, we can use Docker Compose `service`s to achieve this. | ||
|
||
## Services | ||
|
||
- `sc: Streaming Controller` | ||
- `sc-setup: Post-Initialization Commands` | ||
- `spu: Streaming Processing Unit` | ||
|
||
> To learn more about Fluvio architecture, please refer to [Fluvio Documentation][1] | ||
|
||
## Running Locally | ||
|
||
Clone this repo using `git clone https://github.com/infinyon/fluvio.git` and | ||
cd into `./fluvio/examples/docker-compose`, then run `docker compose up`. | ||
|
||
> Optionally you can run on detached mode `docker compose up -d` so | ||
> Fluvio runs in the background. | ||
|
||
Then use the `fluvio` CLI to connect to the cluster running in Docker, to do | ||
that you must set the _Fluvio Profile_ to point to Docker's container SC: | ||
|
||
> If you dont have the Fluvio CLI installed, run the following command | ||
> `curl -fsS https://hub.infinyon.cloud/install/install.sh | bash`. | ||
> Refer to [Fluvio CLI Reference][2] for more details. | ||
|
||
```bash | ||
fluvio profile add docker 127.0.0.1:9103 docker | ||
``` | ||
|
||
> Fluvio Streaming Controller (SC) usually runs on port `9003` but given that our | ||
> SC is running in a Docker Container, internal port `9003` is mapped to `9103` | ||
> in your system's network. | ||
|
||
With the profile set, you are now able to perform Fluvio Client operations | ||
like listing topics: | ||
|
||
```bash | ||
fluvio topics list | ||
``` | ||
|
||
## Teardown | ||
|
||
In order to shutdown the Fluvio Cluster running in Docker, you must issue the | ||
following `compose` command: | ||
|
||
```bash | ||
docker compose down | ||
``` | ||
|
||
> Remember to run this command in the same directory as the `docker-compose.yml` | ||
> file. | ||
|
||
[1]: https://www.fluvio.io/docs/architecture/overview/ | ||
[2]: https://www.fluvio.io/cli/ |
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,42 @@ | ||
version: "3" | ||
services: | ||
sc: | ||
image: infinyon/fluvio:stable | ||
container_name: sc | ||
hostname: sc | ||
ports: | ||
- "9103:9003" | ||
environment: | ||
- RUST_LOG=info | ||
command: "./fluvio-run sc --local /fluvio/metadata" | ||
digikata marked this conversation as resolved.
Show resolved
Hide resolved
|
||
volumes: | ||
- ./fluvio-metadata:/fluvio/metadata | ||
sc-setup: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: sc-setup | ||
environment: | ||
- RUST_LOG=info | ||
entrypoint: > | ||
/bin/sh -c " | ||
fluvio profile add docker sc:9003 docker; | ||
fluvio cluster spu register --id 5001 -p 0.0.0.0:9110 --private-server spu:9011; | ||
exit 0; | ||
" | ||
depends_on: | ||
- sc | ||
spu: | ||
image: infinyon/fluvio:stable | ||
container_name: spu | ||
hostname: spu | ||
volumes: | ||
- ./fluvio-data:/fluvio/data | ||
environment: | ||
- RUST_LOG=info | ||
ports: | ||
- "9110:9010" | ||
- "9111:9011" | ||
command: "./fluvio-run spu -i 5001 -p spu:9010 -v spu:9011 --sc-addr sc:9004 --log-base-dir /fluvio/data" | ||
depends_on: | ||
- sc |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need to add
mkdir metadata data
. This makes it so starting back up retains both the metadata state and the data of the compose cluster.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker takes care of creating them! I prefixed with
fluvio-
in the user side to avoid conflicts with local dirs!