3
0
Fork 0
forked from mirrors/nixpkgs

consul: 0.9.3 -> 1.3.0.

Removes the old UI build tooling; it is no longer necessary
because as of 1.2.0 it's bundled into the server binary.
It doesn't even need to have JS built, because it's bundled into
the release commit's source tree (see #48714).

The UI is enabled by default, so the NixOS service is
updated to directly use `ui = webUi;` now.

Fixes #48714.
Fixes #44192.
Fixes #41243.
Fixes #35602.

Signed-off-by: Niklas Hambüchen <mail@nh2.me>
This commit is contained in:
Niklas Hambüchen 2018-10-26 18:07:56 +02:00
parent df28b4b6e5
commit 2cb7f5fb1e
8 changed files with 16 additions and 162 deletions

View file

@ -6,9 +6,10 @@ let
dataDir = "/var/lib/consul";
cfg = config.services.consul;
configOptions = { data_dir = dataDir; } //
(if cfg.webUi then { ui_dir = "${cfg.package.ui}"; } else { }) //
cfg.extraConfig;
configOptions = {
data_dir = dataDir;
ui = cfg.webUi;
} // cfg.extraConfig;
configFiles = [ "/etc/consul.json" "/etc/consul-addrs.json" ]
++ cfg.extraConfigFiles;

View file

@ -1,5 +0,0 @@
# A sample Gemfile
source "https://rubygems.org"
gem "uglifier"
gem "sass"

View file

@ -1,25 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
execjs (2.7.0)
ffi (1.9.23)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
uglifier (4.1.10)
execjs (>= 0.3.0, < 3)
PLATFORMS
ruby
DEPENDENCIES
sass
uglifier
BUNDLED WITH
1.14.6

View file

@ -1,22 +1,27 @@
{ stdenv, buildGoPackage, consul-ui, fetchFromGitHub }:
{ stdenv, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
name = "consul-${version}";
version = "0.9.3";
version = "1.3.0";
rev = "v${version}";
goPackagePath = "github.com/hashicorp/consul";
# Note: Currently only release tags are supported, because they have the Consul UI
# vendored. See
# https://github.com/NixOS/nixpkgs/pull/48714#issuecomment-433454834
# If you want to use a non-release commit as `src`, you probably want to improve
# this derivation so that it can build the UI's JavaScript from source.
# See https://github.com/NixOS/nixpkgs/pull/49082 for something like that.
# Or, if you want to patch something that doesn't touch the UI, you may want
# to apply your changes as patches on top of a release commit.
src = fetchFromGitHub {
owner = "hashicorp";
repo = "consul";
inherit rev;
sha256 = "1176frp7kimpycsmz9wrbizf46jgxr8jq7hz5w4q1x90lswvrxv3";
sha256 = "1zv84snvrjm74w3v3rr27linsbxj00m73xd047sb78a4766xs2h0";
};
# Keep consul.ui for backward compatability
passthru.ui = consul-ui;
preBuild = ''
buildFlagsArray+=("-ldflags" "-X github.com/hashicorp/consul/version.GitDescribe=v${version} -X github.com/hashicorp/consul/version.Version=${version} -X github.com/hashicorp/consul/version.VersionPrerelease=")
'';
@ -26,6 +31,6 @@ buildGoPackage rec {
homepage = https://www.consul.io/;
platforms = platforms.linux ++ platforms.darwin;
license = licenses.mpl20;
maintainers = with maintainers; [ pradeepchhetri ];
maintainers = with maintainers; [ pradeepchhetri vdemeester nh2 ];
};
}

View file

@ -1,62 +0,0 @@
{
execjs = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1yz55sf2nd3l666ms6xr18sm2aggcvmb8qr3v53lr4rir32y1yp1";
type = "gem";
};
version = "2.7.0";
};
ffi = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "0zw6pbyvmj8wafdc7l5h7w20zkp1vbr2805ql5d941g2b20pk4zr";
type = "gem";
};
version = "1.9.23";
};
rb-fsevent = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1lm1k7wpz69jx7jrc92w3ggczkjyjbfziq5mg62vjnxmzs383xx8";
type = "gem";
};
version = "0.10.3";
};
rb-inotify = {
dependencies = ["ffi"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0yfsgw5n7pkpyky6a9wkf1g9jafxb0ja7gz0qw0y14fd2jnzfh71";
type = "gem";
};
version = "0.9.10";
};
sass = {
dependencies = ["sass-listen"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "19wyzp9qsg8hdkkxlsv713w0qmy66qrdp0shj42587ssx4qhrlag";
type = "gem";
};
version = "3.5.6";
};
sass-listen = {
dependencies = ["rb-fsevent" "rb-inotify"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0xw3q46cmahkgyldid5hwyiwacp590zj2vmswlll68ryvmvcp7df";
type = "gem";
};
version = "4.0.0";
};
uglifier = {
dependencies = ["execjs"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0dycp9c5xiricla6sgvg0vf22i3axs5k1v1607dvl7nv1xkkaczi";
type = "gem";
};
version = "4.1.10";
};
}

View file

@ -1,17 +0,0 @@
diff --git a/ui/scripts/dist.sh b/ui/scripts/dist.sh
index 0ad6e28e..db340da0 100755
--- a/ui/scripts/dist.sh
+++ b/ui/scripts/dist.sh
@@ -15,10 +15,9 @@ DEPLOY="../pkg/web_ui"
rm -rf $DEPLOY
mkdir -p $DEPLOY
-bundle check >/dev/null 2>&1 || bundle install
-bundle exec sass styles/base.scss static/base.css
+sass styles/base.scss static/base.css
-bundle exec ruby scripts/compile.rb
+ruby scripts/compile.rb
# Copy into deploy
shopt -s dotglob

View file

@ -1,41 +0,0 @@
{ stdenv, consul, ruby, bundlerEnv, zip, nodejs }:
let
# `sass` et al
gems = bundlerEnv {
name = "consul-ui-deps";
gemdir = ./.;
};
in
stdenv.mkDerivation {
name = "consul-ui-${consul.version}";
src = consul.src;
buildInputs = [ ruby gems zip nodejs ];
patches = [ ./ui-no-bundle-exec.patch ];
postPatch = "patchShebangs ./ui/scripts/dist.sh";
buildPhase = ''
# Build ui static files
cd ui
make dist
'';
installPhase = ''
# Install ui static files
mkdir -p $out
mv ../pkg/web_ui/* $out
'';
meta = with stdenv.lib; {
homepage = https://www.consul.io/;
description = "A tool for service discovery, monitoring and configuration";
maintainers = with maintainers; [ cstrahan wkennington ];
license = licenses.mpl20 ;
platforms = platforms.unix;
};
}

View file

@ -1136,8 +1136,6 @@ with pkgs;
consul = callPackage ../servers/consul { };
consul-ui = callPackage ../servers/consul/ui.nix { };
consul-alerts = callPackage ../servers/monitoring/consul-alerts { };
consul-template = callPackage ../tools/system/consul-template { };