prometheus_wireguard_exporter icon indicating copy to clipboard operation
prometheus_wireguard_exporter copied to clipboard

It would be nice if github releases had binaries for download

Open jrwren opened this issue 4 years ago • 15 comments

I don't know how to set this up or if it can be automated with actions, but if someone can point me to docs and it is acceptable I'd love to send a PR to implement this.

I don't know rust and cargo and so I extracted a binary from the docker image. It works well, but it is less than ideal.

jrwren avatar May 27 '21 01:05 jrwren

I don't really know how to add this as a GitHub Action, but here is my workaround for now:

You can use the following snippet to compile the exporter with musl for x86_64.

The binary will be in $(pwd)/target/x86_64-unknown-linux-musl/release/prometheus_wireguard_exporter.

git clone https://github.com/MindFlavor/prometheus_wireguard_exporter.git
cd prometheus_wireguard_exporter
docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder cargo build --release

tobikris avatar Jun 08 '21 10:06 tobikris

The Docker build now cross build for all available architectures, maybe we can use it and send the built binaries (statically linked with musl bundled) to the Github API.

Now the problem comes with OSX since all musl cross building tooling is for linux and not darwin, I'm not sure it would work.

Anyway, I think it's best to just use a Github Action for it (duplicating the CI work, but oh well), ~https://github.com/marketplace/actions/rust-release-binary looks promising.~ (only supports x86_64 ugh)

qdm12 avatar Jul 08 '21 18:07 qdm12

Also note you could (trigger warning: sort of ugly) for Linux, as long as you have Docker, do:

docker pull mindflavor/prometheus_wireguard_exporter && \
  containerid="$(docker create mindflavor/prometheus_wireguard_exporter)" && \
  docker cp "$containerid:/usr/local/bin/prometheus_wireguard_exporter" /usr/local/bin/prometheus_wireguard_exporter && \
  docker rm "$containerid"

And have the static binary on your host 😉 I'll dig on how to upload them to Github releases using a similar approach, at least we will have Linux binaries. OSX will have to wait though.

EDIT: That should do together with those ugly docker commands running in the CI. I'll do it sometime soon.

qdm12 avatar Jul 08 '21 18:07 qdm12

Is this ticket still alive? The PR could be merged without conflicts...

upstream-dmahlberg avatar Nov 03 '21 13:11 upstream-dmahlberg

Hi @upstream-dmahlberg, I'll leave to @qdm12 to decide what to do on that PR. He's much more competent than me on the subject!

MindFlavor avatar Nov 03 '21 14:11 MindFlavor

@MindFlavor @qdm12 Any updates on this?

upstream-dmahlberg avatar Feb 24 '22 14:02 upstream-dmahlberg

Merged, sorry guys for the long delay. I'll try to dig into it in the coming weeks, to improve the CI pipeline.

EDIT: It's merged thanks @micxer so we should have binaries on tags.

qdm12 avatar Mar 09 '22 11:03 qdm12

This is awesome, thanks for the work on this! Any chance to get a new tag/release to publish initial binaries? :)

ekeih avatar Mar 10 '22 18:03 ekeih

@micxer it doesn't look like it's building binaries on the latest tag, any clue why? I'm afk for the coming days so I can't really investigate.

qdm12 avatar Mar 12 '22 06:03 qdm12

is there any update. would be awesome if this is working, i want to add it to this https://github.com/voxpupuli/puppet-prometheus/ puppet module

sebastianrakel avatar May 23 '22 13:05 sebastianrakel