Closed leshik closed 3 years ago
Yes, the /etc/hostname
file and the HOSTNAME
variable are only used to set the default value. Neither of those should be required when explicitly specifying a host in writeDeploy
's target
attribute, e.g. target = "localhost";
. See https://github.com/krebs/krops#target for details.
@4z3 yes, it works this way, but I need to use mkTarget as I want to specify sudo = true
. Then it doesn't work.
Doesn't this work?:
target = lib.mkTarget "localhost" // {
sudo = true;
};
@4z3 no, it doesn't:
error: opening file '/etc/hostname': No such file or directory
(use '--show-trace' to show detailed location information)
Can you paste/link your krops configuration? I've deleted /etc/hostname
locally and unset HOSTNAME
, but I cannot reproduce the issue with following snippet:
pkgs.krops.writeDeploy "deploy" {
source = { /* ... */ };
target = lib.mkTarget "root@localhost" // {
extraOptions = [
"-oLogLevel=DEBUG3"
];
};
}
OK, I could reproduce it by using sudo = true;
.
This issue has been addressed in https://github.com/krebs/krops/commit/c2fa48550f2bb46009b9cecdb9ac838dc402ce19, released as v1.24.1. @leshik can you check if this fix works for you?
@4z3 yeah, that works perfectly. Thank you for the quick fix!
Hi,
Is it possible to work around the
/etc/hostname
file and theHOSTNAME
env variable here somehow? I'm deploying from Nix on macOS to the Linux VPS; macOS doesn't have/etc/hostname
, and whileHOSTNAME
is set in the shell, it's not exported. I can work around right now by setting a dummyHOSTNAME
, e.g.$(HOSTNAME=localhost nix-build --no-out-link krops.nix)
, but it would be nice if it were working out of the box.