Attempt at migrating to a second entrypoint

This commit is contained in:
Nemo 2018-03-30 10:29:26 +05:30
parent 8e90029a84
commit 57d175d794
4 changed files with 40 additions and 2 deletions

View File

@ -26,8 +26,12 @@ module "docker" {
}
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" {

8
timemachine/entrypoint.sh.tpl Executable file
View File

@ -0,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

View File

@ -28,7 +28,28 @@ resource docker_container "timemachine" {
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}"
}
}

View File

@ -1,3 +1,8 @@
variable "ips" {
type = "map"
}
variable "username-1" {}
variable "username-2" {}
variable "password-2" {}
variable "password-1" {}