diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-08-03 11:03:41 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-08-03 11:03:41 -0400 |
| commit | 0c23aa1f1b3486305a6173bf092b34b653340c16 (patch) | |
| tree | ea3e19741906c9e95b77f415d48fa7e1076878e9 | |
| parent | 1a78b66631f29852c3d4af1695153c5e5e1efdd8 (diff) | |
propellor spin
| -rw-r--r-- | joeyconfig.hs | 1 | ||||
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/JoeySites.hs | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/joeyconfig.hs b/joeyconfig.hs index 7ed23dfb..539739cc 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -201,6 +201,7 @@ honeybee = host "honeybee.kitenet.net" $ props -- No hardware clock & Apt.serviceInstalledRunning "ntp" + & JoeySites.homePowerMonitor & JoeySites.homeRouter & Apt.installed ["mtr-tiny", "iftop", "screen"] & Postfix.satellite diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index a48ebf9c..c158ea93 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -931,6 +931,39 @@ alarmClock oncalendar (User user) command = combineProperties "goodmorning timer & "/etc/systemd/logind.conf" `ConfFile.containsIniSetting` ("Login", "LidSwitchIgnoreInhibited", "no") +-- My home power monitor. +homePowerMonitor :: Property DebianLike +homePowerMonitor = propertyList "home power monitor" $ props + & Apache.installed + & Apt.installed ["python2", "python-pymodbus"] + & Apt.installed ["ghc", "make"] + & Git.cloned (User "joey") "git://git.kitenet.net/joey/homepower" d Nothing + `onChange` buildpoller + & Systemd.enabled servicename + `requires` serviceinstalled + where + d = "/var/www/html/homepower" + buildpoller = userScriptProperty (User "joey") + [ "cd " ++ d + , "make" + ] + `assume` MadeChange + servicename = "homepower" + servicefile = "/etc/systemd/system/" ++ servicename ++ ".service" + serviceinstalled = servicefile `File.hasContent` + [ "[Unit]" + , "Description=home power monitor" + , "" + , "[Service]" + , "ExecStart=" ++ d ++ "/poller" + , "WorkingDirectory=" ++ d + , "User=joey" + , "Group=joey" + , "" + , "[Install]" + , "WantedBy=multi-user.target" + ] + -- My home router, running hostapd and dnsmasq for wlan0, -- with eth0 connected to a satellite modem, and a fallback ppp connection. homeRouter :: Property (HasInfo + DebianLike) |
