Initial Commit

This commit is contained in:
2022-09-09 16:37:09 -07:00
commit dddb37e979
21 changed files with 826 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Go Import Redirector
This is the nomad job file I use for rsc's [go-import-redirector](https://github.com/rsc/go-import-redirector), which redirects the Go programming language tool to the proper github repo. For example, if someone tries to install one of my projects, rather than having to type out `go install gitea.arsenm.dev/Arsen6331/itd@latest`, they can just use `go install go.arsenm.dev/itd@latest` and this service will redirect them.
This job file downloads an archive containing `go-import-redirector` executables for `x86_64` and `aarch64`, as well as a script that runs the correct one, from my minio instance.
I am running two instances of this, automatically load-balanced by Traefik. Since the configuration is done entirely in command-line arguments, this workload is completely stateless, and can therefore be moved around freely by Nomad.

View File

@@ -0,0 +1,46 @@
job "go-import-redirector" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "go-import-redirector" {
count = 2
network {
port "http" {}
}
task "go-import-redirector" {
driver = "exec"
config {
command = "local/exec.sh"
args = [
"-addr", ":${NOMAD_PORT_http}",
"go.arsenm.dev/*",
"https://gitea.arsenm.dev/Arsen6331/*"
]
}
artifact {
source = "https://api.minio.arsenm.dev/adl/go-import-redirector.tar.gz"
}
resources {
cpu = 100
memory = 20
}
service {
name = "go-import-redirector"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.go-import-redirector.rule=Host(`go.arsenm.dev`)",
"traefik.http.routers.go-import-redirector.tls.certResolver=letsencrypt"
]
}
}
}
}