🏡 index : github.com/captn3m0/nebula.git

author Nemo <me@captnemo.in> 2018-03-30 10:29:26.0 +05:30:00
committer Nemo <me@captnemo.in> 2018-03-30 10:29:26.0 +05:30:00
commit
57d175d7949e52170f8ffd15cb836370e6bcc6ef [patch]
tree
fcd483f398ae67202d7eb9a93d1c6abc41bf23d8
parent
8e90029a84762308a9bfaa32871019a8acabd1de
download
57d175d7949e52170f8ffd15cb836370e6bcc6ef.tar.gz

Attempt at migrating to a second entrypoint



Diff

 main.tf                       |  8 +++++++-
 timemachine/entrypoint.sh.tpl |  8 ++++++++
 timemachine/main.tf           | 21 +++++++++++++++++++++
 timemachine/variables.tf      |  5 +++++
 4 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/main.tf b/main.tf
index a246b37..0e393e1 100644
--- a/main.tf
+++ a/main.tf
@@ -26,8 +26,12 @@
}

module "timemachine" {

  source = "timemachine"
  ips    = "${var.ips}"
  source     = "timemachine"
  ips        = "${var.ips}"
  username-1 = "vikalp"
  password-1 = "vikalp"
  username-2 = "rishav"
  password-2 = "vikalp"
}

module "gitea" {

diff --git a/timemachine/entrypoint.sh.tpl b/timemachine/entrypoint.sh.tpl
new file mode 100755
index 0000000..5dbb002 100755
--- /dev/null
+++ a/timemachine/entrypoint.sh.tpl
@@ -1,0 +1,8 @@
#!/bin/bash

set -e

add-account ${username-1} ${password-1} "${username-1}-timemachine" "/timemachine/${username-1}-timemachine" 3000
add-account ${username-2} ${password-2} "${username-2}-timemachine" "/timemachine/${username-2}-timemachine" 3000

/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
diff --git a/timemachine/main.tf b/timemachine/main.tf
index f707054..3d7cdab 100644
--- a/timemachine/main.tf
+++ a/timemachine/main.tf
@@ -28,7 +28,28 @@
    ip       = "${var.ips["eth0"]}"
  }

  upload {

    content = "${data.template_file.timemachine-entrypoint.rendered}"
    file    = "/entrypoint-custom.sh"
  }

  entrypoint = [

    "/entrypoint-custom.sh",
  ]

  restart               = "unless-stopped"
  destroy_grace_seconds = 10
  must_run              = true
}

data "template_file" "timemachine-entrypoint" {

  template = "${file("${path.module}/entrypoint.sh.tpl")}"

  vars {

    username-1 = "${var.username-1}"
    password-1 = "${var.password-1}"

    username-2 = "${var.username-2}"
    password-2 = "${var.password-2}"
  }
}
diff --git a/timemachine/variables.tf b/timemachine/variables.tf
index f7b7a99..c998ce4 100644
--- a/timemachine/variables.tf
+++ a/timemachine/variables.tf
@@ -1,3 +1,8 @@
variable "ips" {

  type = "map"
}

variable "username-1" {}
variable "username-2" {}
variable "password-2" {}
variable "password-1" {}