|
26 | 26 | get_resource, |
27 | 27 | ) |
28 | 28 | from .dovecot.deployer import DovecotDeployer |
| 29 | +from .mtail.deployer import MtailDeployer |
29 | 30 | from .nginx.deployer import NginxDeployer |
30 | 31 | from .opendkim.deployer import OpendkimDeployer |
31 | 32 | from .postfix.deployer import PostfixDeployer |
@@ -320,67 +321,6 @@ def activate(self): |
320 | 321 | _activate_remote_units(self.units) |
321 | 322 |
|
322 | 323 |
|
323 | | -class MtailDeployer(Deployer): |
324 | | - def __init__(self, mtail_address): |
325 | | - self.mtail_address = mtail_address |
326 | | - |
327 | | - def install(self): |
328 | | - # Uninstall mtail package to install a static binary. |
329 | | - apt.packages(name="Uninstall mtail", packages=["mtail"], present=False) |
330 | | - |
331 | | - (url, sha256sum) = { |
332 | | - "x86_64": ( |
333 | | - "https://github.com/google/mtail/releases/download/v3.0.8/mtail_3.0.8_linux_amd64.tar.gz", |
334 | | - "123c2ee5f48c3eff12ebccee38befd2233d715da736000ccde49e3d5607724e4", |
335 | | - ), |
336 | | - "aarch64": ( |
337 | | - "https://github.com/google/mtail/releases/download/v3.0.8/mtail_3.0.8_linux_arm64.tar.gz", |
338 | | - "aa04811c0929b6754408676de520e050c45dddeb3401881888a092c9aea89cae", |
339 | | - ), |
340 | | - }[host.get_fact(facts.server.Arch)] |
341 | | - |
342 | | - server.shell( |
343 | | - name="Download mtail", |
344 | | - commands=[ |
345 | | - f"(echo '{sha256sum} /usr/local/bin/mtail' | sha256sum -c) || (curl -L {url} | gunzip | tar -x -f - mtail -O >/usr/local/bin/mtail.new && mv /usr/local/bin/mtail.new /usr/local/bin/mtail)", |
346 | | - "chmod 755 /usr/local/bin/mtail", |
347 | | - ], |
348 | | - ) |
349 | | - |
350 | | - def configure(self): |
351 | | - # Using our own systemd unit instead of `/usr/lib/systemd/system/mtail.service`. |
352 | | - # This allows to read from journalctl instead of log files. |
353 | | - files.template( |
354 | | - src=get_resource("mtail/mtail.service.j2"), |
355 | | - dest="/etc/systemd/system/mtail.service", |
356 | | - user="root", |
357 | | - group="root", |
358 | | - mode="644", |
359 | | - address=self.mtail_address or "127.0.0.1", |
360 | | - port=3903, |
361 | | - ) |
362 | | - |
363 | | - mtail_conf = files.put( |
364 | | - name="Mtail configuration", |
365 | | - src=get_resource("mtail/delivered_mail.mtail"), |
366 | | - dest="/etc/mtail/delivered_mail.mtail", |
367 | | - user="root", |
368 | | - group="root", |
369 | | - mode="644", |
370 | | - ) |
371 | | - self.need_restart = mtail_conf.changed |
372 | | - |
373 | | - def activate(self): |
374 | | - systemd.service( |
375 | | - name="Start and enable mtail", |
376 | | - service="mtail.service", |
377 | | - running=bool(self.mtail_address), |
378 | | - enabled=bool(self.mtail_address), |
379 | | - restarted=self.need_restart, |
380 | | - ) |
381 | | - self.need_restart = False |
382 | | - |
383 | | - |
384 | 324 | class IrohDeployer(Deployer): |
385 | 325 | def __init__(self, enable_iroh_relay): |
386 | 326 | self.enable_iroh_relay = enable_iroh_relay |
|
0 commit comments