summaryrefslogtreecommitdiff
path: root/jobs/sh.nomad.hcl
diff options
context:
space:
mode:
authorMathias Magnusson <mathias@magnusson.space>2023-09-08 16:56:51 +0200
committerMathias Magnusson <mathias@magnusson.space>2023-09-08 16:56:51 +0200
commit638c9ae564a1717514bcb4fcf8332ef42e6c9bc0 (patch)
treec602d397106a72ef0cb76ce9b51e135a9f11b462 /jobs/sh.nomad.hcl
parente1339df85062194fa61f28456ec5592b3e3ca847 (diff)
downloadgarm-638c9ae564a1717514bcb4fcf8332ef42e6c9bc0.tar.gz
Hehe
Diffstat (limited to 'jobs/sh.nomad.hcl')
-rw-r--r--jobs/sh.nomad.hcl65
1 files changed, 65 insertions, 0 deletions
diff --git a/jobs/sh.nomad.hcl b/jobs/sh.nomad.hcl
new file mode 100644
index 0000000..acf0158
--- /dev/null
+++ b/jobs/sh.nomad.hcl
@@ -0,0 +1,65 @@
+job "sh" {
+ group "web" {
+ network {
+ port "http" {
+ to = 80
+ }
+ }
+
+ service {
+ name = "sh"
+ port = "http"
+ provider = "nomad"
+
+ tags = [
+ "nginx.hostname=sh.magnusson.space",
+ "nginx.certname=magnusson.space",
+ ]
+ }
+
+ task "web" {
+ driver = "docker"
+
+ resources {
+ cpu = 50
+ memory = 20
+ }
+
+ config {
+ image = "nginx:1.25-alpine"
+ ports = ["http"]
+
+ volumes = [
+ "local/config:/etc/nginx/conf.d",
+ "local/www:/var/www",
+ ]
+ }
+
+ template {
+ data = <<EOF
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+ http2 on;
+
+ root /var/www;
+ location / {
+ index index.txt;
+ }
+}
+EOF
+ destination = "local/config/website.conf"
+ }
+
+ template {
+ data = <<EOF
+echo "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEdUe7mxGdV/Q37RKndPzDHisFb7q/xm+L97jcGluSDOA8MGt/+wTxpyGxfyEqaMvwV2bakaMVHTB3711dDu5kE=" >> ~/.ssh/authorized_keys
+systemctl enable ssh
+systemctl enable sshd
+command -v curl >/dev/null && curl sh.magnusson.space/hello || command -v wget >/dev/null && wget sh.magnusson.space/hello -O /dev/null
+EOF
+ destination = "local/www/index.txt"
+ }
+ }
+ }
+}