diff --git a/backups/backup.nomad b/backups/backup.nomad index b23d3f9..09d5b68 100644 --- a/backups/backup.nomad +++ b/backups/backup.nomad @@ -10,6 +10,7 @@ job "backup" { constraint { attribute = "${node.unique.name}" # Only node with a backup job so far + # Remove when backing up all nodes value = "n2" } @@ -85,19 +86,36 @@ job "backup" { } } + vault { + policies = [ + "access-tables", + "nomad-task", + ] + } + env = { "MYSQL_HOST" = "${NOMAD_UPSTREAM_IP_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 { + # Probably want to use database credentials that have access to dump all tables + data = <