Add test consul backup
This commit is contained in:
parent
18807de608
commit
9d4cd68648
@ -4,6 +4,7 @@
|
|||||||
provider "registry.terraform.io/hashicorp/nomad" {
|
provider "registry.terraform.io/hashicorp/nomad" {
|
||||||
version = "1.4.16"
|
version = "1.4.16"
|
||||||
hashes = [
|
hashes = [
|
||||||
|
"h1:PQxNPNmMVOErxryTWIJwr22k95DTSODmgRylqjc2TjI=",
|
||||||
"h1:tyfjD/maKzb0RxxD9KWgLnkJu9lnYziYsQgGw85Giz8=",
|
"h1:tyfjD/maKzb0RxxD9KWgLnkJu9lnYziYsQgGw85Giz8=",
|
||||||
"zh:0d4fbb7030d9caac3b123e60afa44f50c83cc2a983e1866aec7f30414abe7b0e",
|
"zh:0d4fbb7030d9caac3b123e60afa44f50c83cc2a983e1866aec7f30414abe7b0e",
|
||||||
"zh:0db080228e07c72d6d8ca8c45249d6f97cd0189fce82a77abbdcd49a52e57572",
|
"zh:0db080228e07c72d6d8ca8c45249d6f97cd0189fce82a77abbdcd49a52e57572",
|
||||||
|
@ -3,6 +3,11 @@ variable "nextcloud_backup" {
|
|||||||
description = "HCL config for Restic Scheduler jobs"
|
description = "HCL config for Restic Scheduler jobs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "consul_backup" {
|
||||||
|
type = string
|
||||||
|
description = "HCL config for Restic Scheduler jobs"
|
||||||
|
}
|
||||||
|
|
||||||
job "backup" {
|
job "backup" {
|
||||||
datacenters = ["dc1"]
|
datacenters = ["dc1"]
|
||||||
type = "system"
|
type = "system"
|
||||||
@ -118,6 +123,11 @@ BACKUP_PASSPHRASE={{ .Data.data.backup_passphrase }}
|
|||||||
# Build jobs based on node
|
# Build jobs based on node
|
||||||
data = <<EOF
|
data = <<EOF
|
||||||
# Current node is {{ env "node.unique.name" }}
|
# Current node is {{ env "node.unique.name" }}
|
||||||
|
# Consul backup below?
|
||||||
|
{{ if eq (env "node.unique.name") "n2" -}}
|
||||||
|
# Consul backup
|
||||||
|
${var.consul_backup}
|
||||||
|
{{ end -}}
|
||||||
{{ range service "nextcloud" }}
|
{{ range service "nextcloud" }}
|
||||||
# Nextcloud .Node {{ .Node }}
|
# Nextcloud .Node {{ .Node }}
|
||||||
{{ if eq .Node (env "node.unique.name") }}
|
{{ if eq .Node (env "node.unique.name") }}
|
||||||
|
@ -7,6 +7,7 @@ resource "nomad_job" "backups" {
|
|||||||
enabled = true
|
enabled = true
|
||||||
vars = {
|
vars = {
|
||||||
"nextcloud_backup" = "${local.nextcloud_backup}",
|
"nextcloud_backup" = "${local.nextcloud_backup}",
|
||||||
|
"consul_backup" = file("${path.module}/jobs/consul.hcl"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
job "Consul" {
|
job "Consul" {
|
||||||
schedule = "0 0 * * *"
|
schedule = "* * * * *"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
# TODO: Backup to a meaningful location, this is just for testing
|
# TODO: Backup to a meaningful location, this is just for testing
|
||||||
|
@ -108,13 +108,6 @@ job "backup-oneoff" {
|
|||||||
env = {
|
env = {
|
||||||
"MYSQL_HOST" = "${NOMAD_UPSTREAM_IP_mysql_server}"
|
"MYSQL_HOST" = "${NOMAD_UPSTREAM_IP_mysql_server}"
|
||||||
"MYSQL_PORT" = "${NOMAD_UPSTREAM_PORT_mysql_server}"
|
"MYSQL_PORT" = "${NOMAD_UPSTREAM_PORT_mysql_server}"
|
||||||
# TODO: Add user with access to all databases or variables for each user
|
|
||||||
"MYSQL_DATABASE" = "nextcloud"
|
|
||||||
"MYSQL_USER" = "nextcloud"
|
|
||||||
"MYSQL_PASSWORD" = "nextcloud"
|
|
||||||
|
|
||||||
# TODO: Something from vault
|
|
||||||
"BACKUP_PASSPHRASE" = "secretpass"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
|
Loading…
Reference in New Issue
Block a user