Added deploy for CICD
All checks were successful
git.cronocide.net/bluebubbles-bot/pipeline/head This commit looks good

This commit is contained in:
Daniel Dayley 2023-05-15 15:33:18 -06:00
parent 9626047cc6
commit 4b3bff5afd
Signed by: Cronocide
GPG Key ID: 2CB7D4B8DEB3198E
2 changed files with 78 additions and 0 deletions

77
bluebubbles_bot.hcl Normal file
View File

@ -0,0 +1,77 @@
job "bbbot" {
datacenters = ["atlas"]
group "primary" {
network {
port "http" {
static = "7487"
}
}
service {
name = "${NOMAD_JOB_NAME}-http"
tags = ["http","internal","management","private"]
port = "http"
}
volume "app" {
type = "csi"
source = "bbbot"
read_only = false
attachment_mode = "file-system"
access_mode = "single-node-writer"
per_alloc = false
}
task "prepare-volumes" {
driver = "docker"
config {
image = "busybox:latest"
command = "sh"
args = ["-c", "chown 1000:1000 /data"]
}
volume_mount {
volume = "app"
destination = "/data"
read_only = false
}
lifecycle {
hook = "prestart"
sidecar = false
}
}
task "server" {
driver = "docker"
config {
image = "git.cronocide.net/cronocide/bluebubbles-bot:latest"
image_pull_timeout = "15m"
ports = ["http"]
}
volume_mount {
volume = "app"
destination = "/data"
}
vault {
policies = ["access-cronocide.net"]
}
template {
data = <<EOH
{{with secret "op/vaults/cronocide.net/items/bbbot"}}
{{range $key, $value := .Data}}{{$key}}="{{$value}}"
{{end}}{{end}}
EOH
destination = "secrets/file.env"
env = true
}
env {
BIND_PORT="${NOMAD_PORT_http}"
USE_PRIVATE_API=true
}
resources {
cores = 1
memory = 512
}
restart {
attempts = 3
delay = "30s"
mode = "delay"
}
}
}
}

View File

@ -144,6 +144,7 @@ cicd_publish() {
cicd_deploy() { cicd_deploy() {
echo "Deploying Software" echo "Deploying Software"
__missing_reqs "nomad" && exit 1
# TODO: Check for a nomad folder # TODO: Check for a nomad folder
if ! [ -f "$PROJECT_NAME".hcl ]; then if ! [ -f "$PROJECT_NAME".hcl ]; then
__http_get "https://setup.cronocide.com/nomad/base.hcl" "$PROJECT_NAME".hcl __http_get "https://setup.cronocide.com/nomad/base.hcl" "$PROJECT_NAME".hcl