[Nix-dev] HYDRA_DATA

Rob Vermaas rob.vermaas at gmail.com
Sat Jun 9 17:49:16 CEST 2012


Hi Marco,

> I just updated my hydra server with
>  nix-channel --update
>  nix-env --always -u \*
>  nixos-rebuild switch
>
> If I run hydra-update-gc-roots I get the following error
>
> [hydra at o0dom0:/root]$ hydra-update-gc-roots
> The HYDRA_DATA directory (/var/lib/hydra) does not exist!
> Compilation failed in require at
> /nix/store/lrmjyz3lbv54ym3fbbrb01isq3yzm1hr-hydra-0.1pre1059-ab4f091/libexec/hydra/lib/Hydra/Helper/Nix.pm
> line 8.
> BEGIN failed--compilation aborted at
> /nix/store/lrmjyz3lbv54ym3fbbrb01isq3yzm1hr-hydra-0.1pre1059-ab4f091/libexec/hydra/lib/Hydra/Helper/Nix.pm
> line 8.
> Compilation failed in require at
> /nix/store/lrmjyz3lbv54ym3fbbrb01isq3yzm1hr-hydra-0.1pre1059-ab4f091/bin/.hydra-update-gc-roots-wrapped
> line 8.
> BEGIN failed--compilation aborted at
> /nix/store/lrmjyz3lbv54ym3fbbrb01isq3yzm1hr-hydra-0.1pre1059-ab4f091/bin/.hydra-update-gc-roots-wrapped
> line 8.
>
> I'm pretty sure that it worked without errors before the update.
> Hydra is configured through the nixos module as follows:
>
>  services.hydra = {
>    enable = true;
>    hydra = /nix/store/2a49h1zc3cydy97dyrv3ycfia087wwcy-hydra-0.1pre1058-fdf441a;
>    hydraURL = "http://o0dom0.math.unifi.it/";ww
>    notificationSender = "maggesi at math.unifi.it";
>    user = "hydra";
>    baseDir = "/home/hydra";
>    dbi = "dbi:Pg:dbname=hydra;host=localhost;user=hydra;";
>    minimumDiskFree = 3;
>    minimumDiskFreeEvaluator = 1;
>    #tracker = "<div>Dipartimento di Matematica Ulisse Dini</div>";
>    autoStart = true;
>  };
>
> (I manually set the exact path to the hydra derivation, i.e.,
> /nix/store/2a49h1zc3cydy97dyrv3ycfia087wwcy-hydra-0.1pre1058-fdf441a
> by looking at the installed default user environment after nix-env
> --always -u \* )
>
> I tried to define HYDRA_DATA but then I got another error
>
> [hydra at o0dom0:~]$ export HYDRA_DATA=/home/hydra/data/
>
> [hydra at o0dom0:~]$ hydra-update-gc-roots
> *** reading current roots...
> *** looking for release members
> DBIx::Class::ResultSet::search_literal(): DBI Exception:
> DBD::SQLite::db prepare_cached failed: no such table: Builds [for
> Statement "SELECT me.id, me.finished, me.timestamp, me.project,
> me.jobset, me.job, me.nixname, me.description, me.drvpath, me.outpath,
> me.system, me.longdescription, me.license, me.homepage,
> me.maintainers, me.maxsilent, me.timeout, me.iscurrent,
> me.nixexprinput, me.nixexprpath, me.priority, me.busy, me.locker,
> me.logfile, me.disabled, me.starttime, me.stoptime, me.iscachedbuild,
> me.buildstatus, me.errormsg, me.logsize, me.size, me.closuresize,
> me.releasename, me.keep FROM Builds me WHERE ( exists (select 1 from
> releasemembers where build = me.id) ) ORDER BY project, jobset, job,
> id"] at /nix/store/lrmjyz3lbv54ym3fbbrb01isq3yzm1hr-hydra-0.1pre1059-ab4f091/bin/.hydra-update-gc-roots-wrapped
> line 59
>
> Can you help me understand?

It looks like the environment variables for the hydra login are not
set properly in the nixos module. I can see this, as it is trying to
use sqlite, which is the default database backend when no HYDRA_DBI is
provided. The upstart jobs and cronjob shoudl get the appropriate
environment variables. I haven't tested this, but you can probably
use:

  environment.shellInit = env;

in the  hydra-module.nix that is part of hydra. Let me know if this
works for you, then we can add it to the module.

Cheers,
Rob


-- 
Rob Vermaas

[email] rob.vermaas at gmail.com


More information about the nix-dev mailing list