[Nix-dev] Cannot run "hydra-create-user" ("no such table: Users")
Bas van Dijk
v.dijk.bas at gmail.com
Sun Mar 5 00:49:54 CET 2017
Hi Bjørn,
At LumiGuide I use the following systemd service to setup hydra:
# Create a hydra admin user named "xxxx" and copy the GitHub private SSH
# key to hydra's home directory so that it can connect to GitHub to clone
# our repo's.
systemd.services.lumi-hydra-setup = {
wantedBy = [ "multi-user.target" ];
requires = [ "hydra-init.service" "postgresql.service" ];
after = [ "hydra-init.service" "postgresql.service" ];
environment = config.systemd.services.hydra-init.environment;
path = [ config.services.hydra.package ];
script =
let hydraHome = config.users.users.hydra.home;
hydraQueueRunnerHome = config.users.users.hydra-queue-runner.home;
in ''
hydra-create-user xxxx \
--full-name 'XXXX' \
--email-address 'xxxx at lumiguide.nl' \
--password '${cfg.xxxxPassword}' \
--role admin
mkdir -p "${hydraHome}/.ssh"
chmod 700 "${hydraHome}/.ssh"
cp "*xxxx*" "${hydraHome}/.ssh/id_rsa"
chown -R hydra:hydra "${hydraHome}/.ssh"
chmod 600 "${hydraHome}/.ssh/id_rsa"
mkdir -p "${hydraQueueRunnerHome}/.ssh"
chmod 700 "${hydraQueueRunnerHome}/.ssh"
cp "*xxxx*" "${hydraQueueRunnerHome}/.ssh/id_rsa"
chown -R hydra-queue-runner:hydra "${hydraQueueRunnerHome}/.ssh"
chmod 600 "${hydraQueueRunnerHome}/.ssh/id_rsa"
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
}; Note that I set the environment to be the hydra-init environment. With a
bit of luck that's the solution for your problem.
Bas
On 4 March 2017 at 11:59, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
> Hi all Hydra + Nixpkgs users,
>
> How did you manage to run "hydra-create-user"? It fails for me:
>
> $ sudo -u hydra hydra-create-user alice --full-name 'Alice Q. User'
> --email-address 'alice at example.org' --password alice --role admin
> DBIx::Class::Storage::DBI::_prepare_sth(): DBI Exception:
> DBD::SQLite::db prepare_cached failed: no such table: Users at
> /nix/store/2jy4y3nml6qljayqjlrf8mx6rrgj8g4l-hydra-2017-02-03/bin/.
> hydra-create-user-wrapped
> line 56
>
> This is on NixOS 17.03, using the hydra module provided by nixpkgs.
> I've set "services.hydra.enable = true" in configuration.nix,
> activated the configuration and verified that the hydra webUI is up. I
> even have the 'Users' table that "hydra-create-user" says does not
> exist:
>
> $ sudo psql -U hydra
> psql (9.5.6)
> Type "help" for help.
>
> hydra=> select * from Users;
> username | fullname | emailaddress | password | emailonerror | type
> | publicdashboard
> ----------+----------+--------------+----------+------------
> --+------+-----------------
> (0 rows)
>
> Any suggestions?
>
> Best regards,
> Bjørn Forsman
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170305/94a2feee/attachment-0001.html>
More information about the nix-dev
mailing list