This commit is contained in:
commit
02cd1153bd
4 changed files with 302 additions and 0 deletions
49
.forgejo/workflows/build.yaml
Normal file
49
.forgejo/workflows/build.yaml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Repository meta
|
||||
id: repository
|
||||
run: |
|
||||
registry=${{ github.server_url }}
|
||||
registry=${registry##http*://}
|
||||
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
||||
echo "registry=${registry}"
|
||||
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
||||
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
|
||||
echo "repository=${repository}"
|
||||
-
|
||||
name: Docker meta
|
||||
uses: docker/metadata-action@v5
|
||||
id: docker
|
||||
with:
|
||||
images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
|
||||
-
|
||||
name: Login to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ steps.repository.outputs.registry }}
|
||||
username: "${{ secrets.PACKAGES_USER }}"
|
||||
password: "${{ secrets.PACKAGES_TOKEN }}"
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
buildkitd-flags: '--allow-insecure-entitlement network.host'
|
||||
driver-opts: network=host
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
allow: network.host
|
||||
network: host
|
||||
tags: ${{ steps.docker.outputs.tags }}
|
||||
136
.forgejo/workflows/createapp.yaml
Normal file
136
.forgejo/workflows/createapp.yaml
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
name: createapp
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
a_app_region:
|
||||
type: string
|
||||
description: "Application Region e.g. EU"
|
||||
default: EU
|
||||
required: true
|
||||
b_app_flavor:
|
||||
type: string
|
||||
description: "Application Flavor e.g. EU.small"
|
||||
default: EU.small
|
||||
required: true
|
||||
c_cloudlet:
|
||||
type: choice
|
||||
options:
|
||||
- Amsterdam-OTC
|
||||
- Hamburg
|
||||
- Leipzig
|
||||
- Munich
|
||||
- Berlin
|
||||
- Frankfurt
|
||||
- Magdeburg-OTC
|
||||
- Bonn
|
||||
- Magdeburg
|
||||
- crm-vm-2
|
||||
description: "Cloudlet location"
|
||||
default: Munich
|
||||
required: true
|
||||
|
||||
env:
|
||||
EDGEXR_PLATFORM_USERNAME: ${{ secrets.EDGEXR_PLATFORM_USERNAME }}
|
||||
EDGEXR_PLATFORM_PASSWORD: ${{ secrets.EDGEXR_PLATFORM_PASSWORD }}
|
||||
APP_REGION: ${{ inputs.a_app_region }}
|
||||
APP_FLAVOR: ${{ inputs.b_app_flavor }}
|
||||
CLOUDLET: ${{ inputs.c_cloudlet }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Repository meta
|
||||
id: repository
|
||||
run: |
|
||||
registry=${{ github.server_url }}
|
||||
registry=${registry##http*://}
|
||||
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
||||
echo "registry=${registry}"
|
||||
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
||||
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
|
||||
echo "repository=${repository}"
|
||||
-
|
||||
name: Docker meta
|
||||
uses: docker/metadata-action@v5
|
||||
id: docker
|
||||
with:
|
||||
images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
|
||||
-
|
||||
name: Install Dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y curl jq
|
||||
-
|
||||
name: Create Edge Connect App
|
||||
run: |
|
||||
set -e
|
||||
echo login
|
||||
EDGEXR_TOKEN="$(curl -X POST https://mc.orca.platform.mg3.mdb.osc.live/api/v1/login -H 'Content-Type: application/json' --data '{"password": "'${EDGEXR_PLATFORM_PASSWORD}'","username": "'${EDGEXR_PLATFORM_USERNAME}'"}' -sSf | jq -r .token)"
|
||||
|
||||
CREATEAPP_JSON=$(cat <<EOF
|
||||
{
|
||||
"region": "${APP_REGION}",
|
||||
"app": {
|
||||
"key": {
|
||||
"organization": "dev-framework",
|
||||
"name": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')",
|
||||
"version": "${{ steps.docker.outputs.version }}"
|
||||
},
|
||||
"deployment": "kubernetes",
|
||||
"image_type": "Docker",
|
||||
"image_path": "${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}:${{ steps.docker.outputs.version }}",
|
||||
"allow_serverless": true,
|
||||
"defaultFlavor": {
|
||||
"name": "${APP_FLAVOR}"
|
||||
},
|
||||
"serverless_config": {},
|
||||
"deployment_generator": "kubernetes-basic",
|
||||
"deployment_manifest": "apiVersion: v1\nkind: Service\nmetadata:\n name: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')-tcp\n labels:\n run: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')\nspec:\n type: LoadBalancer\n ports:\n - name: tcp80\n protocol: TCP\n port: 80\n targetPort: 80\n selector:\n run: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')-deployment\nspec:\n replicas: 1\n selector:\n matchLabels:\n run: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')\n template:\n metadata:\n labels:\n run: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')\n mexDeployGen: kubernetes-basic\n spec:\n volumes:\n containers:\n - name: $(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')\n image: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}:${{ steps.docker.outputs.version }}\n imagePullPolicy: Always\n ports:\n - containerPort: 80\n protocol: TCP\n\n"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $CREATEAPP_JSON
|
||||
|
||||
echo create app
|
||||
curl -X POST https://mc.orca.platform.mg3.mdb.osc.live/api/v1/auth/ctrl/CreateApp -H 'Content-Type: application/json' -H "Authorization: Bearer $EDGEXR_TOKEN" -S --data "$CREATEAPP_JSON" --fail-with-body
|
||||
-
|
||||
name: Create Edge Connect App Instance
|
||||
run: |
|
||||
set -e
|
||||
EDGEXR_TOKEN="$(curl -X POST https://mc.orca.platform.mg3.mdb.osc.live/api/v1/login -H 'Content-Type: application/json' --data '{"password": "'${EDGEXR_PLATFORM_PASSWORD}'","username": "'${EDGEXR_PLATFORM_USERNAME}'"}' -sSf | jq -r .token)"
|
||||
|
||||
CREATEAPPINSTANCE_JSON=$(cat <<EOF
|
||||
{
|
||||
"region": "${APP_REGION}",
|
||||
"appinst": {
|
||||
"key": {
|
||||
"organization": "dev-framework",
|
||||
"name": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')-instance",
|
||||
"cloudlet_key": {
|
||||
"organization": "TelekomOP",
|
||||
"name": "${CLOUDLET}"
|
||||
}
|
||||
},
|
||||
"app_key": {
|
||||
"organization": "dev-framework",
|
||||
"name": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')",
|
||||
"version": "${{ steps.docker.outputs.version }}"
|
||||
},
|
||||
"flavor": {
|
||||
"name": "${APP_FLAVOR}"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $CREATEAPPINSTANCE_JSON
|
||||
|
||||
echo create app instance
|
||||
curl -X POST https://mc.orca.platform.mg3.mdb.osc.live/api/v1/auth/ctrl/CreateAppInst -H 'Content-Type: application/json' -H "Authorization: Bearer $EDGEXR_TOKEN" -S --data "$CREATEAPPINSTANCE_JSON" --fail-with-body
|
||||
116
.forgejo/workflows/deleteapp.yaml
Normal file
116
.forgejo/workflows/deleteapp.yaml
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
name: deleteapp
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
a_app_region:
|
||||
type: string
|
||||
description: "Application Region e.g. EU"
|
||||
default: EU
|
||||
b_cloudlet:
|
||||
type: choice
|
||||
options:
|
||||
- Amsterdam-OTC
|
||||
- Hamburg
|
||||
- Leipzig
|
||||
- Munich
|
||||
- Berlin
|
||||
- Frankfurt
|
||||
- Magdeburg-OTC
|
||||
- Bonn
|
||||
- Magdeburg
|
||||
description: "Cloudlet e.g. EU.small"
|
||||
default: Munich
|
||||
required: true
|
||||
|
||||
env:
|
||||
EDGEXR_PLATFORM_USERNAME: ${{ secrets.EDGEXR_PLATFORM_USERNAME }}
|
||||
EDGEXR_PLATFORM_PASSWORD: ${{ secrets.EDGEXR_PLATFORM_PASSWORD }}
|
||||
APP_REGION: ${{ inputs.a_app_region }}
|
||||
CLOUDLET: ${{ inputs.b_cloudlet }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Repository meta
|
||||
id: repository
|
||||
run: |
|
||||
registry=${{ github.server_url }}
|
||||
registry=${registry##http*://}
|
||||
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
||||
echo "registry=${registry}"
|
||||
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
||||
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
|
||||
echo "repository=${repository}"
|
||||
-
|
||||
name: Docker meta
|
||||
uses: docker/metadata-action@v5
|
||||
id: docker
|
||||
with:
|
||||
images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
|
||||
-
|
||||
name: Install Dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y curl jq
|
||||
-
|
||||
name: Delete Edge Connect App Instance
|
||||
run: |
|
||||
set -e
|
||||
echo login
|
||||
EDGEXR_TOKEN="$(curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/login -H 'Content-Type: application/json' --data '{"password": "'${EDGEXR_PLATFORM_PASSWORD}'","username": "'${EDGEXR_PLATFORM_USERNAME}'"}' -sSf | jq -r .token)"
|
||||
|
||||
DELETEAPPINSTANCE_JSON=$(cat <<EOF
|
||||
{
|
||||
"region": "${APP_REGION}",
|
||||
"appinst": {
|
||||
"key": {
|
||||
"organization": "edp-developer-framework",
|
||||
"name": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')-instance",
|
||||
"cloudlet_key": {
|
||||
"organization": "TelekomOP",
|
||||
"name": "${CLOUDLET}"
|
||||
}
|
||||
},
|
||||
"app_key": {
|
||||
"organization": "edp-developer-framework",
|
||||
"name": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')",
|
||||
"version": "${{ steps.docker.outputs.version }}"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $DELETEAPPINSTANCE_JSON
|
||||
|
||||
echo delete app instance
|
||||
curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/auth/ctrl/DeleteAppInst -H 'Content-Type: application/json' -H "Authorization: Bearer $EDGEXR_TOKEN" -S --data "$DELETEAPPINSTANCE_JSON" --fail-with-body || true
|
||||
-
|
||||
name: Delete Edge Connect App
|
||||
run: |
|
||||
set -e
|
||||
echo login
|
||||
EDGEXR_TOKEN="$(curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/login -H 'Content-Type: application/json' --data '{"password": "'${EDGEXR_PLATFORM_PASSWORD}'","username": "'${EDGEXR_PLATFORM_USERNAME}'"}' -sSf | jq -r .token)"
|
||||
|
||||
DELETEAPP_JSON=$(cat <<EOF
|
||||
{
|
||||
"App": {
|
||||
"key": {
|
||||
"organization": "edp-developer-framework",
|
||||
"name": "$(echo ${{ steps.repository.outputs.repository }} | sed -e 's|^.*/||')",
|
||||
"version": "${{ steps.docker.outputs.version }}"
|
||||
}
|
||||
},
|
||||
"Region": "${APP_REGION}"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $DELETEAPP_JSON
|
||||
|
||||
echo delete app
|
||||
curl -X POST https://hub.apps.edge.platform.mg3.mdb.osc.live/api/v1/auth/ctrl/DeleteApp -H 'Content-Type: application/json' -H "Authorization: Bearer $EDGEXR_TOKEN" -S --data "$DELETEAPP_JSON" --fail-with-body
|
||||
1
Dockerfile
Normal file
1
Dockerfile
Normal file
|
|
@ -0,0 +1 @@
|
|||
FROM ghcr.io/coder/coder:latest
|
||||
Loading…
Add table
Add a link
Reference in a new issue