From de2729c2398ea92da78e046c995c1d1154eb9f0a Mon Sep 17 00:00:00 2001 From: IamTheFij Date: Fri, 11 Mar 2022 19:30:25 -0800 Subject: [PATCH] Make nextcloud bootstrap a prestart task --- nomad/nextcloud/nextcloud-bootstrap.nomad | 85 ----------------------- nomad/nextcloud/nextcloud.nomad | 39 ++++++++++- nomad/nextcloud/nextcloud.tf | 8 --- 3 files changed, 36 insertions(+), 96 deletions(-) delete mode 100644 nomad/nextcloud/nextcloud-bootstrap.nomad diff --git a/nomad/nextcloud/nextcloud-bootstrap.nomad b/nomad/nextcloud/nextcloud-bootstrap.nomad deleted file mode 100644 index 4292886..0000000 --- a/nomad/nextcloud/nextcloud-bootstrap.nomad +++ /dev/null @@ -1,85 +0,0 @@ -variable "base_hostname" { - type = string - description = "Base hostname to serve content from" - default = "dev.homelab" -} - -variable "nextcloud_db" { - type = string - default = "nextcloud" -} - -variable "nextcloud_user" { - type = string - default = "nextcloud" -} - -variable "nextcloud_pass" { - type = string - default = "nextcloud" -} - -job "nextcloud-bootstrap" { - datacenters = ["dc1"] - type = "batch" - - group "nextcloud-bootstrap" { - network { - mode = "bridge" - } - - service { - connect { - sidecar_service { - proxy { - upstreams { - destination_name = "mysql-server" - # TODO: how do I get these to not bind to the host eth0 address - local_bind_port = 6061 - } - config { - protocol = "tcp" - } - } - } - - sidecar_task { - resources { - cpu = 50 - memory = 50 - } - } - } - } - - task "nextcloud-bootstrap" { - driver = "docker" - - config { - image = "mysql:8" - args = [ - "/bin/bash", - "-c", - "/usr/bin/mysql -h${NOMAD_UPSTREAM_IP_mysql_server} -P${NOMAD_UPSTREAM_PORT_mysql_server} -uroot -psupersecretpassword < /bootstrap.sql", - ] - volumes = [ - "local/bootstrap.sql:/bootstrap.sql" - ] - } - - template { - data = <