From abdace209323b65f6c5db1bf553ede1f60da00cc Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 25 Dec 2025 21:51:43 -0500 Subject: Omni/Deploy: add WorkingDirectory support and rename to deployer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add execWorkingDirectory field to Exec type in Manifest.hs - Generate WorkingDirectory= in systemd unit files - Allow add-service to update existing services - Rename biz-deployer to deployer throughout - Fix Caddy.hs and Systemd.hs tests for new Exec constructor This fixes subagent stalls caused by Coder running direnv from wrong directory. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- Omni/Deploy/Systemd.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Omni/Deploy/Systemd.hs') diff --git a/Omni/Deploy/Systemd.hs b/Omni/Deploy/Systemd.hs index b47776a..8c6d416 100644 --- a/Omni/Deploy/Systemd.hs +++ b/Omni/Deploy/Systemd.hs @@ -31,7 +31,7 @@ import System.FilePath (()) import qualified System.Process as Process servicesDir :: FilePath -servicesDir = "/var/lib/biz-deployer/services" +servicesDir = "/var/lib/deployer/services" generateUnit :: Service -> Text generateUnit Service {..} = @@ -60,9 +60,14 @@ generateUnit Service {..} = "Restart=" <> systemdRestart serviceSystemd, "RestartSec=" <> tshow (systemdRestartSec serviceSystemd) ] + ++ workingDirLine ++ envLines ++ envFileLine + workingDirLine = case execWorkingDirectory serviceExec of + Nothing -> [] + Just dir -> ["WorkingDirectory=" <> dir] + envLines = Map.toList serviceEnv |> map (\(k, v) -> "Environment=\"" <> k <> "=" <> v <> "\"") @@ -193,7 +198,7 @@ mkTestService name path = { serviceName = name, serviceArtifact = Artifact "nix-closure" path, serviceHosts = ["biz"], - serviceExec = Exec Nothing "root" "root", + serviceExec = Exec Nothing "root" "root" Nothing, serviceEnv = mempty, serviceEnvFile = Nothing, serviceHttp = Nothing, @@ -230,7 +235,7 @@ test_generateUnitWithCustomExec = Test.unit "generates unit with custom exec" <| do let svc = (mkTestService "custom-exec" "/nix/store/abc") - { serviceExec = Exec (Just "my-binary") "www-data" "www-data" + { serviceExec = Exec (Just "my-binary") "www-data" "www-data" Nothing } unit = generateUnit svc Text.isInfixOf "ExecStart=/nix/store/abc/bin/my-binary" unit Test.@=? True -- cgit v1.2.3