Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traefik: ship webui #41378

Closed
flokli opened this issue Jun 1, 2018 · 11 comments
Closed

traefik: ship webui #41378

flokli opened this issue Jun 1, 2018 · 11 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 9.needs: package (update) This needs a package to be updated

Comments

@flokli
Copy link
Contributor

flokli commented Jun 1, 2018

Issue description

Copied over from #41208:

Since 1.6.0, Træfik normally ships a webui (traefik/traefik#2226) at http://localhost:8080/dashboard/, displaying current configuration, status and latest errors (if enabled).

The upstream build process seems to include spinning up a docker container, basically compiling files in webui using ng build --prod --no-delete-output-path --output-path ../static/ (from inside webui folder), which is then baked into the binary using go-bindata.

Our build process leaves the static folder empty, so the dashboard would return a 404.
We should at least document that, but it would be even better if we shipped the dashboard too, as it's really nice :-)

I tried packaging ng and the webui subproject using yarn2nix, while trying to bump this package at an earlier attempt, but wasn't that successful.
I got all dependencies properly nixified, but had problems with building the ng binary itself.

/cc @vdemeester @ryantm @xeji

@xeji xeji added the 9.needs: package (update) This needs a package to be updated label Jun 2, 2018
@ljani
Copy link
Contributor

ljani commented Oct 13, 2019

Here's a workaround inspired by #65166 (for #42614) for the time being:

{ stdenv, fetchurl }:

let
  version = "2.0.2";

  sources = let
    base = "https://github.com/containous/traefik/releases/download/v${version}";
  in {
    "x86_64-linux" = fetchurl {
      url = "${base}/traefik_v${version}_linux_amd64.tar.gz";
      sha256 = "f9adf514fc7ae0e90b88680213d44d59df429d8b68978b4a7ed4f9408fb0ad67";
    };
  };
in stdenv.mkDerivation rec {
  pname = "traefik-bin";
  inherit version;

  src = sources."${stdenv.hostPlatform.system}" or (throw "unsupported system: ${stdenv.hostPlatform.system}");

  sourceRoot = ".";

  installPhase = ''
    runHook preInstall

    mkdir -p $bin/bin $out/bin
    mv traefik $bin/bin

    runHook postInstall
  '';

  meta = with stdenv.lib; {
    homepage = https://traefik.io/;
    description = "A modern reverse proxy";
    platforms = [ "x86_64-linux" ];
    license = licenses.mit;
    maintainers = with maintainers; [ hamhut1066 vdemeester ];
  };

   outputs = [ "bin" "out" ];
}

I'm not too eager to send a PR since I have no idea what I'm doing, but it seems to work with services.traefik.package = pkgs.callPackage ./traefik-bin.nix {}; I guess something similar would work for nixpkgs as well.

EDIT: This should work for v1.7 as well.

@dali99 dali99 mentioned this issue Dec 26, 2019
@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@flokli
Copy link
Contributor Author

flokli commented Jun 1, 2020

Building javascript frontends with Nix unfortunately isn't quite nice, and the tooling we have isn't too good either. I doubt we'll be able to solve this any time soon.

@ljani, in the meantime traefik has been bumped to 2.x (in #76723) - would you be up to create a PR adding a traefik-bin derivation, that ships the webui?

Users that want it could then set services.traefik.package = pkgs.traefik-bin; to get the webui, which sounds like a good compromise.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@ljani
Copy link
Contributor

ljani commented Jun 4, 2020

@flokli: It seems I do not have enough time to play at this point, sorry. Also, I've moved to Debian on WSL2 for the time being. I should try that NixOS for WSL2 package first.

@jokogr
Copy link
Contributor

jokogr commented Jun 6, 2020

Actually I have a working version of this, but it's not very maintainable: people would have to manually do the version bump for the frontend. Would anyone be interested to make a PR for that?

@flokli
Copy link
Contributor Author

flokli commented Jun 6, 2020

@jokogr I'm not sure if I quite follow - why would traefik-bin require a manual version bump for the frontend?

@jokogr
Copy link
Contributor

jokogr commented Jun 6, 2020

@flokli I meant to say that I have already managed to package the frontend inside the traefik package, but I don't have a solid way to handle its update, one needs to do some manual steps.

Should I create a PR, so that you could have a look?

@flokli
Copy link
Contributor Author

flokli commented Jun 8, 2020

@jokogr it probably depends on how much code and how maintainable it is.

If we need to jump through a lot of hoops to update the package, maybe it's better to ship it without the webui, and provide the binary package for those who want the webui.

@eljojo
Copy link

eljojo commented Jul 4, 2020

Hi any updates on this? anyway to continue this work?

@flokli
Copy link
Contributor Author

flokli commented Jul 6, 2020

@eljojo I think getting #41378 (comment) would be a good start :-)

@stale
Copy link

stale bot commented Jan 2, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 2, 2021
@NickCao NickCao closed this as completed Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 9.needs: package (update) This needs a package to be updated
Projects
None yet
Development

No branches or pull requests

6 participants