Skip to content

Commit

Permalink
remove old rest module
Browse files Browse the repository at this point in the history
  • Loading branch information
sboeckelmann committed Nov 14, 2024
1 parent b0906b6 commit 7f2e993
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 1,017 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ jobs:
- name: "Build Native Quarkus Executable"
run: |
mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -DskipTests -f ./testdata-generator-quarkus-rest-app/pom.xml
mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -DskipTests -f ./quarkus/quarkus-app/pom.xml
- name: 'Release Native Quarkus Executable'
if: success() && contains(github.ref, 'v')
Expand All @@ -366,5 +366,5 @@ jobs:
with:
upload_url: ${{env.UPLOAD_URL}}
asset_name: 'testdata-generator-quarkus-rest-app-runner-${{env.GIT_TAG_NAME}}-${{matrix.label}}${{matrix.exe}}'
asset_path: 'testdata-generator-quarkus-rest-app/target/testdata-generator-quarkus-rest-app-runner${{matrix.exe}}'
asset_path: 'quarkus/quarkus-app/target/testdata-generator-quarkus-rest-app-runner${{matrix.exe}}'
asset_content_type: application/octet-stream
49 changes: 49 additions & 0 deletions azure-function/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
bin
obj
csx
.vs
edge
Publish
application*

*.user
*.suo
*.cscfg
*.Cache
project.lock.json

/packages
/TestResults

/tools/NuGet.exe
/App_Data
/secrets
/data
.secrets
appsettings.json
local.settings.json

node_modules
dist

# Local python packages
.python_packages/

# Python Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Azurite artifacts
__blobstorage__
__queuestorage__
__azurite_db*__.json
92 changes: 92 additions & 0 deletions azure-function/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# How To Deploy Event Generator as Azure Function

## Prerequisites:

- Maven >= 3.9
- An Azure Account. Free accounts work.
- Azure CLI Installed
- Azure Functions Core Tools version 4.x
- A way to build a quarkus native executable (Graal installed or via docker build)

## Build quarkus-app for Azure Deployment

PREPARE: Setup Azure Function specific Quarkus HTTP Configuration

```bash
# setup Azure compatible root path
export QUARKUS_HTTP_ROOT_PATH=/api/epcis-event-generator
```

RECOMMENDED: use docker native build

```bash
# run maven build via docker build (docker or podman required!)
mvn -DskipTests=true -Pci-build package -Dnative \
-Dquarkus.native.container-build=true \
-f ../quarkus/quarkus-app/pom.xml
```

OR: use local GraalVM (>=21.0.2) and Linux OS required

```bash
# check java vm
java --version
#> openjdk 21.0.2 2024-01-16
#> OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30)
#> OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)


# run maven build via local GraalVM (Linux OS required!)
mvn -DskipTests=true -Pci-build package -Dnative \
-f ../quarkus/quarkus-app/pom.xml
```

FINALLY: copy binary build to azure-function deployment application file

```bash

# copy binary from build to 'application'
cp ../quarkus/quarkus-app/target/openepcis-event-hash-generator-service-runner application
```

## Deployment

### Create Function App in Azure

To deploy you’ll need to create an Azure Group and Function Application.

```bash
# login
$ az login

# create an Azure Resource Group
az group create -n rg-openepcis-functions \
-l eastus

# create an Azure Storage Account (required for Azure Functions App)
az storage account create -n sargopenepcisfunctions \
-g rg-openepcis-functions \
-l eastus

# create an Azure Functions App
az functionapp create -n yourunique-epcis-event-hash-app-name \
-g rg-openepcis-functions \
--consumption-plan-location eastus\
--os-type Linux \
--runtime custom \
--functions-version 4 \
--storage-account sargopenepcisfunctions
```

*Make sure that the os-type is Linux*

**Note that your Function Application name must be unique and may collide with others.**


#### Deploy Function to Azure

Now you can deploy your application, make sure you are in the azure-function directory!

```bash
func azure functionapp publish yourunique-epcis-event-hash-app-name
```
20 changes: 20 additions & 0 deletions azure-function/epcis-event-generator/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"bindings": [
{
"authLevel": "Anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
],
"route": "{*path}"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
}
25 changes: 25 additions & 0 deletions azure-function/host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
},
"customHandler": {
"enableForwardingHttpRequest": true,
"description": {
"defaultExecutablePath": "application",
"workingDirectory": "",
"arguments": [
"-Dquarkus.http.port=${FUNCTIONS_CUSTOMHANDLER_PORT:9000}"
]
}
}
}
2 changes: 0 additions & 2 deletions testdata-generator-quarkus-rest-app/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion testdata-generator-quarkus-rest-app/.mvn/jvm.config

This file was deleted.

174 changes: 0 additions & 174 deletions testdata-generator-quarkus-rest-app/LICENSE

This file was deleted.

Loading

0 comments on commit 7f2e993

Please sign in to comment.