-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathdeploy.fsx
63 lines (54 loc) · 1.36 KB
/
deploy.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#r "nuget: Farmer"
open System
open Farmer
open Farmer.Arm
open Farmer.Builders
let appName = "fs-snip"
let trimmedAppName = appName.Replace("-", "")
let storageAccountName = $"{trimmedAppName}storage"
let artifactDir = "wwwroot"
let blobContainerName = "data"
let recaptchaSecret = Environment.GetEnvironmentVariable "RECAPTCHA_SECRET"
let logAnalytics =
logAnalytics {
name $"{appName}-workspace"
}
let insights =
appInsights {
name $"{appName}-ai"
log_analytics_workspace logAnalytics
}
let storage = storageAccount {
name storageAccountName
sku Storage.Sku.Standard_LRS
add_private_container blobContainerName
}
let app = webApp {
name appName
runtime_stack Runtime.DotNetCore31
link_to_app_insights insights
sku WebApp.Sku.S1
operating_system OS.Linux
connection_string ("FSSNIP_STORAGE", storage.Key)
settings [
"FSSNIP_HOME_DIR", "."
"RECAPTCHA_SECRET", recaptchaSecret
]
zip_deploy artifactDir
https_only
always_on
}
let deployment = arm {
location Location.WestEurope
add_resources [
logAnalytics
insights
app
storage
]
output "storage-key" storage.Key
}
deployment
|> Deploy.execute appName Deploy.NoParameters
|> Map.find "storage-key"
|> fun key -> IO.File.WriteAllText("deployed_storage_key.txt", key)