Skip to content

Commit 55d79bd

Browse files
Add multiple dev container configurations
- Default: minimal Drasi Server dev environment for developers - Getting Started: tutorial with unique ports (8180/8181/5532) - Trading: auto-starts trading demo (8280/8281/9100/5632/5273) - Playground: auto-starts playground (8380/8381/5373) VS Code presents a picker when opening in a container.
1 parent fe19a70 commit 55d79bd

8 files changed

Lines changed: 282 additions & 26 deletions

File tree

β€Ž.devcontainer/devcontainer.jsonβ€Ž

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
"configureZshAsDefaultShell": true
1010
}
1111
},
12-
"initializeCommand": "docker network create drasi-network 2>/dev/null || true",
1312
"postCreateCommand": "bash .devcontainer/post-create.sh",
14-
"runArgs": ["--network=drasi-network"],
15-
"forwardPorts": [8080, 8081, 5432],
13+
"forwardPorts": [8080, 8081],
1614
"portsAttributes": {
1715
"8080": {
1816
"label": "Drasi Server API",
@@ -21,10 +19,6 @@
2119
"8081": {
2220
"label": "SSE Stream",
2321
"onAutoForward": "notify"
24-
},
25-
"5432": {
26-
"label": "PostgreSQL",
27-
"onAutoForward": "silent"
2822
}
2923
},
3024
"customizations": {
@@ -45,7 +39,6 @@
4539
},
4640
"remoteUser": "vscode",
4741
"containerEnv": {
48-
"RUST_BACKTRACE": "1",
49-
"DB_HOST": "getting-started-postgres"
42+
"RUST_BACKTRACE": "1"
5043
}
5144
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "Drasi Server - Getting Started Tutorial",
3+
"image": "mcr.microsoft.com/devcontainers/rust:1-bullseye",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
6+
"ghcr.io/devcontainers/features/git:1": {},
7+
"ghcr.io/devcontainers/features/common-utils:2": {
8+
"installZsh": true,
9+
"configureZshAsDefaultShell": true
10+
}
11+
},
12+
"initializeCommand": "docker network create drasi-network 2>/dev/null || true",
13+
"postCreateCommand": "bash .devcontainer/getting-started/post-create.sh",
14+
"runArgs": ["--network=drasi-network"],
15+
"forwardPorts": [8180, 8181, 5532],
16+
"portsAttributes": {
17+
"8180": {
18+
"label": "Drasi Server API",
19+
"onAutoForward": "notify"
20+
},
21+
"8181": {
22+
"label": "SSE Stream",
23+
"onAutoForward": "notify"
24+
},
25+
"5532": {
26+
"label": "PostgreSQL",
27+
"onAutoForward": "silent"
28+
}
29+
},
30+
"customizations": {
31+
"vscode": {
32+
"extensions": [
33+
"rust-lang.rust-analyzer",
34+
"tamasfe.even-better-toml",
35+
"humao.rest-client",
36+
"serayuzgur.crates",
37+
"vadimcn.vscode-lldb"
38+
],
39+
"settings": {
40+
"rust-analyzer.cargo.features": "all",
41+
"rust-analyzer.check.command": "clippy",
42+
"editor.formatOnSave": true
43+
}
44+
}
45+
},
46+
"remoteUser": "vscode",
47+
"containerEnv": {
48+
"RUST_BACKTRACE": "1",
49+
"DB_HOST": "getting-started-postgres",
50+
"SERVER_PORT": "8180",
51+
"SSE_PORT": "8181",
52+
"POSTGRES_PORT": "5532",
53+
"POSTGRES_HOST_PORT": "5532"
54+
}
55+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Post-create script for Drasi Server Getting Started tutorial
3+
4+
set -e
5+
6+
echo "πŸ”§ Initializing Drasi Server Getting Started tutorial environment..."
7+
8+
# Ensure the shared Docker network exists (for connecting to PostgreSQL container)
9+
echo "🌐 Creating shared Docker network..."
10+
docker network create drasi-network 2>/dev/null || true
11+
12+
# Install system dependencies
13+
echo "🐘 Installing system dependencies (PostgreSQL client, OpenSSL, Protobuf, Clang)..."
14+
sudo apt-get update && sudo apt-get install -y \
15+
postgresql-client \
16+
libssl-dev \
17+
pkg-config \
18+
protobuf-compiler \
19+
clang \
20+
libclang-dev
21+
22+
# Build and install Drasi Server
23+
echo "πŸ”¨ Building Drasi Server (this may take a few minutes)..."
24+
cargo install --path . --root . --locked
25+
26+
# Make scripts executable
27+
if [ -d "examples/getting-started/scripts" ]; then
28+
echo "πŸ“œ Making example scripts executable..."
29+
chmod +x examples/getting-started/scripts/*.sh
30+
fi
31+
32+
echo ""
33+
echo "βœ… Drasi Server Getting Started tutorial environment is ready!"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "Drasi Server - Playground",
3+
"image": "mcr.microsoft.com/devcontainers/rust:1-bullseye",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
6+
"ghcr.io/devcontainers/features/git:1": {},
7+
"ghcr.io/devcontainers/features/common-utils:2": {
8+
"installZsh": true,
9+
"configureZshAsDefaultShell": true
10+
},
11+
"ghcr.io/devcontainers/features/node:1": {
12+
"version": "22"
13+
}
14+
},
15+
"postCreateCommand": "bash .devcontainer/playground/post-create.sh",
16+
"forwardPorts": [8380, 5373],
17+
"portsAttributes": {
18+
"8380": {
19+
"label": "Drasi Server API",
20+
"onAutoForward": "notify"
21+
},
22+
"5373": {
23+
"label": "Playground App",
24+
"onAutoForward": "notify"
25+
}
26+
},
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"rust-lang.rust-analyzer",
31+
"tamasfe.even-better-toml",
32+
"humao.rest-client",
33+
"serayuzgur.crates",
34+
"vadimcn.vscode-lldb"
35+
],
36+
"settings": {
37+
"rust-analyzer.cargo.features": "all",
38+
"rust-analyzer.check.command": "clippy",
39+
"editor.formatOnSave": true
40+
}
41+
}
42+
},
43+
"remoteUser": "vscode",
44+
"containerEnv": {
45+
"RUST_BACKTRACE": "1"
46+
}
47+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# Post-create script for Drasi Server Playground
3+
4+
set -e
5+
6+
echo "πŸ”§ Initializing Drasi Server Playground environment..."
7+
8+
# Install system dependencies
9+
echo "πŸ“¦ Installing system dependencies (OpenSSL, Protobuf, Clang)..."
10+
sudo apt-get update && sudo apt-get install -y \
11+
libssl-dev \
12+
pkg-config \
13+
protobuf-compiler \
14+
clang \
15+
libclang-dev
16+
17+
# Build Drasi Server
18+
echo "πŸ”¨ Building Drasi Server (this may take a few minutes)..."
19+
cargo build --release
20+
21+
# Make scripts executable
22+
chmod +x examples/playground/start.sh examples/playground/stop.sh
23+
24+
# Start the playground in background
25+
echo "πŸš€ Starting Playground..."
26+
nohup bash examples/playground/start.sh > /tmp/playground-startup.log 2>&1 &
27+
28+
echo ""
29+
echo "βœ… Drasi Server Playground is starting!"
30+
echo " Check startup progress: tail -f /tmp/playground-startup.log"
31+
echo " Playground App: http://localhost:5373"
32+
echo " Drasi API: http://localhost:8380"

β€Ž.devcontainer/post-create.shβ€Ž

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
#!/bin/bash
2-
# Post-create script for Drasi Server devcontainer
2+
# Post-create script for Drasi Server default development environment
33

44
set -e
55

66
echo "πŸ”§ Initializing Drasi Server development environment..."
77

8-
# Ensure the shared Docker network exists (for connecting to PostgreSQL container)
9-
echo "🌐 Creating shared Docker network..."
10-
docker network create drasi-network 2>/dev/null || true
11-
12-
# Install PostgreSQL client for database interactions
13-
echo "🐘 Installing system dependencies (PostgreSQL client, OpenSSL, Protobuf, Clang)..."
8+
# Install system dependencies
9+
echo "πŸ“¦ Installing system dependencies (OpenSSL, Protobuf, Clang)..."
1410
sudo apt-get update && sudo apt-get install -y \
15-
postgresql-client \
1611
libssl-dev \
1712
pkg-config \
1813
protobuf-compiler \
1914
clang \
2015
libclang-dev
2116

22-
# Build and install Drasi Server
17+
# Build Drasi Server
2318
echo "πŸ”¨ Building Drasi Server (this may take a few minutes)..."
24-
cargo install --path . --root . --locked
25-
26-
# Make scripts executable
27-
if [ -d "examples/getting-started/scripts" ]; then
28-
echo "πŸ“œ Making example scripts executable..."
29-
chmod +x examples/getting-started/scripts/*.sh
30-
fi
19+
cargo build
3120

3221
echo ""
33-
echo "βœ… Drasi Server Getting Started tutorial environment is ready!"
22+
echo "βœ… Drasi Server development environment is ready!"
23+
echo ""
24+
echo "Getting started:"
25+
echo " cargo run -- --config <your-config.yaml>"
26+
echo " cargo test"
27+
echo ""
28+
echo "See examples/ for sample configurations."
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "Drasi Server - Trading Demo",
3+
"image": "mcr.microsoft.com/devcontainers/rust:1-bullseye",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
6+
"ghcr.io/devcontainers/features/git:1": {},
7+
"ghcr.io/devcontainers/features/common-utils:2": {
8+
"installZsh": true,
9+
"configureZshAsDefaultShell": true
10+
},
11+
"ghcr.io/devcontainers/features/node:1": {
12+
"version": "22"
13+
},
14+
"ghcr.io/devcontainers/features/python:2": {
15+
"version": "3.12"
16+
}
17+
},
18+
"initializeCommand": "docker network create drasi-network 2>/dev/null || true",
19+
"postCreateCommand": "bash .devcontainer/trading/post-create.sh",
20+
"runArgs": ["--network=drasi-network"],
21+
"forwardPorts": [8280, 9100, 5632, 5273],
22+
"portsAttributes": {
23+
"8280": {
24+
"label": "Drasi Server API",
25+
"onAutoForward": "notify"
26+
},
27+
"9100": {
28+
"label": "HTTP Source",
29+
"onAutoForward": "silent"
30+
},
31+
"5632": {
32+
"label": "PostgreSQL",
33+
"onAutoForward": "silent"
34+
},
35+
"5273": {
36+
"label": "Trading App",
37+
"onAutoForward": "notify"
38+
}
39+
},
40+
"customizations": {
41+
"vscode": {
42+
"extensions": [
43+
"rust-lang.rust-analyzer",
44+
"tamasfe.even-better-toml",
45+
"humao.rest-client",
46+
"serayuzgur.crates",
47+
"vadimcn.vscode-lldb"
48+
],
49+
"settings": {
50+
"rust-analyzer.cargo.features": "all",
51+
"rust-analyzer.check.command": "clippy",
52+
"editor.formatOnSave": true
53+
}
54+
}
55+
},
56+
"remoteUser": "vscode",
57+
"containerEnv": {
58+
"RUST_BACKTRACE": "1"
59+
}
60+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Post-create script for Drasi Server Trading Demo
3+
4+
set -e
5+
6+
echo "πŸ”§ Initializing Drasi Server Trading Demo environment..."
7+
8+
# Ensure the shared Docker network exists
9+
echo "🌐 Creating shared Docker network..."
10+
docker network create drasi-network 2>/dev/null || true
11+
12+
# Install system dependencies
13+
echo "πŸ“¦ Installing system dependencies (PostgreSQL client, OpenSSL, Protobuf, Clang)..."
14+
sudo apt-get update && sudo apt-get install -y \
15+
postgresql-client \
16+
libssl-dev \
17+
pkg-config \
18+
protobuf-compiler \
19+
clang \
20+
libclang-dev
21+
22+
# Build Drasi Server
23+
echo "πŸ”¨ Building Drasi Server (this may take a few minutes)..."
24+
cargo build --release
25+
26+
# Install Python dependencies for price generator
27+
echo "🐍 Installing Python dependencies..."
28+
pip3 install requests
29+
30+
# Make scripts executable
31+
chmod +x examples/trading/start-demo.sh examples/trading/stop-demo.sh
32+
33+
# Start the trading demo in background
34+
echo "πŸš€ Starting Trading Demo..."
35+
nohup bash examples/trading/start-demo.sh > /tmp/trading-demo-startup.log 2>&1 &
36+
37+
echo ""
38+
echo "βœ… Drasi Server Trading Demo is starting!"
39+
echo " Check startup progress: tail -f /tmp/trading-demo-startup.log"
40+
echo " Trading App: http://localhost:5273"
41+
echo " Drasi API: http://localhost:8280"

0 commit comments

Comments
Β (0)