Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions kaas-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,19 @@ This example deploys a virtual IoT device management system as managed K8s conta

## Deployment

**Deploy via KaaS:**
```sh
1. **Build Docker images:** Clone the repository on the device and run the following commands
```bash
# Build Rust application
cd dummy-device-app
docker build -t k8s-at-the-edge-example-dummy-device-app:latest .

# Build React application
cd ../web-portal
docker build -t web-portal:latest .
```

2. **Deploy to Kubernetes:**
```bash
cd k8s

# Render K8s definitions for your node
Expand Down Expand Up @@ -70,3 +81,15 @@ docker compose up -d

3. Pull up the web-portal on local machine at http://localhost:3000
![web-portal](assets/device-mgmt-portal.png)

3. **Deploy via docker compose**

```sh
docker compose up -d
```

If local port forwarding then run on your local machine

```sh
ssh -L 8085:localhost:8085 -L 3000:localhost:3000 <remote-host>
```
25 changes: 24 additions & 1 deletion kaas-example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,33 @@ services:
interval: 10s
timeout: 5s
retries: 5
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "2"

dummy-device-app:
build:
context: ./dummy-device-app
dockerfile: Dockerfile
environment:
DATABASE_URL: postgres://postgres:password@postgres:5432/device_db
RUST_LOG: debug
PORT: 3000
volumes:
- /tmp:/tmp
ports:
- "3000:3000"
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "2"

web-portal:
build:
Expand All @@ -38,10 +51,15 @@ services:
environment:
REACT_APP_API_URL: http://localhost:3000
ports:
- "8080:80"
- "8085:80"
depends_on:
- dummy-device-app
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "2"

nginx:
image: nginx:alpine
Expand All @@ -53,6 +71,11 @@ services:
- web-portal
- dummy-device-app
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "2"

volumes:
postgres_data:
2 changes: 1 addition & 1 deletion kaas-example/dummy-device-app/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
DATABASE_URL=postgres://postgres:password@localhost:5432/device_db
RUST_LOG=info
RUST_LOG=debug
PORT=3000
5 changes: 4 additions & 1 deletion kaas-example/dummy-device-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ uuid = { version = "1.0", features = ["v4", "serde"] }
tracing = "0.1"
tracing-subscriber = "0.3"
anyhow = "1.0"
thiserror = "1.0"
thiserror = "1.0"
tokio-tungstenite = "0.20"
futures-util = "0.3"
base64 = "0.21"
Loading