on master help sign in
Don't put configs into the nix store
5c2d99aTom Smalley
default.nix+6−9
@@ -232,17 +232,16 @@ in rec {
232 };
232 };
233 };
233 };
234
234
235− serverExe = backend: frontend: assets: config: optimizationLevel:
235+ serverExe = backend: frontend: assets: optimizationLevel:
236 pkgs.runCommand "serverExe" {} ''
236 pkgs.runCommand "serverExe" {} ''
237 mkdir $out
237 mkdir $out
238 set -eux
238 set -eux
239 ln -s "${haskellLib.justStaticExecutables backend}"/bin/* $out/
239 ln -s "${haskellLib.justStaticExecutables backend}"/bin/* $out/
240 ln -s "${mkAssets assets}" $out/static.assets
240 ln -s "${mkAssets assets}" $out/static.assets
241− cp -r ${config} $out/config
242 ln -s ${mkAssets (compressedJs frontend optimizationLevel)} $out/frontend.jsexe.assets
241 ln -s ${mkAssets (compressedJs frontend optimizationLevel)} $out/frontend.jsexe.assets
243 '';
242 '';
244
243
245− server = { exe, hostName, adminEmail, routeHost, enableHttps, config }@args:
244+ server = { exe, hostName, adminEmail, routeHost, enableHttps }@args:
246 let
245 let
247 nixos = import (pkgs.path + /nixos);
246 nixos = import (pkgs.path + /nixos);
248 in nixos {
247 in nixos {
@@ -328,15 +327,13 @@ in rec {
328 passthru = { inherit android ios packages overrides tools shellToolOverrides withHoogle staticFiles __closureCompilerOptimizationLevel; };
327 passthru = { inherit android ios packages overrides tools shellToolOverrides withHoogle staticFiles __closureCompilerOptimizationLevel; };
329 };
328 };
330 in mkProject (projectDefinition args));
329 in mkProject (projectDefinition args));
331− serverOn = sys: config: serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend (projectOut sys).passthru.staticFiles config (projectOut sys).passthru.__closureCompilerOptimizationLevel;
330+ serverOn = sys: serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend (projectOut sys).passthru.staticFiles (projectOut sys).passthru.__closureCompilerOptimizationLevel;
332 linuxExe = serverOn "x86_64-linux";
331 linuxExe = serverOn "x86_64-linux";
333 in projectOut system // {
332 in projectOut system // {
334 linuxExeConfigurable = linuxExe;
333 linuxExeConfigurable = linuxExe;
335− linuxExe = linuxExe (base + "/config");
334+ linuxExe = linuxExe;
336− exe = serverOn system (base + "/config") ;
335+ exe = serverOn system;
337− server = args@{ hostName, adminEmail, routeHost, enableHttps, config }: let
336+ server = args@{ hostName, adminEmail, routeHost, enableHttps }: server (args // { exe = linuxExe; });
338− injectableConfig = builtins.filterSource (path: _: !(lib.hasPrefix (toString config + "/backend") (toString path))) config;
339− in server (args // { exe = linuxExe injectableConfig; });
340 obelisk = import (base + "/.obelisk/impl") {};
337 obelisk = import (base + "/.obelisk/impl") {};
341 };
338 };
342 haskellPackageSets = {
339 haskellPackageSets = {
lib/command/src/Obelisk/Command/Deploy.hs+9−1
@@ -101,7 +101,6 @@ deployPush deployPath getNixBuilders = do
101 , strArg "adminEmail" adminEmail
101 , strArg "adminEmail" adminEmail
102 , strArg "routeHost" routeHost
102 , strArg "routeHost" routeHost
103 , boolArg "enableHttps" enableHttps
103 , boolArg "enableHttps" enableHttps
104− , rawArg "config" $ deployPath </> "config"
105 ]
104 ]
106 , _nixBuildConfig_builders = builders
105 , _nixBuildConfig_builders = builders
107 }
106 }
@@ -128,6 +127,15 @@ deployPush deployPath getNixBuilders = do
128 (Map.fromList [("NIX_SSHOPTS", unwords sshOpts)])
127 (Map.fromList [("NIX_SSHOPTS", unwords sshOpts)])
129 "nix-copy-closure" ["-v", "--to", "root@" <> host, "--gzip", outputPath]
128 "nix-copy-closure" ["-v", "--to", "root@" <> host, "--gzip", outputPath]
130
129
130+ withSpinner "Uploading config" $ do
131+ callProcessAndLogOutput (Notice, Warning) $
132+ proc "rsync"
133+ [ "-e ssh " <> unwords sshOpts
134+ , "-qarvz"
135+ , deployPath </> "config"
136+ , "root@" <> host <> ":/var/lib/backend"
137+ ]
138+
131 withSpinner "Switching to new configuration" $ do
139 withSpinner "Switching to new configuration" $ do
132 callProcessAndLogOutput (Notice, Warning) $
140 callProcessAndLogOutput (Notice, Warning) $
133 proc "ssh" $ sshOpts <>
141 proc "ssh" $ sshOpts <>