aerospike: init at 4.2.0.4

Co-authored-by: Volth <volth@webmaster.ms>

authored by Wael M. Nasreddine Volth and committed by Franz Pletz fd2448b2 794a60a2

+196
+2
nixos/modules/misc/ids.nix
··· 143 143 jenkins = 109; 144 144 systemd-journal-gateway = 110; 145 145 #notbit = 111; # unused 146 + aerospike = 111; 146 147 ngircd = 112; 147 148 btsync = 113; 148 149 minecraft = 114; ··· 436 437 jenkins = 109; 437 438 systemd-journal-gateway = 110; 438 439 #notbit = 111; # unused 440 + aerospike = 111; 439 441 #ngircd = 112; # unused 440 442 btsync = 113; 441 443 #minecraft = 114; # unused
+1
nixos/modules/module-list.nix
··· 200 200 ./services/continuous-integration/jenkins/slave.nix 201 201 ./services/databases/4store-endpoint.nix 202 202 ./services/databases/4store.nix 203 + ./services/databases/aerospike.nix 203 204 ./services/databases/clickhouse.nix 204 205 ./services/databases/couchdb.nix 205 206 ./services/databases/firebird.nix
+155
nixos/modules/services/databases/aerospike.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + 7 + cfg = config.services.aerospike; 8 + 9 + aerospikeConf = pkgs.writeText "aerospike.conf" '' 10 + # This stanza must come first. 11 + service { 12 + user aerospike 13 + group aerospike 14 + paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1. 15 + proto-fd-max 15000 16 + work-directory ${cfg.workDir} 17 + } 18 + logging { 19 + console { 20 + context any info 21 + } 22 + } 23 + mod-lua { 24 + system-path ${cfg.package}/share/udf/lua 25 + user-path ${cfg.workDir}/udf/lua 26 + } 27 + network { 28 + ${cfg.networkConfig} 29 + } 30 + ${cfg.extraConfig} 31 + ''; 32 + 33 + in 34 + 35 + { 36 + 37 + ###### interface 38 + 39 + options = { 40 + 41 + services.aerospike = { 42 + enable = mkEnableOption "Aerospike server"; 43 + 44 + package = mkOption { 45 + default = pkgs.aerospike; 46 + type = types.package; 47 + description = "Which Aerospike derivation to use"; 48 + }; 49 + 50 + workDir = mkOption { 51 + type = types.str; 52 + default = "/var/lib/aerospike"; 53 + description = "Location where Aerospike stores its files"; 54 + }; 55 + 56 + networkConfig = mkOption { 57 + type = types.lines; 58 + default = '' 59 + service { 60 + address any 61 + port 3000 62 + } 63 + 64 + heartbeat { 65 + address any 66 + mode mesh 67 + port 3002 68 + interval 150 69 + timeout 10 70 + } 71 + 72 + fabric { 73 + address any 74 + port 3001 75 + } 76 + 77 + info { 78 + address any 79 + port 3003 80 + } 81 + ''; 82 + description = "network section of configuration file"; 83 + }; 84 + 85 + extraConfig = mkOption { 86 + type = types.lines; 87 + default = ""; 88 + example = '' 89 + namespace test { 90 + replication-factor 2 91 + memory-size 4G 92 + default-ttl 30d 93 + storage-engine memory 94 + } 95 + ''; 96 + description = "Extra configuration"; 97 + }; 98 + }; 99 + 100 + }; 101 + 102 + 103 + ###### implementation 104 + 105 + config = mkIf config.services.aerospike.enable { 106 + 107 + users.users.aerospike = { 108 + name = "aerospike"; 109 + group = "aerospike"; 110 + uid = config.ids.uids.aerospike; 111 + description = "Aerospike server user"; 112 + }; 113 + users.groups.aerospike.gid = config.ids.gids.aerospike; 114 + 115 + systemd.services.aerospike = rec { 116 + description = "Aerospike server"; 117 + 118 + wantedBy = [ "multi-user.target" ]; 119 + after = [ "network.target" ]; 120 + 121 + serviceConfig = { 122 + ExecStart = "${cfg.package}/bin/asd --fgdaemon --config-file ${aerospikeConf}"; 123 + User = "aerospike"; 124 + Group = "aerospike"; 125 + LimitNOFILE = 100000; 126 + PermissionsStartOnly = true; 127 + }; 128 + 129 + preStart = '' 130 + if [ $(echo "$(${pkgs.procps}/bin/sysctl -n kernel.shmall) < 4294967296" | ${pkgs.bc}/bin/bc) == "1" ]; then 131 + echo "kernel.shmall too low, setting to 4G pages" 132 + ${pkgs.procps}/bin/sysctl -w kernel.shmall=4294967296 133 + fi 134 + if [ $(echo "$(${pkgs.procps}/bin/sysctl -n kernel.shmmax) < 1073741824" | ${pkgs.bc}/bin/bc) == "1" ]; then 135 + echo "kernel.shmmax too low, setting to 1GB" 136 + ${pkgs.procps}/bin/sysctl -w kernel.shmmax=1073741824 137 + fi 138 + if [ $(echo "$(cat /proc/sys/net/core/rmem_max) < 15728640" | ${pkgs.bc}/bin/bc) == "1" ]; then 139 + echo "increasing socket buffer limit (/proc/sys/net/core/rmem_max): $(cat /proc/sys/net/core/rmem_max) -> 15728640" 140 + echo 15728640 > /proc/sys/net/core/rmem_max 141 + fi 142 + if [ $(echo "$(cat /proc/sys/net/core/wmem_max) < 5242880" | ${pkgs.bc}/bin/bc) == "1" ]; then 143 + echo "increasing socket buffer limit (/proc/sys/net/core/wmem_max): $(cat /proc/sys/net/core/wmem_max) -> 5242880" 144 + echo 5242880 > /proc/sys/net/core/wmem_max 145 + fi 146 + install -d -m0700 -o ${serviceConfig.User} -g ${serviceConfig.Group} "${cfg.workDir}" 147 + install -d -m0700 -o ${serviceConfig.User} -g ${serviceConfig.Group} "${cfg.workDir}/smd" 148 + install -d -m0700 -o ${serviceConfig.User} -g ${serviceConfig.Group} "${cfg.workDir}/udf" 149 + install -d -m0700 -o ${serviceConfig.User} -g ${serviceConfig.Group} "${cfg.workDir}/udf/lua" 150 + ''; 151 + }; 152 + 153 + }; 154 + 155 + }
+36
pkgs/servers/nosql/aerospike/default.nix
··· 1 + { stdenv, fetchFromGitHub, autoconf, automake, libtool, openssl, zlib }: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "aerospike-server-${version}"; 5 + version = "4.2.0.4"; 6 + 7 + src = fetchFromGitHub { 8 + owner = "aerospike"; 9 + repo = "aerospike-server"; 10 + rev = version; 11 + sha256 = "1vqi3xir4l57v62q1ns3713vajxffs6crss8fpvbcs57p7ygx3s7"; 12 + fetchSubmodules = true; 13 + }; 14 + 15 + nativeBuildInputs = [ autoconf automake libtool ]; 16 + buildInputs = [ openssl zlib ]; 17 + 18 + preBuild = '' 19 + patchShebangs build/gen_version 20 + substituteInPlace build/gen_version --replace 'git describe' 'echo ${version}' 21 + ''; 22 + 23 + installPhase = '' 24 + mkdir -p $out/bin $out/share/udf 25 + cp target/Linux-x86_64/bin/asd $out/bin/asd 26 + cp -dpR modules/lua-core/src $out/share/udf/lua 27 + ''; 28 + 29 + meta = with stdenv.lib; { 30 + description = "Flash-optimized, in-memory, NoSQL database"; 31 + homepage = http://aerospike.com/; 32 + license = licenses.agpl3; 33 + platforms = [ "x86_64-linux" ]; 34 + maintainer = with maintainers; [ kalbasit ]; 35 + }; 36 + }
+2
pkgs/top-level/all-packages.nix
··· 429 429 portaudioSupport = config.aegisub.portaudioSupport or false; 430 430 }; 431 431 432 + aerospike = callPackage ../servers/nosql/aerospike { }; 433 + 432 434 aespipe = callPackage ../tools/security/aespipe { }; 433 435 434 436 aescrypt = callPackage ../tools/misc/aescrypt { };