Skip to content

consul-ui: fix build - #41239

Closed
jbboehr wants to merge 2 commits into
NixOS:release-18.03from
jbboehr:consul-ui-fix-18.03
Closed

jbboehr wants to merge 2 commits into
NixOS:release-18.03from
jbboehr:consul-ui-fix-18.03

Conversation

@jbboehr

@jbboehr jbboehr commented May 30, 2018 •

Copy link
Copy Markdown
Contributor
Motivation for this change

consul-ui is currently failing to build in 18.03 and master (#41238). This is a PR against the release-18.03 branch because the fix currently does not work on the master branch.

I'm not sure if you allow PRs against the release branches, in which case feel free to close this.

Alternatively, you could merge into master anyway and backport to 18.03, since it's already broken in master.

I have not evaluated if #35602 fixes the issue.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 30, 2018
@nh2

nh2 commented May 30, 2018

Copy link
Copy Markdown
Contributor

I have not evaluated if #35602 fixes the issue.

No, probably not, because I'm using that as well and with my latest rebase on release-17.09, I got the dreaded

Bundler will use `/tmp/nix-build-consul-ui-1.0.6.drv-0/bundler/home/root' as your home directory temporarily.
There was an error while trying to write to `/homeless-shelter/.gem/ruby/2.3.0`.
It is likely that you need to grant write permissions for that path.
make: *** [GNUmakefile:10: dist] Error 23
builder for '/nix/store/4h756nkxbn2fl4nzvqaflf2nnpx56hzx-consul-ui-1.0.6.drv' failed with exit code 2

After some significant confusion I figured out that the culprit is this in consul:

https://github.com/hashicorp/consul/blob/9a494b5fb9c86180a5702e29c485df1507a47198/ui/scripts/dist.sh#L18

bundle check >/dev/null 2>&1 || bundle install

First they hide all errors (like missing dependencies). Then call bundle install which fails because writing to HOME=/homeless-shelter is forbidden.

I really think we should patch that line out in nix or ask upstream to do it, because the >/dev/null 2>&1 hides the very helpful actual error message

The following gems are missing
* libv8 (3.16.14.15)

I also had some big trouble finding out how to fix that as it isn't really documented for consul-ui.

The trick (which you obviously know given the PR, so I'm writing this mainly for myself and others) is to do what it says on https://nixos.org/nixpkgs/manual/#sec-language-ruby, but in the ui subdir of the consul source and then to copy the files gemset.nix Gemfile Gemfile.lock created by that process into pkgs/servers/consul.

Not obvious at all. I think we should (in pkgs/servers/consul) create a README file that explains that, or a script that does that.

@nh2 nh2 mentioned this pull request May 30, 2018
@nh2

nh2 commented May 30, 2018

Copy link
Copy Markdown
Contributor

because the fix currently does not work on the master branch.

Why is that?

nh2 added a commit to nh2/nixpkgs that referenced this pull request May 30, 2018
... to a version that can handle Consul >= 1.0.

See NixOS#35602 (comment)

Upgrading consul also requires upgrading the Ruby deps, see
NixOS#41239 (comment)

Also add instructions on how to do that, and a small patch
to improve the error message when it is forgotten.

I had to manually bump the Ruby `json` dependency from the generated
`1.8.2` to `1.8.5` to work around the
  ‘rb_cFixnum’ undeclared
problem as shown on
https://community.bitnami.com/t/gem-file-dependencies/50552.

@nh2 nh2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that?

Ah, I see, it's #41238, sorry.

Comment thread pkgs/servers/consul/ui-lock.patch Outdated
@@ -0,0 +1,44 @@
diff --git a/ui/Gemfile.lock b/ui/Gemfile.lock

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need both otherwise bundler tries to download and install a different version in dist.sh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nh2 I added a commit that patches out the bundler check|install|exec and it works without having to patch the lockfile

@jbboehr

jbboehr commented May 30, 2018

Copy link
Copy Markdown
Contributor Author

I've managed to fix it on the master branch, I'll open a new PR shortly.

@jbboehr jbboehr closed this May 30, 2018
@jbboehr jbboehr mentioned this pull request May 30, 2018
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants