Add BirdBot & enable auto-restart

This commit is contained in:
Layla 2024-06-02 00:55:54 +02:00
parent e08344247d
commit 9580b0069c
11 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,11 @@
version: "3"
vars:
TARGET: '{{.TARGET}}'
includes:
tf:
vars:
SERVICE: "birdbot"
ENVIRONMENT: "{{.TARGET}}"
taskfile: ../../taskfiles/Taskfile_service.dist.yml

View 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"
}
}

View 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
}

View File

@ -0,0 +1,7 @@
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}

View File

@ -0,0 +1,7 @@
module "birdbot" {
source = "../_common"
birdbot_name = "boxnet"
birdbot_version = "v0.1.6"
discord_guild_id = "1088421016964956180"
}

View File

@ -0,0 +1,7 @@
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}

View File

@ -0,0 +1,7 @@
module "birdbot" {
source = "../_common"
birdbot_name = "craft"
birdbot_version = "v0.1.6"
discord_guild_id = "1165727967800983684"
}

View File

@ -0,0 +1,7 @@
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}

View File

@ -0,0 +1,7 @@
module "birdbot" {
source = "../_common"
birdbot_name = "kurzgesagt"
birdbot_version = "v0.1.6"
discord_guild_id = "1016797201931976714"
}

View File

@ -0,0 +1,7 @@
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}

View File

@ -17,6 +17,8 @@ resource "docker_container" "consul" {
image = "${var.consul_image}:${var.consul_version}" image = "${var.consul_image}:${var.consul_version}"
name = var.container_name name = var.container_name
restart = "always"
env = [] env = []
ports { ports {