infrastructure/jobs/acme-renewer.nomad -rw-r--r-- 3.6 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
job "acme-renewer" {
	region = "us"

	datacenters = ["us-central"]
	type = "batch"

	periodic {
	 	cron = "0 1 * * 0"  // 1am on Sundays
	 	time_zone = "America/Chicago"
	}

	// Disable rescheduling because otherwise it's easy to be rate-limited.
	reschedule {
		attempts = 0
		unlimited = false
	}

	# TODO: the next few groups are all identical save for the domain being renewed.
	# It might be a good idea to look into templating this more to reduce duplication.

	group "damienradtke.com" {
		// Disable automatic restarts because otherwise it's easy to be rate-limited.
		restart {
			attempts = 0
		}

		task "renew" {
			// Network issues using plain exec?
			driver = "raw_exec"
			config {
				command = "renew-https-cert.sh"
				args = ["damienradtke.com", "--issue", "--log"]  # add --force if needed
			}

			user = "nobody"

			artifact {
				source = "https://github.com/Neilpang/acme.sh/archive/2.8.2.tar.gz"
				options {
					checksum = "sha256:9c97ae15db3fc65200db462b3304aa082b1367f1ba4af5a86693b014a991c990"
				}
			}

			artifact {
				source = "s3::http://${MINIO_HOST}:9000/artifacts/renew-https-cert.sh"
				options {
					aws_access_key_id = "${MINIO_ACCESS_KEY}"
					aws_access_key_secret = "${MINIO_SECRET_KEY}"
				}
			}

			resources {
				cpu = 20  // MHz, the minimum value
				memory = 30  // MB
			}

			vault {
				policies = ["acme-renewer"]
			}

			env {
				LINODE_V4_API_KEY = "5636941d15f2c1a3ecd6ed3bb1904c77eedfc1a66d1cae6236aba2a5d84d3380"
				VAULT_CAPATH = "/etc/ssl/vault/ca.pem"
			}
		}
	}

	group "www.damienradtke.com" {
		// Disable automatic restarts because otherwise it's easy to be rate-limited.
		restart {
			attempts = 0
		}

		task "renew" {
			// Network issues using plain exec?
			driver = "raw_exec"
			config {
				command = "renew-https-cert.sh"
				args = ["www.damienradtke.com", "--issue", "--log"]  # add --force if needed
			}

			user = "nobody"

			artifact {
				source = "https://github.com/Neilpang/acme.sh/archive/2.8.2.tar.gz"
				options {
					checksum = "sha256:9c97ae15db3fc65200db462b3304aa082b1367f1ba4af5a86693b014a991c990"
				}
			}

			artifact {
				source = "s3::http://${MINIO_HOST}:9000/artifacts/renew-https-cert.sh"
				options {
					aws_access_key_id = "${MINIO_ACCESS_KEY}"
					aws_access_key_secret = "${MINIO_SECRET_KEY}"
				}
			}

			resources {
				cpu = 20  // MHz, the minimum value
				memory = 30  // MB
			}

			vault {
				policies = ["acme-renewer"]
			}

			env {
				LINODE_V4_API_KEY = "5636941d15f2c1a3ecd6ed3bb1904c77eedfc1a66d1cae6236aba2a5d84d3380"
				VAULT_CAPATH = "/etc/ssl/vault/ca.pem"
			}
		}
	}

	group "mail.damienradtke.com" {
		// Disable automatic restarts because otherwise it's easy to be rate-limited.
		restart {
			attempts = 0
		}

		task "renew" {
			// Network issues using plain exec?
			driver = "raw_exec"
			config {
				command = "renew-https-cert.sh"
				args = ["mail.damienradtke.com", "--issue", "--log"]  # add --force if needed
			}

			user = "nobody"

			artifact {
				source = "https://github.com/Neilpang/acme.sh/archive/2.8.2.tar.gz"
				options {
					checksum = "sha256:9c97ae15db3fc65200db462b3304aa082b1367f1ba4af5a86693b014a991c990"
				}
			}

			artifact {
				source = "s3::http://${MINIO_HOST}:9000/artifacts/renew-https-cert.sh"
				options {
					aws_access_key_id = "${MINIO_ACCESS_KEY}"
					aws_access_key_secret = "${MINIO_SECRET_KEY}"
				}
			}

			resources {
				cpu = 20  // MHz, the minimum value
				memory = 30  // MB
			}

			vault {
				policies = ["acme-renewer"]
			}

			env {
				LINODE_V4_API_KEY = "5636941d15f2c1a3ecd6ed3bb1904c77eedfc1a66d1cae6236aba2a5d84d3380"
				VAULT_CAPATH = "/etc/ssl/vault/ca.pem"
			}
		}
	}
}