Authentication-Results: mail-b.sr.ht; dkim=pass header.d=secluded.site header.i=@secluded.site Received: from mx.nixnet.email (mx.nixnet.email [94.16.121.167]) by mail-b.sr.ht (Postfix) with ESMTPS id 77BE011EFC9 for <~whereswaldon/arbor-dev@lists.sr.ht>; Thu, 21 Jul 2022 03:10:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mx.nixnet.email (Postfix) with ESMTPSA id B07FC202872; Wed, 20 Jul 2022 23:10:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secluded.site; s=202002021149; t=1658373038; h=from:from:reply-to:subject:subject:to:to:cc:cc; bh=CYSReryyX/w/qdUuAQZLPnQfsYkuEeZNFwzoX6l0FnQ=; b=EBGORLRDG31ND9KGMebL0dINO+XHPGLS8cLy/p4c5sWxoGAmZ5wEG4RTCpyDtY37wHX+c9 99XOJPXxx8p7pAoeWTYCryCOMQZCVqStZYmiqTDuv2ym5jtMd35jZW3e6DkGZD//Go31gr CpxPCbI7+niSrbMCnRXE1wrwI6UbTx8= From: Amolith To: ~whereswaldon/arbor-dev@lists.sr.ht Cc: Amolith Subject: [PATCH 09/12] Add arbor target for setting the relay up Date: Wed, 20 Jul 2022 23:09:58 -0400 Message-Id: <20220721031001.97027-10-amolith@secluded.site> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220721031001.97027-1-amolith@secluded.site> References: <20220721031001.97027-1-amolith@secluded.site> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Amolith --- setup.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/setup.go b/setup.go index f99f401..c8445cb 100644 --- a/setup.go +++ b/setup.go @@ -24,7 +24,7 @@ var files embed.FS // Handles initial configuration of the instance func Deploy() error { // Run the various mage targets - mg.Deps(Users, Sudoers, Apt, Firewall, Prometheus, Caddy) + mg.Deps(Users, Sudoers, Apt, Firewall, Prometheus, Caddy, Arbor) // Finally override the ssh config to disallow root login. // This is the point of no return and will create a zombie @@ -75,6 +75,25 @@ func SshConfig() error { return sh.Run("systemctl", "restart", "ssh") } +func Arbor() error { + log.Println("Running target Arbor") + err := copy("files/relay", "/usr/local/bin/relay") + if err != nil { + return err + } + err = config("files/arbor-relay.service", "/etc/systemd/system/arbor-relay.service") + if err != nil { + return err + } + + err = sh.Run("systemctl", "daemon-reload") + if err != nil { + return err + } + + return sh.Run("systemctl", "enable", "--now", "arbor-relay") +} + func Apt() error { log.Println("Running target apt") apt := sh.RunCmd("env", "DEBIAN_FRONTEND=noninteractive", "apt-get", "-qq") -- 2.37.1