~damien/infrastructure

4138dd76495bf145b07a05ec76933af93ccd0c6c — Damien Radtke 10 months ago 061fa52
Tack photos.radtke.family case on to porter rather than have its own job
2 files changed, 3 insertions(+), 61 deletions(-)

M jobs/fabio.nomad.erb
D jobs/family-photos.nomad.erb
M jobs/fabio.nomad.erb => jobs/fabio.nomad.erb +3 -0
@@ 2,6 2,8 @@
  @fabio_version  = "1.5.13"
  @golang_version = "1.13.4"
  @fabio_checksum = "sha256:716aaa264e2ffb7a98a574220e0e20d7d40e2f1b2717584d6f260e01f89220fc"

  @photos_radtke_family_url = "https://207.237.216.92:4430/photo/"
%>

// TODO: The porter program shouldn't be necessary to have, and redirecting http://photos.radtke.family


@@ 80,6 82,7 @@ job "fabio" {
				command = "porter",
				args = [
					"-to", "localhost:${NOMAD_PORT_fabio_balancer}",
					"-http-redirect", "photos.radtke.family=<%= @photos_radtke_family_url %>",
				]
			}


D jobs/family-photos.nomad.erb => jobs/family-photos.nomad.erb +0 -61
@@ 1,61 0,0 @@
<%
		@url = "https://207.237.216.92:4430/photo/"
%>
job "family-photos" {
	region = "global"
	datacenters = ["ca-central"]
	type = "service"

	group "porters" {
		constraint {
			attribute = "${node.class}"
			operator  = "!="
			value     = "load-balancer"
		}

		task "porter" {
			driver = "raw_exec"
			config {
				command = "porter",
				args = [
					"-from", "${NOMAD_PORT_http}",
					"-to", "<%= @url %>",
					"-redirect",
				]
			}

			service {
				name = "${JOB}-${TASK}"
				port = "http"

				check {
				      type = "http"
				      protocol = "http"
				      port = "http"
				      interval = "10s"
				      timeout = "2s"
				      path = "/healthcheck"
				}

				tags = ["urlprefix-photos.radtke.family/"]
			}

			artifact {
				source = "s3::http://45.33.126.243:9000/artifacts/porter/porter"
				options {
					aws_access_key_id = "<%= secret('minio', 'access_key') %>"
					aws_access_key_secret = "<%= secret('minio', 'secret_key') %>"
				}
			}

			resources {
				memory = 50  # MB
				network {
					port "http" {}
				}
			}
		}
	}
}

// vim: set tabstop=4 shiftwidth=4: