-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add devcontainer template * Add easy-setup script `setup-devcontainer.sh` * Move `mosquitto` image from `everest-utils` repository * Move `steve` image from `everest-utils` repository * Add nodered image * Update README.md * Add `everest_dev_tool` Signed-off-by: Andreas Heinrich <[email protected]>
- Loading branch information
Showing
23 changed files
with
1,857 additions
and
0 deletions.
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,100 @@ | ||
name: Build and push docker images | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
DOCKER_DIRECTORY: docker/images | ||
PLATFORMS: | | ||
linux/amd64 | ||
PATH_TO_DEPLOY_DOCKER_IMAGES_WORKFLOW: .github/workflows/deploy-docker-images.yml | ||
|
||
jobs: | ||
env-setup: | ||
# Since env variables can't be passed to reusable workflows, we need to pass them as outputs | ||
name: Setup environment | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
docker_registry: ${{ env.REGISTRY }} | ||
docker_directory: ${{ env.DOCKER_DIRECTORY }} | ||
platforms: ${{ env.PLATFORMS }} | ||
path_to_deploy_docker_images_workflow: ${{ env.PATH_TO_DEPLOY_DOCKER_IMAGES_WORKFLOW }} | ||
steps: | ||
- id: check | ||
run: | | ||
echo "Setting up environment" | ||
mosquitto: | ||
needs: | ||
- env-setup | ||
name: Build and push mosquitto docker image | ||
uses: everest/everest-ci/.github/workflows/[email protected] | ||
secrets: | ||
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }} | ||
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/mosquitto | ||
directory: ${{ needs.env-setup.outputs.docker_directory }}/mosquitto | ||
docker_registry: ${{ needs.env-setup.outputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: ${{ needs.env-setup.outputs.platforms }} | ||
depends_on_paths: | | ||
${{ needs.env-setup.outputs.path_to_deploy_docker_images_workflow }} | ||
steve: | ||
needs: | ||
- env-setup | ||
name: Build and push steve docker image | ||
uses: everest/everest-ci/.github/workflows/[email protected] | ||
secrets: | ||
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }} | ||
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/steve | ||
directory: ${{ needs.env-setup.outputs.docker_directory }}/steve | ||
docker_registry: ${{ needs.env-setup.outputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: ${{ needs.env-setup.outputs.platforms }} | ||
depends_on_paths: | | ||
${{ needs.env-setup.outputs.path_to_deploy_docker_images_workflow }} | ||
mqtt-explorer: | ||
needs: | ||
- env-setup | ||
name: Build and push mqtt-explorer docker image | ||
uses: everest/everest-ci/.github/workflows/[email protected] | ||
secrets: | ||
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }} | ||
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/mqtt-explorer | ||
directory: ${{ needs.env-setup.outputs.docker_directory }}/mqtt-explorer | ||
docker_registry: ${{ needs.env-setup.outputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: ${{ needs.env-setup.outputs.platforms }} | ||
depends_on_paths: | | ||
${{ needs.env-setup.outputs.path_to_deploy_docker_images_workflow }} | ||
nodered: | ||
needs: | ||
- env-setup | ||
name: Build and push nodered docker image | ||
uses: everest/everest-ci/.github/workflows/[email protected] | ||
secrets: | ||
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }} | ||
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/nodered | ||
directory: ${{ needs.env-setup.outputs.docker_directory }}/nodered | ||
docker_registry: ${{ needs.env-setup.outputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: ${{ needs.env-setup.outputs.platforms }} | ||
depends_on_paths: | | ||
${{ needs.env-setup.outputs.path_to_deploy_docker_images_workflow }} | ||
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
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,39 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
read -p "Enter the workspace directory (default is the current directory): " WORKSPACE_DIR | ||
if [ -z "$WORKSPACE_DIR" ]; then | ||
WORKSPACE_DIR="./" | ||
fi | ||
WORKSPACE_DIR=$(realpath -m "$WORKSPACE_DIR") | ||
|
||
read -p "Enter the version of the everest-dev-environment (default is 'main'): " VERSION | ||
if [ -z "$VERSION" ]; then | ||
VERSION="main" | ||
fi | ||
|
||
echo "Create the workspace directory '$WORKSPACE_DIR' if it does not exist" | ||
mkdir -p $WORKSPACE_DIR | ||
|
||
if [ "$(ls -A $WORKSPACE_DIR)" ]; then | ||
# The workspace directory is not empty, warning do you want to continue? | ||
read -p "The workspace directory is not empty, do you want to continue? (y/N): " -r | ||
if [[ $REPLY =~ ^[Nn]$ || $REPLY = "" ]]; then | ||
echo "Exiting.." | ||
exit 1 | ||
elif [[ ! $REPLY =~ ^[Yy]$ ]]; then | ||
echo "Invalid input. Exiting.." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
TMP_DIR="$WORKSPACE_DIR/tmp-everest-dev-environment" | ||
echo "Clone the everest-dev-environment repository to the workspace directory with the version $VERSION, temporarily.." | ||
git clone --quiet --depth 1 --single-branch --branch "$VERSION" https://github.com/EVerest/everest-dev-environment.git "$TMP_DIR" | ||
|
||
echo "Copy the template devcontainer configuration files to the workspace directory" | ||
cp -n -r $TMP_DIR/devcontainer/template/. $WORKSPACE_DIR/ | ||
|
||
echo "Remove the everest-dev-environment repository" | ||
rm -rf "$TMP_DIR" |
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,40 @@ | ||
volumes: | ||
ocpp-db-data: | ||
external: false | ||
node-red-data: | ||
external: false | ||
|
||
services: | ||
mqtt-server: | ||
image: ghcr.io/everest/everest-dev-environment/mosquitto:v0.7.0 | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 1883-1983:1883 | ||
- 9001-9101:9001 | ||
|
||
ocpp-db: | ||
image: mariadb:10.4.30 # pinned to patch-version because https://github.com/steve-community/steve/pull/1213 | ||
volumes: | ||
- ocpp-db-data:/var/lib/mysql | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 13306-13406:3306 | ||
environment: | ||
MYSQL_RANDOM_ROOT_PASSWORD: "yes" | ||
MYSQL_DATABASE: ocpp-db | ||
MYSQL_USER: ocpp | ||
MYSQL_PASSWORD: ocpp | ||
steve: | ||
image: ghcr.io/everest/everest-dev-environment/steve:v0.7.0 | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 8180-8280:8180 | ||
- 8443-8543:8443 | ||
depends_on: | ||
- ocpp-db | ||
mqtt-explorer: | ||
image: ghcr.io/everest/everest-dev-environment/mqtt-explorer:v0.7.0 | ||
depends_on: | ||
- mqtt-server | ||
ports: | ||
- 4000-4100:4000 |
17 changes: 17 additions & 0 deletions
17
devcontainer/template/.devcontainer/general-devcontainer/Dockerfile
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,17 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM ghcr.io/everest/everest-ci/dev-env-base:v1.3.2 | ||
|
||
# Update the package list | ||
RUN sudo apt update | ||
Check failure on line 5 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L5
|
||
|
||
# EVerest Development Tool - Dependencies | ||
RUN pip install --break-system-packages \ | ||
docker==7.1.0 | ||
# EVerest Development Tool | ||
ARG DEV_ENV_TOOL_VERSION=v0.7.0 | ||
RUN python3 -m pip install --break-system-packages \ | ||
git+https://github.com/EVerest/everest-dev-environment@${DEV_ENV_TOOL_VERSION}#subdirectory=everest_dev_tool | ||
|
||
RUN echo "echo \"🏔️ 🚘 Welcome to the EVerest development environment!\"" >> ${HOME}/.bashrc | ||
Check notice on line 15 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L15
|
||
RUN echo "echo \"To initialize the EVerest core repository everest-core in your workspace please run the following command:\"" >> ${HOME}/.bashrc | ||
RUN echo "echo \"everest clone everest-core\"" >> ${HOME}/.bashrc | ||
Check notice on line 17 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L17
|
63 changes: 63 additions & 0 deletions
63
devcontainer/template/.devcontainer/general-devcontainer/devcontainer.json
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,63 @@ | ||
{ | ||
"name": "EVerest - ${localWorkspaceFolderBasename}", | ||
"dockerComposeFile": ["../docker-compose.yml", "./docker-compose.devcontainer.yml"], | ||
"service": "devcontainer", | ||
"runServices": ["devcontainer"], | ||
"remoteUser": "docker", | ||
"workspaceFolder": "/workspace", | ||
"forwardPorts": [ | ||
"mqtt-explorer:4000", | ||
"steve:8180" | ||
], | ||
"portsAttributes": { | ||
"mqtt-explorer:4000": { | ||
"label": "MQTT Explorer - WebView" | ||
}, | ||
"steve:8180": { | ||
"label": "Steve - WebTool" | ||
} | ||
}, | ||
"otherPortsAttributes": { | ||
"onAutoForward": "notify", | ||
"protocol": "http", | ||
"requireLocalPort": false | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.profiles.linux": { | ||
"bash": { | ||
"path": "/bin/bash", | ||
"icon": "terminal-bash", | ||
"args": ["-l"] | ||
} | ||
}, | ||
"terminal.integrated.defaultProfile.linux": "bash", | ||
"python.pythonPath": "/usr/bin/python3", | ||
"python.defaultInterpreterPath": "/usr/bin/python3", | ||
"editor.rulers": [79, 120], | ||
// RST/Sphinx language server | ||
"esbonio.sphinx.buildDir": "${workspaceFolder}/everest/docs/_build", | ||
"esbonio.sphinx.confDir": "${workspaceFolder}/everest/docs", | ||
// RST | ||
"restructuredtext.preview.scrollEditorWithPreview": false, | ||
"restructuredtext.pythonRecommendation.disabled": true, | ||
"liveServer.settings.root": "/everest/docs/_build/html" | ||
}, | ||
"extensions": [ | ||
// language support CPP | ||
"ms-vscode.cpptools", | ||
// language support cmake | ||
"twxs.cmake", | ||
"ms-vscode.cmake-tools", | ||
// language support python | ||
"ms-python.python", | ||
// language support restructured text | ||
"lextudio.restructuredtext", | ||
"trond-snekvik.simple-rst", | ||
// doc live server | ||
"ritwickdey.liveserver" | ||
] | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
devcontainer/template/.devcontainer/general-devcontainer/docker-compose.devcontainer.yml
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,48 @@ | ||
networks: | ||
docker-proxy-network: | ||
internal: true | ||
|
||
volumes: | ||
cpm-source-cache: | ||
name: everest-cpm-source-cache | ||
|
||
services: | ||
docker-proxy: | ||
image: tecnativa/docker-socket-proxy:latest | ||
volumes: | ||
- type: bind | ||
source: /var/run/docker.sock | ||
target: /var/run/docker.sock | ||
environment: | ||
- CONTAINERS=1 | ||
- IMAGES=1 | ||
- POST=1 | ||
- NETWORKS=1 | ||
- VOLUMES=1 | ||
networks: | ||
- docker-proxy-network | ||
|
||
devcontainer: | ||
depends_on: | ||
- docker-proxy | ||
build: | ||
context: ./general-devcontainer | ||
dockerfile: Dockerfile | ||
volumes: | ||
- type: bind | ||
source: .. | ||
target: /workspace | ||
- type: volume | ||
source: cpm-source-cache | ||
target: /home/docker/.cache/cpm | ||
command: sleep infinity | ||
environment: | ||
MQTT_SERVER_ADDRESS: mqtt-server | ||
MQTT_SERVER_PORT: 1883 | ||
DOCKER_HOST: tcp://docker-proxy:2375 | ||
CPM_SOURCE_CACHE: /home/docker/.cache/cpm | ||
networks: | ||
- docker-proxy-network | ||
- default | ||
sysctls: | ||
- net.ipv6.conf.all.disable_ipv6=0 |
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,3 @@ | ||
FROM eclipse-mosquitto:2.0.10 | ||
|
||
COPY mosquitto.conf /mosquitto/config/mosquitto.conf |
Oops, something went wrong.