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
Add msi builder #19
Add msi builder #19
Conversation
Very cool! Perhaps the msi should be built using locally compiled wmi_exporter.exe instead? (I'm thinking how to use it in a release process - i guess most users won't run this themselves?) |
Exactly, if we do this in the release, we'll just refer to the .exe we just compiled. I can make some changes so it uses a file taken as in-param. So we just need to decide how the service should be managed. Own code or external dep? |
I would prefer go code to c#, in order to keep the project and dependencies in as few languages as possible. Perhaps we can refactor the bosun windows service code into a separate go package and depend upon that, unless there already is such package. I'll take a look if time permits. |
I think we'd want to msi file to end up as part of the release, rather than built on top of it. On the other hand I haven't really worked with windows for about a decade :) |
@carlpett Can you use this? https://godoc.org/github.com/martinlindhe/winservice |
@brian-brazil Good point. The script is adapted from one I wrote a while ago to create msis for projects that for one reason or another did not ship their own installers and did not want to support one. |
@martinlindhe Yes! I'll pull that in and also change to take a path to executable |
There are two approaches we can take to service installation, I've realized. Either we do what I initially suggested, add some Any preferences, or additional arguments for either side? I've already implemented both strategies to test them out, so there's no overhead from re-implementation... The alternatives are either manual installation and startup,
(The Or, alternatively just
Here we also need to maintain the list of default enabled collectors in the wix file (or do some semi-advanced conditional string manipulation using xml), but the overall flow is a bit smoother. |
that should be the |
I meant the build-script in the second part, actually, sorry for mixing two things in the same sentence :) I have got the |
Ah, nevermind then :) Regarding default enabled collectors in the wix-file,.. since wmi_collector defaults to some enabled ones if none are provided to the wmi_exporter.exe, cant we just use that? So none are provided by the wix-file, and wmi_exporter.exe then use the default? |
Yes, that would be best. However, currently I'm setting the service arguments to |
76414c7
to
783ae16
Compare
Ok, solved that part. The installer can now take parameters for collectors, listen addr/port and path. Once the package is installed, a firewall exception is created, the service is installed and finally started. Great success. Now there are just a few more things...
I had to make some changes to the listener in order for the service to be able to shut it down (replace Also, it turns out that the |
(I'm not really fond of how vendoring makes PRs really blow up, eg |
appveyor runs on all PR's, and should pass assuming EDIT: gotcha! didnt see you extended appveyor to build the msi in this pr |
Yes, I thought that was what we needed? :) Glad you sorted it out then |
I've created a PR to common/log, prometheus/common#56. As soon as that is merged, I can push my updates (because at the moment govendor will blow up). At that point, the major remaining thing is to fix the appveyor setup. |
@carlpett I've added a deploy section to appveyor.yml. Let's find out if it works. FYI, I omitted one tag that might be relevant for it all to function, this one: |
…nd start service, add firewall rule
…ng singleline (each log line becomes a separate event)
eed6a4f
to
aee2e0c
Compare
52c6c6c
to
35268c6
Compare
Alright, the PR is merged in common, so I've updated the reference, updated the AppVeyor script with the token, and added some dependencies that I missed (is there a way to build with govendor locally without using all the packages that I have lying around?). I think that we can't know if the AppVeyor stuff actually works until we've merged this and created a tag, sadly. But it should be fairly quick to fix if it doesn't, one the rest is in master. |
to build wmi_exporter.exe using govendor, the following seems to work
(EDIT: corrected instructions) |
Testing out the branch
However, localhost:5000 does not load. Also tested with port 9182, same issue. Firewall related? Also, uninstalling the msi with |
Confirmed with adbfb7d the service now works 😄 Sorry I did not notice that code change in the original commits, the vendor-folder is really polluting the diffs, making it hard to review. Google came up with this "https://stackoverflow.com/questions/20120478/ignoring-specific-files-file-types-or-folders-in-a-pull-request-diff" (TLDR: cannot easily be done). I guess only work around to avoid huge patches later on would be to split such PR in two, first one to update vendor folder with new dependencies, and a second PR making use of those dependencies. |
No, bug. During the work to make it work as a service, it looks like I managed to forget to attach the http listener... Really wierd, because I tested a lot. Apparently I must have been using an old msi or something from before that change (also quite disturbing).
This I cannot reproduce? Are you looking in the Services console? Did you refresh after uninstalling? |
Re the horrible diffs, I actually contacted GitHub about it yesterday. They make no promises, but "I have definitely added it to the feature request list and will share it with the team for consideration.". So, maybe some day, things will be better... Since AppVeyor builds the PRs (and Github hides the merge button if the check fails, right?) the PR has to contain all the changes necessary to build. I guess we could keep the vendor changes separate, somehow, but it won't be smooth. On the other hand, not being able to review the interesting changes is worse. |
There is an irritating issue remaining, as well - since we do not have a "MessageFile", all eventlog messages are prefixed with a few paragraphs about not knowing how to format the message. The message itself turns up at the end, so not a deal breaker, but pretty irritating. Three options:
|
I figured out a way to test the build-stuff, so now it seems to work with artifact uploading as well. Should we postpone the message file for now @martinlindhe? |
🎉 |
This adds a script which builds a (very) simple msi file. Currently it assumes that binaries for a release are uploaded to
https://github.com/martinlindhe/wmi_exporter/releases/v${Version}_${Arch}.zip
, since that is a common pattern, but maybe we'll want to make this part of a release pipeline? In that case we'll just need to change a few lines to pick up the binaries.Remaining work: