Skip to content

Commit 373effd

Browse files
committed
Deployment: preliminary GreenCaptchaBot schema
1 parent 19db3ae commit 373effd

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
bin/
44
obj/
5+
6+
*.private.json

Codingteam.Devops.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Fabricator", "Fabricator",
2424
EndProject
2525
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fabricator.Core", "Fabricator\Fabricator.Core\Fabricator.Core.fsproj", "{C57439E9-20AF-4EEB-8C91-5D74D346374B}"
2626
EndProject
27+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fabricator.Resources", "Fabricator\Fabricator.Resources\Fabricator.Resources.fsproj", "{414C5063-3201-43AC-9DA1-B18A18802C0D}"
28+
EndProject
2729
Global
2830
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2931
Debug|Any CPU = Debug|Any CPU
@@ -45,10 +47,15 @@ Global
4547
{C57439E9-20AF-4EEB-8C91-5D74D346374B}.Debug|Any CPU.Build.0 = Debug|Any CPU
4648
{C57439E9-20AF-4EEB-8C91-5D74D346374B}.Release|Any CPU.ActiveCfg = Release|Any CPU
4749
{C57439E9-20AF-4EEB-8C91-5D74D346374B}.Release|Any CPU.Build.0 = Release|Any CPU
50+
{414C5063-3201-43AC-9DA1-B18A18802C0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51+
{414C5063-3201-43AC-9DA1-B18A18802C0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{414C5063-3201-43AC-9DA1-B18A18802C0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
53+
{414C5063-3201-43AC-9DA1-B18A18802C0D}.Release|Any CPU.Build.0 = Release|Any CPU
4854
EndGlobalSection
4955
GlobalSection(NestedProjects) = preSolution
5056
{67164D20-A669-4BC3-A40E-751D3045BA89} = {C4672A21-FB21-4BBF-A0A1-512AC1B66C9A}
5157
{0157906C-006C-45F8-A79A-0D55F16B16B2} = {853E359A-18C5-4472-A712-D5C80EE99D6B}
5258
{C57439E9-20AF-4EEB-8C91-5D74D346374B} = {853E359A-18C5-4472-A712-D5C80EE99D6B}
59+
{414C5063-3201-43AC-9DA1-B18A18802C0D} = {853E359A-18C5-4472-A712-D5C80EE99D6B}
5360
EndGlobalSection
5461
EndGlobal

Codingteam.Devops.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

ctor/Codingteam.Ctor.fsproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9+
<Compile Include="GreenCaptchaBot.fs" />
910
<Compile Include="Program.fs" />
11+
<Content Include="GreenCaptchaBot.template.json" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\Fabricator\Fabricator.Console\Fabricator.Console.fsproj" />
16+
<ProjectReference Include="..\Fabricator\Fabricator.Resources\Fabricator.Resources.fsproj" />
1017
</ItemGroup>
1118

1219
</Project>

ctor/GreenCaptchaBot.fs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module internal Codingteam.Ctor.GreenCaptchaBot
2+
3+
open Fabricator.Core
4+
open Fabricator.Resources.Files
5+
6+
let private hostConfigDirectory = "/opt/green-captcha-bot/"
7+
let private docker = docker {
8+
let version = "v1.15.1"
9+
fromSources <| sources {
10+
gitRepository "https://github.com/ImoutoChan/GreenCaptchaBot.git"
11+
reference $"tags/{version}"
12+
}
13+
withDockerfile "CaptchaBot/Dockerfile"
14+
withTag version
15+
withName "green-captcha-bot"
16+
withVolume(hostPath = hostConfigDirectory, containerPath = "/app/Configuration")
17+
}
18+
19+
let private configFile = FileResource(templatedFile "GreenCaptchaBot.template.json", $"{hostConfigDirectory}/appsettings.json")
20+
21+
let resources: IResource[] = [| configFile; docker |]

ctor/GreenCaptchaBot.template.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"Configuration": {
3+
"BotToken": "$BOT_TOKEN",
4+
"DeleteJoinMessages": "Unsuccessful"
5+
}
6+
}

ctor/Program.fs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1-
printfn "TODO: Deployment"
2-
exit 1
1+
open Codingteam.Ctor
2+
open Fabricator.Console
3+
open Fabricator.Core
4+
5+
let private cluster mode =
6+
let connectionsFileName = if mode = RunMode.Verify then "connections.stub.json" else "connections.private.json"
7+
[|
8+
{
9+
Name = "ctor"
10+
Designator = Designators.fromConnectionsFile connectionsFileName "ctor"
11+
Resources = GreenCaptchaBot.resources
12+
Type = MachineType.Linux
13+
}
14+
|]
15+
16+
let main (args: string[]): int =
17+
let cluster =
18+
EntryPoint.main args cluster

0 commit comments

Comments
 (0)