Skip to content

Commit 73a244a

Browse files
Improve devcontainer, add workflow doc (#430)
* Improve devcontainer, add workflow doc Signed-off-by: George <bulakh.96@gmail.com> * Markdown fixes Signed-off-by: George <bulakh.96@gmail.com> --------- Signed-off-by: George <bulakh.96@gmail.com>
1 parent 556a6be commit 73a244a

File tree

8 files changed

+112
-46
lines changed

8 files changed

+112
-46
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ ARG USERNAME=user
77
RUN useradd -m $USERNAME && usermod -aG sudo $USERNAME
88
RUN echo "user:pass" | chpasswd
99

10+
# Set locale to fix pg-embed startup
11+
ENV LC_ALL=en_US.UTF-8
12+
1013
## Install common dependencies
1114

1215
RUN apt-get update && \
@@ -36,20 +39,19 @@ RUN npm install --global openapi-typescript-codegen
3639

3740
# Switch to non-root user
3841
USER $USERNAME
42+
ENV HOME /home/$USERNAME
3943

4044
## Install rustup and common components
4145

4246
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
43-
ENV PATH="/root/.cargo/bin:/root/.cargo/env:${PATH}"
47+
ENV PATH="$HOME/.cargo/bin:$PATH"
4448

45-
SHELL ["/bin/bash", "-c"]
46-
RUN source "$HOME/.cargo/env" && \
49+
RUN \
4750
rustup install nightly && \
4851
rustup component add rustfmt && \
4952
rustup component add rustfmt --toolchain nightly && \
5053
rustup component add clippy && \
51-
rustup component add clippy --toolchain nightly
52-
SHELL ["/bin/sh", "-c"]
54+
rustup component add clippy --toolchain nightly && \
55+
cargo install cargo-make
5356

54-
# Set locale to fix pg-embed startup
55-
ENV LC_ALL=en_US.UTF-8
57+
ENV PATH="$HOME/.local/bin:$PATH"

.devcontainer/Dockerfile.script

Lines changed: 0 additions & 9 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
22
"name": "DBSP",
3-
"dockerFile": "Dockerfile",
3+
"dockerComposeFile": [
4+
"./docker-compose.devcontainer.yml",
5+
"../deploy/docker-compose.yml"
6+
],
7+
"service": "workspace",
8+
"runServices": [
9+
"redpanda"
10+
],
11+
"workspaceFolder": "/workspaces/dbsp",
12+
"shutdownAction": "stopCompose",
413
"customizations": {
514
"vscode": {
615
"extensions": [
@@ -19,5 +28,10 @@
1928
}
2029
}
2130
}
22-
}
23-
}
31+
},
32+
"remoteUser": "user",
33+
"mounts": [
34+
"source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind"
35+
],
36+
"postCreateCommand": "chmod +x /workspaces/dbsp/.devcontainer/postCreate.sh && /workspaces/dbsp/.devcontainer/postCreate.sh"
37+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
workspace:
3+
build:
4+
context: .
5+
# Note that the path of the Dockerfile and context is relative to the *primary*
6+
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
7+
# array).
8+
dockerfile: Dockerfile
9+
tty: true
10+
environment:
11+
- RUST_BACKTRACE=1
12+
- REDPANDA_BROKERS=redpanda:9092

.devcontainer/postCreate.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Build dbsp python library
2+
cd ./crates/pipeline_manager && cargo make openapi_python

.devcontainer/setup.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/docs/guides/dev-flow.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Development workflow
2+
3+
## Develop from Devcontainer
4+
5+
A simple way to start interacting with the Feldera source code is via the supplied Devcontainer. It will prepare an environment which will let you build and run all components of Feldera out-of-the-box.
6+
7+
Spin up the Devcontainer, e.g. by opening the Feldera repository in VS Code with [Dev Containers](vscode:extension/ms-vscode-remote.remote-containers) extension enabled.
8+
9+
On your first launch you might need to change the ownership of the files:
10+
```bash
11+
sudo chown -R user /workspaces/dbsp
12+
```
13+
14+
Build the SQL Compiler:
15+
16+
```bash
17+
mvn -f ./sql-to-dbsp-compiler/SQL-compiler -DskipTests package
18+
```
19+
20+
Build and start the Pipeline Manager (that also serves the Feldera Web Console):
21+
22+
```bash
23+
RUST_LOG=info RUST_BACKTRACE=1 cargo run --bin dbsp_pipeline_manager --features pg-embed -- --manager-working-directory ~/.dbsp -d postgres-embed --dev-mode --bind-address 0.0.0.0 --sql-compiler-home ./sql-to-dbsp-compiler --dbsp-override-path . --compiler-working-directory ~/.dbsp
24+
```
25+
26+
> Here, `~/.dbsp` is the directory that will host compilation artifacts of SQL Compiler that Pipeline Manager will then use. It will be created if it doesn't exist, and you can use another name for it - just replace corresponding arguments in the above command.
27+
28+
> `--dbsp-override-path .` should be the path of the Feldera repository root - so update the argument if you are running from a different directory.
29+
30+
You should now be able to access the Web Console at http://localhost:8080/, connected to your local Pipeline Manager instance!
31+
32+
You can also open Web Console in dev mode to be able to see your changes to it live:
33+
34+
```bash
35+
cd web-ui && yarn install && yarn dev
36+
```
37+
38+
The Web Console in dev mode is available at http://localhost:3000/
39+
40+
Now you can proceed with the [demo](#manually-starting-the-demos).
41+
42+
## Develop on your machine
43+
44+
TODO
45+
46+
## Launch the prepared demo
47+
48+
Refer to the (Get Started page)[../intro] for basic instructions on spinning up and interacting with the demos from a separate docker-compose.
49+
50+
## Manually starting the demos
51+
52+
You can prepare and run multiple demos. To prepare a demo, launch Pipeline Manager and navigate to the directory of the demo, e.g.
53+
```bash
54+
cd demo/project_demo00-SecOps
55+
```
56+
57+
If the `simulator` directory exists - the following command generates simulated input data and creates the required Kafka input and output topics:
58+
```bash
59+
cargo run --manifest-path simulator/Cargo.toml --release -- 300000
60+
```
61+
62+
> For SecOps demo, argument `300000` specifies the number of simulated CI pipelines to be generated, which impacts duration of the demo and system load. YMMV!
63+
64+
Use `dbsp` python library to create and compile SQL Program, and prepare the Pipeline that utilizes them.
65+
```bash
66+
python3 run.py --dbsp_url http://localhost:8080 --actions prepare
67+
```
68+
69+
> You should update `--dbsp_url` depending on where Pipeline Manager is getting served from.
70+
71+
Now you can see the prepared demos on the Pipeline Management page of the Web Console.

docs/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const sidebars = {
3636
label: "Guides",
3737
items: [
3838
"guides/overview",
39+
"guides/dev-flow",
3940
"guides/rust",
4041
"guides/sql"
4142
],

0 commit comments

Comments
 (0)