diff --git a/hammerhead/README.md b/hammerhead/README.md index 9710747..9580abe 100644 --- a/hammerhead/README.md +++ b/hammerhead/README.md @@ -9,7 +9,9 @@ 1. Base components: things that need to be installed before services - * Reverse-proxy/load-balancer: `nginx` is a good match for a one-node deployment. Installing it with Nomad/Consul will make me practice Consul Template etc. + * [x] Dummy HTTP server to have something to work with. + * [x] Reverse-proxy/load-balancer: `nginx` is a good match for a one-node deployment. Installing it with Nomad/Consul will make me practice Consul Template etc. + * Generate services configuration outside the `nginx` service definition. * TLS: Let's Encrypt will probably be part of the same job definition as `nginx`. 2. Gitea migration diff --git a/hammerhead/app/dummy-http-server/deploy/dummy-http-server.hcl b/hammerhead/app/dummy-http-server/deploy/dummy-http-server.hcl new file mode 100644 index 0000000..f897023 --- /dev/null +++ b/hammerhead/app/dummy-http-server/deploy/dummy-http-server.hcl @@ -0,0 +1,38 @@ +job "dummy-http-server" { + datacenters = ["dc1"] + group "server-group" { + count = 5 + + # update { + # canary = 1 + # max_parallel = 5 + # } + + network { + port "http" {} + } + + service { + name = "dummy-http-server" + port = "http" + check { + type = "http" + path = "/health" + interval = "2s" + timeout = "2s" + } + } + + task "server" { + driver = "docker" + + config { + image = "hashicorp/http-echo:latest" + args = [ + "-listen", ":${NOMAD_PORT_http}", + "-text", "Hello and welcome to ${NOMAD_IP_http}:${NOMAD_PORT_http}", + ] + } + } + } +} \ No newline at end of file diff --git a/hammerhead/app/nginx/deploy/nginx.hcl b/hammerhead/app/nginx/deploy/nginx.hcl new file mode 100644 index 0000000..535fb2e --- /dev/null +++ b/hammerhead/app/nginx/deploy/nginx.hcl @@ -0,0 +1,55 @@ +job "nginx" { + datacenters = ["dc1"] + + group "nginx" { + count = 1 + + network { + port "http" { + static = 8080 + } + } + + service { + name = "nginx" + port = "http" + } + + task "nginx" { + driver = "docker" + + config { + image = "nginx" + + ports = ["http"] + + volumes = [ + "local:/etc/nginx/conf.d", + ] + } + + template { + data = <