3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services/web-servers/keter/bundle.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
924 B
Nix
Raw Normal View History

nixos/keter: init Enable keter module Keter is an apploader which: 1. has the old app running on a port. 2. loads a new one, and wait for that to complete 3. switches the old with the new one once the new one finished loading. It supports more functionality but this use case is the primary one being used by supercede. Adds keter as a module to nixos. Currently keter is unusable with nix, because it relies on bundeling of a tar and uploading that to a specific folder. These expressions automate these devops tasks, with especially nixops in mind. This will work with versions above 1.8 The test seems to work. This uses a new version of keter which has good support for status code on error pages. We're using this config at production at supercede so it should be fine. Squash log: ========== mention keter in changelog Update generated release notes Always restart keter on failure This is a little bit of extra stability in case keter crashes. Which can happen under extreme conditions (DoS attacks). Update nixos/doc/manual/release-notes/rl-2205.section.md Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> Update nixos/modules/module-list.nix Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> Remove sanitization don't put domain in as a string Update nixos/tests/keter.nix Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> add jappie as module maintainer Use type path instead of two seperate options Fix generated docs added test machinery to figure out why it's failing Fix the test, use console output run nixpkgs-fmt on all modules Inline config file. This get's rid of a lot of inderection as well. Run nix format remove comment simplify executable for test delete config file add config for keter root Remove after redis clause set keter root by default to /var/lib/keter Update nixos/modules/services/web-servers/keter/default.nix Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> Update nixos/modules/services/web-servers/keter/default.nix Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> Update nixos/modules/services/web-servers/keter/default.nix Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> fix nit add newlines add default text and move description in a long description Delete rather obvious comment fix release db thing remove longDescription and put it in a comment instead change description of mkEnalbeOption explain what keter does by using the hackage synopsis set domain to keterDomain and same for executable move comment to where it's happening fix type error add formatting better comment try add seperate user for keter Revert "try add seperate user for keter" This reverts commit d3522d36c96117335bfa072e6f453406c244e940. Doing this breaks the setup set default to avoid needing cap_net_bind_service remove weird comment use example fields eleborated on process leakage Update nixos/modules/services/web-servers/keter/default.nix Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com> run nixpkgs-fmt update docs Fix formatting, set keter package by default format our little nixexpr replace '' -> " where possible drop indent for multiline string make description much shorter regen docs database
2022-05-18 14:41:54 +01:00
/* This makes a keter bundle as described on the github page:
https://github.com/snoyberg/keter#bundling-your-app-for-keter
*/
{ keterDomain
, keterExecutable
, gnutar
, writeTextFile
, lib
, stdenv
, ...
}:
let
str.stanzas = [{
# we just use nix as an absolute path so we're not bundling any binaries
type = "webapp";
/* Note that we're not actually putting the executable in the bundle,
we already can use the nix store for copying, so we just
symlink to the app. */
exec = keterExecutable;
host = keterDomain;
}];
configFile = writeTextFile {
name = "keter.yml";
text = (lib.generators.toYAML { } str);
};
in
stdenv.mkDerivation {
name = "keter-bundle";
buildCommand = ''
mkdir -p config
cp ${configFile} config/keter.yaml
echo 'create a gzipped tarball'
mkdir -p $out
tar -zcvf $out/bundle.tar.gz.keter ./.
'';
buildInputs = [ gnutar ];
}