-
Notifications
You must be signed in to change notification settings - Fork 424
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 build deb and rpm packages. #392
Conversation
.scripts/postinst
Outdated
getent group "$GROUPNAME" >/dev/null || groupadd -r "$GROUPNAME" | ||
getent passwd "$USERNAME" >/dev/null || useradd -r -g "$GROUPNAME" -M -s /sbin/nologin -c "pmm service user" "$USERNAME" | ||
|
||
systemctl daemon-reload > dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this required ? I am not specialist on deb packaging, but it sounds harsh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debian has a lot of helper scripts. For example:
http://manpages.ubuntu.com/manpages/bionic/man1/deb-systemd-invoke.1p.html
The trick is that we need RPM and DEB packages together...
FPM can create systemd service itself but it seems that goreleaser NFPM can't...
Group=pmm | ||
|
||
ExecStart=/usr/bin/mongodb_exporter \ | ||
--mongodb.uri=mongodb://user:[email protected]:27017/admin?ssl=true \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting... this probably should come from the env variables or conf file.
.goreleaser.yml
Outdated
bindir: /usr/bin | ||
replacements: | ||
amd64: 64-bit | ||
darwin: macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed for deb and rpm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this naming is more beautiful...no more.
.scripts/postinst
Outdated
USERNAME="pmm" | ||
|
||
getent group "$GROUPNAME" >/dev/null || groupadd -r "$GROUPNAME" | ||
getent passwd "$USERNAME" >/dev/null || useradd -r -g "$GROUPNAME" -M -s /sbin/nologin -c "pmm service user" "$USERNAME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks overcomplicated. I think we can use the single command:
adduser --quiet --no-create-home --group -c"PMM User" pmm
What's about the defaults file? |
A couple of points:
|
.scripts/postinst
Outdated
# post-installation script, and should be protected with a conditional | ||
# so that unnecessary prompting doesn't happen if a package's | ||
# installation fails and the `postinst' is called with `abort-upgrade', | ||
# `abort-remove' or `abort-deconfigure'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this comment?
.scripts/postinst
Outdated
getent group "$GROUPNAME" >/dev/null || groupadd -r "$GROUPNAME" | ||
getent passwd "$USERNAME" >/dev/null || useradd -r -g "$GROUPNAME" -M -s /sbin/nologin -c "pmm service user" "$USERNAME" | ||
|
||
systemctl daemon-reload > dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debian has a lot of helper scripts. For example:
http://manpages.ubuntu.com/manpages/bionic/man1/deb-systemd-invoke.1p.html
The trick is that we need RPM and DEB packages together...
FPM can create systemd service itself but it seems that goreleaser NFPM can't...
maybe we are over complicating it. Do we really need service file on thi stage? mongo exporter itself doesn't support environment or passing config file or parameter as a file (see #380). I would probably remove service and get service later when mongodb_exporter is better parametrized, like taking user, url, pass from env. |
PMM-5598
Add building deb and rpm packages.