Skip to content

Commit

Permalink
Merge pull request #18 from miles-no/feat(terraform)/azure-function
Browse files Browse the repository at this point in the history
feat(terraform): azure function and service plan
  • Loading branch information
pbullhove authored Oct 31, 2024
2 parents 3140267 + e19e00a commit c622ef2
Show file tree
Hide file tree
Showing 23 changed files with 629 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-api-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

# Step 4: Build the Docker image
- name: Build the Docker image
run: docker build -t "${{ secrets.ACR_SERVER }}/aquaapi:latest" ./api/AquaApi
run: docker build -t "${{ secrets.ACR_SERVER }}/aquaapi:latest" ./src/AquaApi

# Step 5: Push the Docker image to Azure Container Registry
- name: Push the Docker image
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/publish-data-generation-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy DotNet project to Azure Function App

on:
[push]

env:
AZURE_FUNCTIONAPP_NAME: 'dev-aquaplatform-func' # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'src/DataGeneratorFunction' # set this to the path to your function app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use (e.g. '2.1.x', '3.1.x', '5.0.x')

jobs:
build-and-deploy:
runs-on: windows-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet publish --configuration Release --output ./output
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-azuretools.vscode-azurefunctions",
"ms-dotnettools.csharp"
]
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"azureFunctions.deploySubpath": "src/DataGeneratorFunction/bin/Release/net8.0/publish",
"azureFunctions.projectLanguage": "C#",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "publish (functions)",
"azureFunctions.projectSubpath": "src/DataGeneratorFunction"
}
81 changes: 81 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "clean (functions)",
"command": "dotnet",
"args": [
"clean",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src/DataGeneratorFunction"
}
},
{
"label": "build (functions)",
"command": "dotnet",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean (functions)",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src/DataGeneratorFunction"
}
},
{
"label": "clean release (functions)",
"command": "dotnet",
"args": [
"clean",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src/DataGeneratorFunction"
}
},
{
"label": "publish (functions)",
"command": "dotnet",
"args": [
"publish",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean release (functions)",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src/DataGeneratorFunction"
}
},
{
"type": "func",
"dependsOn": "build (functions)",
"options": {
"cwd": "${workspaceFolder}/src/DataGeneratorFunction"
},
"command": "host start",
"isBackground": true,
"problemMatcher": "$func-dotnet-watch"
}
]
}
48 changes: 25 additions & 23 deletions dataplatform-aquaculture-template.sln
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{A6ED9EDF-D599-47B8-A6B2-2844E3FEBF9C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AquaApi", "src\AquaApi\AquaApi.csproj", "{35950192-252F-44A8-B710-63E470A67118}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AquaApi", "api\AquaApi\AquaApi.csproj", "{35950192-252F-44A8-B710-63E470A67118}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataGeneratorFunction", "src\DataGeneratorFunction\DataGeneratorFunction.csproj", "{3FFDA260-76E7-4E96-9F97-5B80E30FF2F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{35950192-252F-44A8-B710-63E470A67118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35950192-252F-44A8-B710-63E470A67118}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35950192-252F-44A8-B710-63E470A67118}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35950192-252F-44A8-B710-63E470A67118}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{35950192-252F-44A8-B710-63E470A67118} = {A6ED9EDF-D599-47B8-A6B2-2844E3FEBF9C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {00A64A12-39CC-40EA-996D-79EA6539A35B}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{35950192-252F-44A8-B710-63E470A67118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35950192-252F-44A8-B710-63E470A67118}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35950192-252F-44A8-B710-63E470A67118}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35950192-252F-44A8-B710-63E470A67118}.Release|Any CPU.Build.0 = Release|Any CPU
{3FFDA260-76E7-4E96-9F97-5B80E30FF2F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FFDA260-76E7-4E96-9F97-5B80E30FF2F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FFDA260-76E7-4E96-9F97-5B80E30FF2F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FFDA260-76E7-4E96-9F97-5B80E30FF2F2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {00A64A12-39CC-40EA-996D-79EA6539A35B}
EndGlobalSection
EndGlobal
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c622ef2

Please sign in to comment.