Add BirdBot & enable auto-restart
This commit is contained in:
parent
e08344247d
commit
9580b0069c
11
services/birdbot/Taskfile.dist.yml
Normal file
11
services/birdbot/Taskfile.dist.yml
Normal file
@ -0,0 +1,11 @@
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
TARGET: '{{.TARGET}}'
|
||||
|
||||
includes:
|
||||
tf:
|
||||
vars:
|
||||
SERVICE: "birdbot"
|
||||
ENVIRONMENT: "{{.TARGET}}"
|
||||
taskfile: ../../taskfiles/Taskfile_service.dist.yml
|
37
services/birdbot/_common/main.tf
Normal file
37
services/birdbot/_common/main.tf
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
data "vault_generic_secret" "discord" {
|
||||
path = "secret/services/birdbot/discord"
|
||||
}
|
||||
|
||||
data "vault_generic_secret" "openai" {
|
||||
path = "secret/services/birdbot/openai"
|
||||
}
|
||||
|
||||
resource "docker_container" "birdbot" {
|
||||
image = "yeslayla/birdbot-chatgpt:${var.birdbot_version}"
|
||||
name = "birdbot-${var.birdbot_name}"
|
||||
|
||||
restart = "always"
|
||||
|
||||
env = [
|
||||
"DISCORD_TOKEN=${data.vault_generic_secret.discord.data["token"]}",
|
||||
"DISCORD_APPLICATION_ID=${data.vault_generic_secret.discord.data["app_id"]}",
|
||||
"DISCORD_GUILD_ID=${var.discord_guild_id}",
|
||||
"OPENAI_KEY=${data.vault_generic_secret.openai.data["token"]}"
|
||||
]
|
||||
|
||||
mounts {
|
||||
target = "/etc/birdbot"
|
||||
source = "/volume1/homes/layla/birdbot/${var.birdbot_name}/etc"
|
||||
read_only = false
|
||||
type = "bind"
|
||||
}
|
||||
|
||||
mounts {
|
||||
target = "/var/lib/birdbot"
|
||||
source = "/volume1/homes/layla/birdbot/${var.birdbot_name}/var"
|
||||
read_only = false
|
||||
type = "bind"
|
||||
}
|
||||
}
|
14
services/birdbot/_common/vars.tf
Normal file
14
services/birdbot/_common/vars.tf
Normal file
@ -0,0 +1,14 @@
|
||||
variable "birdbot_version" {
|
||||
description = "BirdBot container tag"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "birdbot_name" {
|
||||
description = "BirdBot iteration name"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "discord_guild_id" {
|
||||
description = "Discord guild ID"
|
||||
type = string
|
||||
}
|
7
services/birdbot/_common/versions.tf
Normal file
7
services/birdbot/_common/versions.tf
Normal file
@ -0,0 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
}
|
||||
}
|
||||
}
|
7
services/birdbot/boxnet/main.tf
Normal file
7
services/birdbot/boxnet/main.tf
Normal file
@ -0,0 +1,7 @@
|
||||
module "birdbot" {
|
||||
source = "../_common"
|
||||
|
||||
birdbot_name = "boxnet"
|
||||
birdbot_version = "v0.1.6"
|
||||
discord_guild_id = "1088421016964956180"
|
||||
}
|
7
services/birdbot/boxnet/versions.tf
Normal file
7
services/birdbot/boxnet/versions.tf
Normal file
@ -0,0 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
}
|
||||
}
|
||||
}
|
7
services/birdbot/craft/main.tf
Normal file
7
services/birdbot/craft/main.tf
Normal file
@ -0,0 +1,7 @@
|
||||
module "birdbot" {
|
||||
source = "../_common"
|
||||
|
||||
birdbot_name = "craft"
|
||||
birdbot_version = "v0.1.6"
|
||||
discord_guild_id = "1165727967800983684"
|
||||
}
|
7
services/birdbot/craft/versions.tf
Normal file
7
services/birdbot/craft/versions.tf
Normal file
@ -0,0 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
}
|
||||
}
|
||||
}
|
7
services/birdbot/kurzgesagt/main.tf
Normal file
7
services/birdbot/kurzgesagt/main.tf
Normal file
@ -0,0 +1,7 @@
|
||||
module "birdbot" {
|
||||
source = "../_common"
|
||||
|
||||
birdbot_name = "kurzgesagt"
|
||||
birdbot_version = "v0.1.6"
|
||||
discord_guild_id = "1016797201931976714"
|
||||
}
|
7
services/birdbot/kurzgesagt/versions.tf
Normal file
7
services/birdbot/kurzgesagt/versions.tf
Normal file
@ -0,0 +1,7 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
}
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@ resource "docker_container" "consul" {
|
||||
image = "${var.consul_image}:${var.consul_version}"
|
||||
name = var.container_name
|
||||
|
||||
restart = "always"
|
||||
|
||||
env = []
|
||||
|
||||
ports {
|
||||
|
Loading…
Reference in New Issue
Block a user