Skip to content

Commit

Permalink
Merge pull request #14 from microsoft/al/geospatial-images-vth-plugin
Browse files Browse the repository at this point in the history
Al/geospatial images vth plugin
  • Loading branch information
bradarm authored Jul 25, 2024
2 parents fcb6f51 + cb63737 commit 42c628b
Show file tree
Hide file tree
Showing 24 changed files with 1,675 additions and 5 deletions.
124 changes: 124 additions & 0 deletions .devcontainer/geospatial-images-vth-plugin/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "geospatial-images-vth-plugin",
"image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0",
"runArgs": [
"--name=geospatial-images-vth-plugin"
],
"workspaceFolder": "/workspace/geospatial-images-vth-plugin",
"workspaceMount": "source=${localWorkspaceFolder}/datagenerators/geospatial-images/plugin,target=/workspace/geospatial-images-vth-plugin,type=bind,consistency=cached",
"features": {
"ghcr.io/microsoft/azure-orbital-space-sdk/spacefx-dev:0.11.0": {
"app_name": "geospatial-images-vth-plugin",
"app_type": "vth-plugin",
"addl_debug_shim_suffixes": "client",
"pull_containers": "datagenerator-geospatial-images:0.11.0-nightly",
"download_artifacts": "datagenerator-geospatial-images.yaml"
}
},
"mounts": [
"source=${localWorkspaceFolder}/datagenerators/geospatial-images/datagenerator,target=/workspace/geospatial-images-vth-datagenerator,type=bind,consistency=cached"
],
"hostRequirements": {
"cpus": 8,
"memory": "8gb"
},
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"DavidAnson.vscode-markdownlint",
"zxh404.vscode-proto3",
"mutantdino.resourcemonitor",
"josefpihrt-vscode.roslynator",
"bierner.markdown-mermaid"
]
},
// Grant permissions to the Azure Orbital Space SDK repositories and their packages
"codespaces": {
"repositories": {
"microsoft/azure-orbital-space-sdk": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-core": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-setup": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-coresvc-registry": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-coresvc-fileserver": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-coresvc-switchboard": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-platform-mts": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-platform-deployment": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-vth": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-hostsvc-link": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-hostsvc-logging": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-hostsvc-position": {
"permissions": {
"contents": "read",
"packages": "read"
}
},
"microsoft/azure-orbital-space-sdk-hostsvc-sensor": {
"permissions": {
"contents": "read",
"packages": "read"
}
}
}
}
},
"remoteUser": "root"
}
8 changes: 4 additions & 4 deletions .github/workflows/geospatial-images-generator-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
YAML_FOLDER_PATH: ./datagenerators/geospatial-images/datagenerator/k3s
YAML_FILE_NAME: datagenerator-geospatial-images.yaml
secrets:
GIT_HUB_USER_NAME: ${{ secrets.GIT_HUB_USER_NAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.GIT_HUB_USER_TOKEN }}
GIT_HUB_USER_NAME: ${{ secrets.TEMP_GITHUB_USERNAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.TEMP_WORKFLOW_TOKEN }}
SETUP_REPO_URL: ${{ secrets.SETUP_REPO_URL }}

build-datagenerator-geospatial-images-arm64:
Expand All @@ -50,6 +50,6 @@ jobs:
YAML_FOLDER_PATH: ./datagenerators/geospatial-images/datagenerator/k3s
YAML_FILE_NAME: datagenerator-geospatial-images.yaml
secrets:
GIT_HUB_USER_NAME: ${{ secrets.GIT_HUB_USER_NAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.GIT_HUB_USER_TOKEN }}
GIT_HUB_USER_NAME: ${{ secrets.TEMP_GITHUB_USERNAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.TEMP_WORKFLOW_TOKEN }}
SETUP_REPO_URL: ${{ secrets.SETUP_REPO_URL }}
59 changes: 59 additions & 0 deletions .github/workflows/geospatial-images-plugin-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: geospatial-images-plugin-build

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'datagenerators/geospatial-images/plugin/**'
- '.github/workflows/geospatial-images-plugin-build.yaml'

jobs:
build-plugin-geospatial-images-amd64:
permissions:
contents: read
packages: write

uses: microsoft/azure-orbital-space-sdk-github-actions/.github/workflows/plugin-build.yaml@main
with:
APP_PROJECT: ./src/geospatial-images-vth-plugin.csproj
OUTPUT_DIR: /var/spacedev/tmp/geospatial-images-vth-plugin/output
PLUGIN_STAGING_DIRECTORY: /var/spacedev/plugins/vth
PLUGIN_FILE_NAME: geospatial-images-vth-plugin.dll
PLUGIN_CONFIG_FILE_NAME: geospatial-images-vth-plugin.json.spacefx_plugin
ANNOTATION: azure-orbital-space-sdk-data-generators.yaml
WORKFLOW_AGENT: ubuntu-latest
ARCHITECTURE: amd64
DEV_CONTAINER_JSON: .devcontainer/geospatial-images-vth-plugin/devcontainer.json
PROTO_STAGING_DIRECTORY: /var/spacedev/protos/datagenerator/geospatial-images
PROTO_FOLDER_PATH: ./datagenerators/geospatial-images/plugin/src/Protos
PROTO_FILE_NAME: GeospatialImages.proto
secrets:
GIT_HUB_USER_NAME: ${{ secrets.TEMP_GITHUB_USERNAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.TEMP_WORKFLOW_TOKEN }}
SETUP_REPO_URL: ${{ secrets.SETUP_REPO_URL }}

build-plugin-geospatial-images-arm64:
permissions:
contents: read
packages: write

uses: microsoft/azure-orbital-space-sdk-github-actions/.github/workflows/plugin-build.yaml@main
with:
APP_PROJECT: ./src/geospatial-images-vth-plugin.csproj
OUTPUT_DIR: /var/spacedev/tmp/geospatial-images-vth-plugin/output
PLUGIN_STAGING_DIRECTORY: /var/spacedev/plugins/vth
PLUGIN_FILE_NAME: geospatial-images-vth-plugin.dll
PLUGIN_CONFIG_FILE_NAME: geospatial-images-vth-plugin.json.spacefx_plugin
ANNOTATION: azure-orbital-space-sdk-data-generators.yaml
WORKFLOW_AGENT: spacesdk-ubuntu-2204LTS-arm64
ARCHITECTURE: arm64
DEV_CONTAINER_JSON: .devcontainer/geospatial-images-vth-plugin/devcontainer.json
PROTO_STAGING_DIRECTORY: /var/spacedev/protos/datagenerator/geospatial-images
PROTO_FOLDER_PATH: ./datagenerators/geospatial-images/plugin/src/Protos
PROTO_FILE_NAME: GeospatialImages.proto
secrets:
GIT_HUB_USER_NAME: ${{ secrets.TEMP_GITHUB_USERNAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.TEMP_WORKFLOW_TOKEN }}
SETUP_REPO_URL: ${{ secrets.SETUP_REPO_URL }}
92 changes: 91 additions & 1 deletion datagenerators/geospatial-images/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,93 @@
# Geospatial Images

TODO
## Using the Geospatial Images Data Generator in your app
Using the Geospatial Images Data Generator requires the Plugin, the Plugin Config, the Data Generator container, and the Data Generator Deployment yaml. The spacefx-dev container feature can be used to automatically download and deploy these with the below configuration:
```json
"features": {
"ghcr.io/microsoft/azure-orbital-space-sdk/spacefx-dev:0.11.0": {
"app_name": "MyAwesomeApp",
"download_artifacts": "GeospatialImages.proto, datagenerator-geospatial-images.yaml, geospatial-images-vth-plugin.dll, geospatial-images-vth-plugin.json.spacefx_plugin",
"pull_containers": "datagenerator-geospatial-images:0.11.0-nightly"
}
},
```

## Geospatial Images Data Generator Source Code
The Geospatial Images Data Generator comprises two components:
* [Geospatial Images Data Generator](https://github.com/microsoft/azure-orbital-space-sdk-data-generators/tree/main/datagenerators/geospatial-images/datagenerator)
* [Geospatial Images VTH Plugin](https://github.com/microsoft/azure-orbital-space-sdk-data-generators/tree/main/datagenerators/geospatial-images/plugin)

The data generator is a Flask App that contains a repository of geospatial imagery available for querying, while the VTH Plugin is used to interact with the Flask App and download any of the geospatial images stored within the datagenerator, then send them via Link Service to the requesting Payload App.

## Building the Geospatial Images Data Generator (from source)
>:speech_balloon: The images, plugins, and artifacts are already built and pushed to the github container registry via our CI/CD process. These steps are a reference and **not** needed to run the Geospatial Images Data Generator. If you would like to just run the Geospatial Images Data Generator, please refer to [Geospatial Images Data Generator](https://github.com/microsoft/azure-orbital-space-sdk-data-generators/tree/main/datagenerators/geospatial-images)
1. Provision /var/spacedev
```bash
# clone the azure-orbital-space-sdk-setup repo and provision /var/spacedev
git clone https://github.com/microsoft/azure-orbital-space-sdk-setup
cd azure-orbital-space-sdk-setup
bash ./.vscode/copy_to_spacedev.sh
cd -
```

2. Clone this repo
```bash
# clone this repo
git clone https://github.com/microsoft/azure-orbital-space-sdk-data-generators
cd azure-orbital-space-sdk-data-generators
```

3. Build and push the Geospatial Images Data Generator
```bash
# Trigger the build_containerImage.sh from azure-orbital-space-sdk-setup
/var/spacedev/build/build_containerImage.sh \
--architecture amd64 \
--app-name datagenerator-geospatial-images \
--image-tag 0.11.0 \
--dockerfile Dockerfiles/Dockerfile \
--repo-dir ${PWD}/datagenerators/geospatial-images/datagenerator \
--no-push \
--annotation-config azure-orbital-space-sdk-data-generators.yaml
```
>:pencil2: the `--no-push` parameter will prevent build_containerImage.sh from pushing to a container registry. We added it here to prevent accidental pushes when you copy-and-paste the command. You will need to remove the `--no-push` if you want to push the final container image to a container registry

4. Build the Geospatial Images VTH Plugin
```bash
# Trigger the build_app.sh from azure-orbital-space-sdk-setup
/var/spacedev/build/dotnet/build_app.sh \
--architecture amd64 \
--app-project src/geospatial-images-vth-plugin.csproj \
--app-version 0.11.0 \
--output-dir /var/spacedev/tmp/geospatial-images-vth-plugin/output \
--repo-dir ${PWD} \
--devcontainer-json .devcontainer/geospatial-images-vth-plugin/devcontainer.json \
--no-container-build \
--no-push
```
>:pencil2: the `--no-container-build` parameter means that we're just interested in the build artifacts and there's not a container image for this. The `--no-push` is superflous since we aren't generating a container image, but kept it here for reference.
5. Copy the artifacts to their regular folders so it can be read by the containers
```bash
# Put the dll, spacefx_config, and yaml in the destination directories
sudo mkdir -p /var/spacedev/plugins/vth
sudo mkdir -p /var/spacedev/yamls/deploy
sudo mkdir -p /var/spacedev/protos/datagenerator/geospatial-images
sudo cp /var/spacedev/tmp/geospatial-images-vth-plugin/output/amd64/app/geospatial-images-vth-plugin.dll /var/spacedev/plugins/vth/
sudo cp /var/spacedev/tmp/geospatial-images-vth-plugin/output/amd64/app/geospatial-images-vth-plugin.json.spacefx_plugin /var/spacedev/plugins/vth/
sudo cp ${PWD}/datagenerators/geospatial-images/datagenerator/k3s/datagenerator-geospatial-images.yaml /var/spacedev/yamls/deploy/
sudo cp ${PWD}/datagenerators/geospatial-images/plugin/src/Protos/GeospatialImages.proto /var/spacedev/protos/datagenerator/geospatial-images/
```
6. (Optional) Push the build artifacts to the container registry
>:heavy_exclamation_mark: the next step will push the build artifacts to the first container registry you have write access to, including our automated channel tagging and patching aliases. Do not run this step unless you intend to deploy the artifacts to a container registry for others to consume.
```bash
/var/spacedev/build/push_build_artifact.sh --artifact /var/spacedev/plugins/vth/geospatial-images-vth-plugin.dll --annotation-config azure-orbital-space-sdk-data-generators.yaml --architecture amd64 --artifact-version 0.11.0
/var/spacedev/build/push_build_artifact.sh --artifact /var/spacedev/plugins/vth/geospatial-images-vth-plugin.json.spacefx_plugin --annotation-config azure-orbital-space-sdk-data-generators.yaml --architecture amd64 --artifact-version 0.11.0
/var/spacedev/build/push_build_artifact.sh --artifact /var/spacedev/yamls/deploy/datagenerator-geospatial-images.yaml --annotation-config azure-orbital-space-sdk-data-generators.yaml --architecture amd64 --artifact-version 0.11.0
/var/spacedev/build/push_build_artifact.sh --artifact /var/spacedev/protos/datagenerator/geospatial-images/GeospatialImages.proto --annotation-config azure-orbital-space-sdk-data-generators.yaml --architecture amd64 --artifact-version 0.11.0
```
Loading

0 comments on commit 42c628b

Please sign in to comment.