Add runHydra shell

runHyda automatically starts hydra and postgres:

```
$ nix-shell -A runHydra
```

The shell receives hydra from the working copy as buildInput.
Running hydra, queue-runner, evaluator and postgres is managed
by foreman (https://github.com/ddollar/foreman) and configured
in `Procfile`.
This commit is contained in:
Andreas Rammhold
2020-05-15 12:37:16 +02:00
committed by Tobias Pflug
parent a614199449
commit d1237c315d
8 changed files with 54 additions and 1 deletions
+1
View File
@@ -3,6 +3,7 @@
Makefile Makefile
Makefile.in Makefile.in
.deps .deps
.hydra-data
/config.guess /config.guess
/config.log /config.log
/config.status /config.status
+4
View File
@@ -0,0 +1,4 @@
hydra-server: ./scripts/start-hydra.sh
hydra-queue-runner: ./scripts/start-queue-runner.sh
hydra-evaluator: ./scripts/start-evaluator.sh
postgres: ./scripts/start-postgres.sh
+6 -1
View File
@@ -104,13 +104,16 @@
[ makeWrapper autoconf automake libtool unzip nukeReferences pkgconfig libpqxx [ makeWrapper autoconf automake libtool unzip nukeReferences pkgconfig libpqxx
gitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 libxslt gitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 libxslt
perlDeps perl final.nix perlDeps perl final.nix
postgresql95 # for running the tests
boost boost
(if lib.versionAtLeast lib.version "20.03pre" (if lib.versionAtLeast lib.version "20.03pre"
then nlohmann_json then nlohmann_json
else nlohmann_json.override { multipleHeaders = true; }) else nlohmann_json.override { multipleHeaders = true; })
]; ];
checkInputs = [
postgresql95
];
hydraPath = lib.makeBinPath ( hydraPath = lib.makeBinPath (
[ subversion openssh final.nix coreutils findutils pixz [ subversion openssh final.nix coreutils findutils pixz
gzip bzip2 lzma gnutar unzip git gitAndTools.topGit mercurial darcs gnused bazaar gzip bzip2 lzma gnutar unzip git gitAndTools.topGit mercurial darcs gnused bazaar
@@ -290,6 +293,8 @@
nixpkgs.overlays = [ self.overlay nix.overlay ]; nixpkgs.overlays = [ self.overlay nix.overlay ];
}; };
runHydra = pkgs.callPackage ./run-hydra.nix {};
nixosModules.hydraTest = { nixosModules.hydraTest = {
imports = [ self.nixosModules.hydra ]; imports = [ self.nixosModules.hydra ];
+16
View File
@@ -0,0 +1,16 @@
{ foreman, mkShell, hydra, netcat, postgresql95 }:
{ doCheck ? true }:
mkShell {
buildInputs = [
foreman (hydra.overrideAttrs (_: { inherit doCheck; })) netcat postgresql95
];
shellHook = ''
export HYDRA_HOME="src/"
mkdir -p .hydra-data
export HYDRA_DATA="$(pwd)/.hydra-data"
export HYDRA_DBI='dbi:Pg:dbname=hydra;host=localhost;'
exec foreman start
'';
}
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
# wait for hydra-server to listen
while ! nc -z localhost 3000; do sleep 1; done
exec hydra-evaluator
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# wait for postgresql to listen
while ! nc -z localhost 5432; do sleep 1; done
createdb -h $(pwd)/.hydra-data/postgres hydra
hydra-init
hydra-create-user alice --password foobar --role admin
exec hydra-server
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
initdb ./.hydra-data/postgres
exec postgres -D ./.hydra-data/postgres -k $(pwd)/.hydra-data/postgres
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
# wait until hydra is listening on port 3000
while ! nc -z localhost 3000; do sleep 1; done
hydra-queue-runner