-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Hekku2/feat/process-updates
Update documentation and improve infrastructure
- Loading branch information
Showing
12 changed files
with
222 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# This is just a sample file. You can use `Create-Settings.ps1` to generate | ||
# these files automatically. However, if the script doesn't work, use this | ||
# as the base .env file for `docker-compose.yml` | ||
# This file is NOT needed if docker is not used. | ||
DISCORD_TOKEN= | ||
DISCORD_GUILDID= | ||
DISCORD_CHANNELID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<# | ||
.SYNOPSIS | ||
This script generates envvironmetn variable files based on developer-settings.json | ||
.DESCRIPTION | ||
Purpose of this is to make starting the development more convenient by generating environment files. | ||
.PARAMETER SettinsFile | ||
Settings file that contains environment settings. Defaults to 'developer-settings.json' | ||
#> | ||
param( | ||
[Parameter()][string]$SettingsFile = 'developer-settings.json' | ||
) | ||
$ErrorActionPreference = "Stop" | ||
Set-StrictMode -Version Latest | ||
|
||
.$PSScriptRoot/scripts/FunctionUtil.ps1 | ||
|
||
Write-Host "Reading settings from file $SettingsFile" | ||
$settingsJson = Get-Content -Raw -Path $SettingsFile | ConvertFrom-Json | ||
|
||
# Docker compose support | ||
$dockerEnvFile = "$PSScriptRoot/.env" | ||
$dockerEnvFileContent = " | ||
# This file was generated by Create-Settings.ps1. Don't commit this to version control. | ||
DISCORD_TOKEN=$($settingsJson.DiscordToken) | ||
DISCORD_GUILDID=$($settingsJson.DiscordGuildId) | ||
DISCORD_CHANNELID=$($settingsJson.DiscordChannelId) | ||
" | ||
Write-Host "Writing $dockerEnvFile" | ||
$dockerEnvFileContent | Out-File -FilePath $dockerEnvFile -Encoding utf8 | ||
|
||
# Function Core Tools support | ||
$funcSettingsFile = "$PSScriptRoot/src/FunctionApp.Isolated/local.settings.json" | ||
$localSettings = @{ | ||
IsEncrypted = $false | ||
Values = @{ | ||
AzureWebJobsStorage = 'UseDevelopmentStorage=true' | ||
FUNCTIONS_WORKER_RUNTIME = 'dotnet-isolated' | ||
} | ||
} | ||
$localSettings | ConvertTo-Json | Out-File -FilePath $funcSettingsFile -Encoding utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Technical reasoning | ||
|
||
This document describes reasoning behind different architectural and technical | ||
decisions related to this project. Purpose of this is help with future | ||
refactoring because the technical landscape and the available Azure services | ||
may have changed from the time these decisions where made. This should also | ||
help choosing new implementations I have forgot to think about some aspect | ||
or I haven't known about some available tool etc. | ||
|
||
## Requirements | ||
|
||
This sections lists overall requirements. | ||
|
||
1. Main function of the software (Image sending) is atomatically activated | ||
periodically. | ||
2. Software needs to be able to handle HTTP requests from Discord and from | ||
users. These should be relatively rare. | ||
* Discord MAY add a response time requirement. | ||
1. Software should prefer Managed Identity authentication. | ||
1. Software should be cheap to run and it shouldn't cost much when it's not | ||
active. | ||
1. Secrets should be stored securely. | ||
1. Local development with containers should be supported. | ||
1. Infrastructure creation must be automatic with a single command. | ||
|
||
## Technical selection | ||
|
||
Azure Function App with dotnet-isolated runtime was chosen. | ||
|
||
* Azure | ||
* Can handle all of the requirements, but mainly because I'm most familiar | ||
with this cloud service provider. | ||
* Azure Function App | ||
* Should be cheap to run. | ||
* Supports HTTP requests | ||
* Supports Managed Identity | ||
* Can be activated periodically (`TimerTrigger`) | ||
* Supports containers for local development. | ||
* Isolated worker model | ||
* Chosen instead of In-process model, because In-Process support is ending. | ||
* Consumption mode for Function App | ||
* Should be the cheapest option for this kind of workload. | ||
* App Service plan | ||
* Chosen instead of Container Apps, because the development experiment with | ||
container app was still quite poor. | ||
* Azure Key Vault | ||
* Is a secure way to store secrets and integrates well with function app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.