Skip to content

Commit 5dcc08c

Browse files
Jan-ebbona-agentsfeilmeier
authored
[Common] Add Ona devcontainer environment setup (#3643)
Adds a dev container configuration so new contributors get a working environment automatically on first clone, without any manual setup. ## Changes - **`.devcontainer/Dockerfile`**: Java 21 (Microsoft OpenJDK) + Node.js 22 + Angular CLI - **`.devcontainer/devcontainer.json`**: forwards UI port (4200, opens in browser) and all OSGi console/API ports (8079–8085) - **`.ona/automations.yaml`**: runs `npm ci` on devcontainer start; manual build tasks for backend, edge, and all; services for the UI dev server, OpenEMS Backend, and OpenEMS Edge - **`ui/package-lock.json`**: synced with `package.json` (was missing `chokidar`, `glob-parent`, `readdirp`) ## Notes - The Backend and Edge services require their JARs to exist first — run the **Build Backend** / **Build Edge** tasks before starting those services. - Odoo is not included — it's an optional dependency not needed for core development. ## Open tasks - Update documentation https://openems.github.io/openems.io/openems/latest/simulation/gitpod.html / https://github.com/OpenEMS/openems/blob/develop/doc/modules/ROOT/pages/simulation/gitpod.adoc - Update README https://github.com/OpenEMS/openems/blob/develop/README.md - Provide a version with Odoo and Backend-Edge included - Rename /tools/gitpod/ folder to one or devcontainer Thank you for providing a detailed issue report: #3532 Co-authored-by: Sebastian Brandl <12988001+Sebigamer4@users.noreply.github.com> Co-authored-by: Ona <no-reply@ona.com> Co-authored-by: Stefan Feilmeier <stefan.feilmeier@fenecon.de>
1 parent fec71f0 commit 5dcc08c

File tree

4 files changed

+176
-0
lines changed

4 files changed

+176
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/devcontainers/java:21-jdk-bookworm
2+
3+
# Install Node.js 22
4+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
5+
&& apt-get install -y nodejs \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
# Install Angular CLI globally
9+
RUN npm install -g @angular/cli
10+
11+
# Disable Angular analytics
12+
ENV NG_CLI_ANALYTICS=false

.devcontainer/devcontainer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Dev container for OpenEMS — Java 21 (Gradle/OSGi) + Node.js 22 (Angular UI)
2+
{
3+
"name": "OpenEMS",
4+
"build": {
5+
"context": ".",
6+
"dockerfile": "Dockerfile"
7+
},
8+
"forwardPorts": [4200, 8080, 8079, 8081, 8082, 8084, 8085],
9+
"portsAttributes": {
10+
"4200": {
11+
"label": "OpenEMS UI",
12+
"onAutoForward": "openBrowserOnce"
13+
},
14+
"8080": {
15+
"label": "Edge - Felix Web Console",
16+
"onAutoForward": "ignore"
17+
},
18+
"8079": {
19+
"label": "Backend - Felix Web Console",
20+
"onAutoForward": "ignore"
21+
},
22+
"8081": {
23+
"label": "Backend - Edge Websocket",
24+
"onAutoForward": "ignore"
25+
},
26+
"8082": {
27+
"label": "Backend - UI Websocket",
28+
"onAutoForward": "ignore"
29+
},
30+
"8084": {
31+
"label": "Edge - JSON/REST API",
32+
"onAutoForward": "ignore"
33+
},
34+
"8085": {
35+
"label": "Edge - JSON/Websocket API",
36+
"onAutoForward": "ignore"
37+
}
38+
}
39+
}

.ona/automations.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
tasks:
2+
installUiDeps:
3+
name: Install UI dependencies
4+
description: Install npm dependencies for the Angular UI.
5+
command: cd ui && npm ci
6+
triggeredBy:
7+
- postDevcontainerStart
8+
9+
buildBackend:
10+
name: Build Backend
11+
description: Compile and assemble the OpenEMS Backend JAR (skips tests).
12+
command: ./gradlew buildBackend -x test
13+
triggeredBy:
14+
- manual
15+
16+
buildEdge:
17+
name: Build Edge
18+
description: Compile and assemble the OpenEMS Edge JAR (skips tests).
19+
command: ./gradlew buildEdge -x test
20+
triggeredBy:
21+
- manual
22+
23+
buildAll:
24+
name: Build All
25+
description: Compile backend, edge, and UI (skips tests).
26+
command: ./gradlew build buildBackend buildEdge -x test
27+
triggeredBy:
28+
- manual
29+
30+
services:
31+
uiDevServer:
32+
name: UI Dev Server
33+
description: Angular dev server for the OpenEMS UI on port 4200.
34+
commands:
35+
start: cd ui && ng serve -c openems-backend --host 0.0.0.0 --disable-host-check
36+
ready: curl -sf http://localhost:4200 > /dev/null
37+
38+
openemsBackend:
39+
name: OpenEMS Backend
40+
description: OpenEMS Backend OSGi runtime.
41+
commands:
42+
start: |
43+
java \
44+
-Dfelix.cm.dir=$(pwd)/tools/gitpod/openems-backend/config.d \
45+
-jar build/openems-backend.jar
46+
ready: curl -sf http://localhost:8082 > /dev/null
47+
48+
openemsEdge:
49+
name: OpenEMS Edge
50+
description: OpenEMS Edge OSGi runtime.
51+
commands:
52+
start: |
53+
java \
54+
-Dfelix.cm.dir=$(pwd)/tools/gitpod/openems-edge/config.d \
55+
-Dopenems.data.dir=$(pwd)/tools/gitpod/openems-edge/data \
56+
-jar build/openems-edge.jar
57+
ready: curl -sf http://localhost:8080 > /dev/null

ui/package-lock.json

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)