2017-12-24 07:37:06 +00:00
|
|
|
resource "docker_container" "mongorocks" {
|
|
|
|
name = "mongorocks"
|
|
|
|
image = "${docker_image.mongorocks.latest}"
|
|
|
|
|
2017-12-26 13:55:43 +00:00
|
|
|
restart = "unless-stopped"
|
2017-12-24 07:37:06 +00:00
|
|
|
destroy_grace_seconds = 30
|
2017-12-26 13:55:43 +00:00
|
|
|
must_run = true
|
|
|
|
memory = 256
|
2017-12-24 07:37:06 +00:00
|
|
|
|
|
|
|
volumes {
|
|
|
|
volume_name = "${docker_volume.mongorocks_data_volume.name}"
|
|
|
|
container_path = "/data/db"
|
|
|
|
host_path = "${docker_volume.mongorocks_data_volume.mountpoint}"
|
|
|
|
}
|
|
|
|
|
|
|
|
env = [
|
|
|
|
"AUTH=no",
|
|
|
|
"DATABASE=wiki",
|
|
|
|
"OPLOG_SIZE=50",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "docker_container" "mariadb" {
|
|
|
|
name = "mariadb"
|
|
|
|
image = "${docker_image.mariadb.latest}"
|
|
|
|
|
|
|
|
volumes {
|
|
|
|
volume_name = "${docker_volume.mariadb_volume.name}"
|
|
|
|
container_path = "/var/lib/mysql"
|
|
|
|
host_path = "${docker_volume.mariadb_volume.mountpoint}"
|
|
|
|
}
|
|
|
|
|
2017-12-28 16:22:11 +00:00
|
|
|
// This is so that other host-only services can share this
|
2017-12-24 07:37:06 +00:00
|
|
|
ports {
|
|
|
|
internal = 3306
|
|
|
|
external = 3306
|
2017-12-26 15:20:52 +00:00
|
|
|
ip = "${var.ips["eth0"]}"
|
2017-12-24 07:37:06 +00:00
|
|
|
}
|
|
|
|
|
2017-12-28 16:22:11 +00:00
|
|
|
// This is a not-so-great idea
|
|
|
|
// TODO: Figure out a better way to make terraform SSH and then connect to localhost
|
|
|
|
ports {
|
|
|
|
internal = 3306
|
|
|
|
external = 3306
|
|
|
|
ip = "${var.ips["tun0"]}"
|
|
|
|
}
|
|
|
|
|
2017-12-26 13:55:43 +00:00
|
|
|
memory = 512
|
|
|
|
restart = "unless-stopped"
|
2017-12-24 07:37:06 +00:00
|
|
|
destroy_grace_seconds = 10
|
2017-12-26 13:55:43 +00:00
|
|
|
must_run = true
|
2017-12-24 07:37:06 +00:00
|
|
|
|
|
|
|
env = [
|
|
|
|
"MYSQL_ROOT_PASSWORD=${var.mysql_root_password}",
|
|
|
|
]
|
|
|
|
}
|