Skip to content

Commit

Permalink
remove dapr (#86)
Browse files Browse the repository at this point in the history
* remove dapr

* fix licenses

* fix licenses again...

* fix tags and templates
  • Loading branch information
MP91 authored Mar 22, 2024
1 parent 7128363 commit aef778d
Show file tree
Hide file tree
Showing 42 changed files with 298 additions and 203,851 deletions.
26 changes: 0 additions & 26 deletions .dapr/config.yaml

This file was deleted.

9 changes: 2 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
Expand All @@ -12,16 +12,11 @@
#
# SPDX-License-Identifier: Apache-2.0

FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.2
FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/cpp:v0.3

ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE
ENV REINSTALL_CMAKE_VERSION_FROM_SOURCE="${REINSTALL_CMAKE_VERSION_FROM_SOURCE:-none}"

# Force dapr to use localhost traffic
ENV DAPR_HOST_IP="127.0.0.1"
# Add daprd to the path for the VS Code Dapr extension.
ENV PATH=$PATH:/home/vscode/.dapr/bin

COPY scripts/*.sh /tmp/scripts/
RUN find /tmp/scripts/ -type f -iname "*.sh" -exec chmod +x {} \;
RUN /bin/bash /tmp/scripts/configure-proxies.sh
54 changes: 6 additions & 48 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/cpp
{
"name": "Vehicle App C++ SDK",
"name": "C++ vehicle sdk",
"build": {
"dockerfile": "Dockerfile"
},
Expand Down Expand Up @@ -45,19 +46,7 @@
},
"vsmqtt.brokerProfiles": [
{
"name": "mosquitto (local)",
"host": "localhost",
"port": 1883,
"clientId": "vsmqtt_client"
},
{
"name": "mosquitto (k3d)",
"host": "localhost",
"port": 31883,
"clientId": "vsmqtt_client"
},
{
"name": "mosquitto (kanto)",
"name": "mosquitto",
"host": "localhost",
"port": 1883,
"clientId": "vsmqtt_client"
Expand Down Expand Up @@ -112,46 +101,14 @@
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"any": "cpp",
"bitset": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"forward_list": "cpp",
"set": "cpp",
"unordered_set": "cpp",
"algorithm": "cpp",
"iterator": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"ranges": "cpp",
"sstream": "cpp",
"valarray": "cpp",
"variant": "cpp",
"*.inc": "cpp",
"regex": "cpp",
"shared_mutex": "cpp",
"hash_map": "cpp",
"cfenv": "cpp",
"complex": "cpp",
"scoped_allocator": "cpp",
"typeindex": "cpp"
"utility": "cpp"
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"ms-azuretools.vscode-dapr",
"rpdswtk.vsmqtt",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"bierner.markdown-mermaid",
"cschlosser.doxdocgen",
"xaver.clang-format",
Expand All @@ -165,7 +122,8 @@
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'onCreateCommand' to run commands when the container is created.
"onCreateCommand": "bash .devcontainer/scripts/post-create.sh",
"onCreateCommand": "bash .devcontainer/scripts/onCreateCommand.sh",
"postStartCommand": "bash .devcontainer/scripts/postStartCommand.sh",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
1 change: 1 addition & 0 deletions .devcontainer/scripts/configure-proxies.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
Expand Down
24 changes: 7 additions & 17 deletions .dapr/components/pubsub.yaml → .devcontainer/scripts/container-set.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
Expand All @@ -12,20 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: mqtt-pubsub
namespace: default
spec:
type: pubsub.mqtt
version: v1
metadata:
- name: url
value: "mqtt://localhost:1883"
- name: qos
value: 1
- name: retain
value: "false"
- name: cleanSession
value: "false"
echo "#######################################################"
echo "### Checking container creation ###"
echo "#######################################################"
useradd vscode --password vscode -m
usermod -aG sudo vscode
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/bin/bash
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -67,6 +68,12 @@ if [ "${CODESPACES}" = "true" ]; then
git config --global credential.helper '!f() { sleep 1; echo "username=${GITHUB_USER}"; echo "password=${MY_GH_TOKEN}"; }; f'
fi

echo "#######################################################"
echo "### Init submodules ###"
echo "#######################################################"
git config --global --add safe.directory "*"
git submodule update --init

echo "#######################################################"
echo "### Install Dependencies ###"
echo "#######################################################"
Expand Down
81 changes: 81 additions & 0 deletions .devcontainer/scripts/postStartCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

echo "#######################################################"
echo "### Auto-Upgrade CLI ###"
echo "#######################################################"

ROOT_DIRECTORY=$( realpath "$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/../.." )
DESIRED_VERSION=$(cat $ROOT_DIRECTORY/.velocitas.json | jq .cliVersion | tr -d '"')

# Get installed CLI version
INSTALLED_VERSION=v$(velocitas --version | sed -E 's/velocitas-cli\/(\w+.\w+.\w+).*/\1/')

if [ "$DESIRED_VERSION" = "$INSTALLED_VERSION" ]; then
echo "> Already up to date!"
exit 0
else
echo "> Checking upgrade to $DESIRED_VERSION"
fi

AUTHORIZATION_HEADER=""
if [ "${GITHUB_API_TOKEN}" != "" ]; then
AUTHORIZATION_HEADER="-H \"Authorization: Bearer ${GITHUB_API_TOKEN}\""
fi

if [ "$DESIRED_VERSION" = "latest" ]; then
CLI_RELEASES_URL=https://api.github.com/repos/eclipse-velocitas/cli/releases/latest
else
CLI_RELEASES_URL=https://api.github.com/repos/eclipse-velocitas/cli/releases/tags/${DESIRED_VERSION}
fi

CLI_RELEASES=$(curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
${AUTHORIZATION_HEADER} \
${CLI_RELEASES_URL})

res=$?
if test "$res" != "0"; then
echo "the curl command failed with exit code: $res"
exit 0
fi

DESIRED_VERSION_TAG=$(echo ${CLI_RELEASES} | jq -r .name)

if [ "$DESIRED_VERSION_TAG" = "null" ] || [ "$DESIRED_VERSION_TAG" = "" ]; then
echo "> Can't find desired Velocitas CLI version: $DESIRED_VERSION. Skipping Auto-Upgrade."
exit 0
fi

if [ "$DESIRED_VERSION_TAG" != "$INSTALLED_VERSION" ]; then
echo "> Upgrading CLI..."
if [[ $(arch) == "aarch64" ]]; then
CLI_ASSET_NAME=velocitas-linux-arm64
else
CLI_ASSET_NAME=velocitas-linux-x64
fi
CLI_INSTALL_PATH=/usr/bin/velocitas
CLI_DOWNLOAD_URL="https://github.com/eclipse-velocitas/cli/releases/download/${DESIRED_VERSION_TAG}/${CLI_ASSET_NAME}"

echo "> Downloading Velocitas CLI from ${CLI_DOWNLOAD_URL}"
sudo curl -s -L ${CLI_DOWNLOAD_URL} -o "${CLI_INSTALL_PATH}"
sudo chmod +x "${CLI_INSTALL_PATH}"
else
echo "> Up to date!"
fi

echo "> Using CLI: $(velocitas --version)"
17 changes: 16 additions & 1 deletion .devcontainer/scripts/reinstall-cmake.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/usr/bin/env bash
#!/bin/bash
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
Expand Down
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -->
## Describe your changes

<!--
Expand All @@ -19,7 +20,9 @@ Please check which manual tasks have bee performed as part of this pull request.
* [ ] Examples are executing successfully
* [ ] Created/updated unit tests. Code Coverage percentage on new code shall be >= 80%.
* [ ] Created/updated integration tests.

* [ ] Devcontainer can be opened successfully
* [ ] Devcontainer can be opened successfully behind a corporate proxy
* [ ] Devcontainer can be re-built successfully
* [ ] Extended the documentation (e.g. README.md, CONTRIBUTING.md, Velocitas)

* [ ] Extended the documentation (e.g. README.md, CONTRIBUTING.md, Velocitas Docs)
41 changes: 11 additions & 30 deletions .github/scripts/deploy_image_from_artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,18 @@
#
# SPDX-License-Identifier: Apache-2.0

ROOT_DIRECTORY=$( realpath "$( cd -- "$(dirname "$BASH_SOURCE")" >/dev/null 2>&1 ; pwd -P )/../.." )
APP_NAME=$(cat $ROOT_DIRECTORY/AppManifest.json | jq .[].Name | tr -d '"')
APP_PORT=$(cat $ROOT_DIRECTORY/AppManifest.json | jq .[].Port | tr -d '"')
APP_REGISTRY="k3d-registry.localhost:12345"
set -e

jq -c '.[]' $ROOT_DIRECTORY/AppManifest.json | while read i; do
name=$(jq -r '.Name' <<< "$i")
ROOT_DIRECTORY=$( realpath "$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/../.." )
APP_ARTIFACT_NAME=$(cat $ROOT_DIRECTORY/${{ appManifestPath }} | jq -r .name | tr -d '"')
APP_NAME_LOWERCASE=$(echo $APP_ARTIFACT_NAME | tr '[:upper:]' '[:lower:]')
APP_REGISTRY="localhost:12345"

local_tag="$APP_REGISTRY/$name:local"
echo "Local URL: $local_tag"
local_tag="$APP_REGISTRY/$APP_NAME_LOWERCASE:local"
echo "Local URL: $local_tag"

docker load -i "$APP_NAME.tar" | sed -n 's/^Loaded image ID: sha256:\([0-9a-f]*\).*/\1/p' | xargs -i docker tag {} $local_tag
docker push $local_tag
done
docker load -i "$APP_ARTIFACT_NAME.tar" | sed -n 's/^Loaded image: \([0-9a-f]*\).*/\1/p' | xargs -i docker tag {} $local_tag
docker push $local_tag

helm install vapp-chart $ROOT_DIRECTORY/deploy/VehicleApp/helm \
--values $ROOT_DIRECTORY/deploy/VehicleApp/helm/values.yaml \
--set imageVehicleApp.repository="$APP_REGISTRY/$APP_NAME" \
--set imageVehicleApp.name=$APP_NAME \
--set imageVehicleApp.daprAppid=$APP_NAME \
--set imageVehicleApp.daprPort=$APP_PORT \
--wait --timeout 60s --debug

kubectl get svc --all-namespaces
kubectl get pods

jq -c '.[]' $ROOT_DIRECTORY/AppManifest.json | while read i; do
name=$(jq -r '.Name' <<< "$i")
podname=$(kubectl get pods -o name | grep $name)
kubectl describe $podname
kubectl logs $podname --all-containers
done

sleep 5s
cd $ROOT_DIRECTORY
velocitas exec deployment-kanto deploy-vehicleapp
Loading

0 comments on commit aef778d

Please sign in to comment.