Bug 217173 - [PATCH] www/minio: update to 2017.02.16.01.47.30
Summary: [PATCH] www/minio: update to 2017.02.16.01.47.30
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Steve Wills
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-02-17 14:09 UTC by John Hixson
Modified: 2017-02-22 19:59 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (swills)


Attachments
port diff file (3.18 KB, patch)
2017-02-17 14:09 UTC, John Hixson
no flags Details | Diff
port diff file (4.05 KB, patch)
2017-02-17 16:02 UTC, John Hixson
no flags Details | Diff
minio diff file (4.14 KB, patch)
2017-02-17 17:54 UTC, John Hixson
no flags Details | Diff
port diff file (3.48 KB, patch)
2017-02-22 15:32 UTC, John Hixson
no flags Details | Diff
port diff file (3.77 KB, patch)
2017-02-22 17:56 UTC, John Hixson
no flags Details | Diff
UIDs diff with minio user (455 bytes, patch)
2017-02-22 17:56 UTC, John Hixson
no flags Details | Diff
GIDs diff with minio group (244 bytes, patch)
2017-02-22 17:57 UTC, John Hixson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hixson freebsd_committer freebsd_triage 2017-02-17 14:09:25 UTC
Created attachment 180076 [details]
port diff file
Comment 1 John Hixson freebsd_committer freebsd_triage 2017-02-17 16:02:39 UTC
Created attachment 180081 [details]
port diff file

Updated RC script will stop minio and display status
Comment 2 John Hixson freebsd_committer freebsd_triage 2017-02-17 17:54:36 UTC
Created attachment 180086 [details]
minio diff file

Added ability to set environment. Also log to /var/log/minio.log. Sorry for updating this 3 times. We are using this in FreeNAS and I had to fine tune it for usage.
Comment 3 Steve Wills freebsd_committer freebsd_triage 2017-02-22 14:31:41 UTC
(In reply to jhixson from comment #2)

There are a few issues with the RC script:

1. I get an error from this:

# service minio rcvar
/usr/local/etc/rc.d/minio: ERROR: USAGE: load_rc_config name

because "load_rc_config ${name}" is called before "name=minio".

2. Also, minio_env is handled by rc.subr, so there's no need for that line in the rc script. It is needed in the command_args. (And users won't need to set minio_env, unless they for some reason prefer to set things in /etc/rc.conf instead of /usr/local/etc/minio/config.json.)

3. The default minio_config directory /usr/local/etc/minio doesn't exist. The port should be updated to create it.

4. The minio_disks setting doesn't default to anything so by default if the user simply enables the service and starts it, it will silently fail. The port should create a dir, perhaps /var/db/minio and default to that for the minio_disks setting.

5. The minio_stop, minio_start and minio_check_pidfile functions are not needed. The default functions for these will work fine as long as you set procname="/usr/local/bin/minio". (This will look like %%PREFIX%% in minio.in and get replaced during package build.)

6. This is a bit of a personal preference, but I think it would be good to add --quiet to the command_args.
Comment 4 John Hixson freebsd_committer freebsd_triage 2017-02-22 14:51:30 UTC
(In reply to Steve Wills from comment #3)

1. This was an oversight on my part, sorry. I've fixed this in FreeNAS ;-)

2. The reason for wanting to set minio_env in rc.conf is for minio distributed mode, which myself and Kris Moore have tested and is known to work. 

3. I'll provide a new patch with the suggested updates

4. Is this typical behavior for ports? I'm of the opinion that failing is the correct thing to do when not configured. 

5. These were added since the script was not behaving correctly, which was probably due the first problem. I'll test again and fix if necessary.

6. Will do!
Comment 5 John Hixson freebsd_committer freebsd_triage 2017-02-22 15:32:10 UTC
Created attachment 180220 [details]
port diff file

I wasn't aware of the procname variable used with daemon, glad to know about that one. I had a fun time debugging that before it was spelled out for me ;-) This diff works and hopefully meets the criteria specified.
Comment 6 Steve Wills freebsd_committer freebsd_triage 2017-02-22 15:56:01 UTC
(In reply to jhixson from comment #5)
Please remove the line:

minio_env=${minio_env:=""}

Please add "/usr/bin/env ${minio_env}" back to command_args. Please change /usr/local to %%PREFIX%% in command_args.

About the minio_disks, I think it's a bit of a bad user experience to install the package, enable the service, start it, and then have the service appear as though it started, but instead fail silently. Is there any down side to having a default location for data and using it, given we make it easy for the user to configure another location if/when they need to?

Also, the port should create a minio user and run as that user, but that will require a few other changes. The minio_startprecmd function will have to change to create a dir for the pid file owned by the user, and to use that user for the config dir. It will also need minio_user and minio_group variables to allow override. There are a number of examples of this in various rc scripts, and I can help with these if you like.
Comment 7 John Hixson freebsd_committer freebsd_triage 2017-02-22 17:56:21 UTC
Created attachment 180224 [details]
port diff file

I've taken everything you've said into account. Here is current diff. It seems pretty solid. UIDs and GIDs diff files to follow.
Comment 8 John Hixson freebsd_committer freebsd_triage 2017-02-22 17:56:56 UTC
Created attachment 180225 [details]
UIDs diff with minio user
Comment 9 John Hixson freebsd_committer freebsd_triage 2017-02-22 17:57:25 UTC
Created attachment 180226 [details]
GIDs diff with minio group
Comment 10 Steve Wills freebsd_committer freebsd_triage 2017-02-22 18:44:19 UTC
(In reply to jhixson from comment #9)
Looks good, but needs USERS and GROUPS set in Makefile. Also, the resulting binary reports its version as 0.0.0, so perhaps the do-build change needs some work.
Comment 11 Steve Wills freebsd_committer freebsd_triage 2017-02-22 19:10:21 UTC
(In reply to Steve Wills from comment #10)
Nevermind, this seems to be an upstream issue as the binary produced there does the same. That said, we need to update files/patch-buildscripts_gen-ldflags.go to the new version as well. And there's no point having USES=go when you override both targets that it provides. I'll update and commit.
Comment 12 commit-hook freebsd_committer freebsd_triage 2017-02-22 19:58:40 UTC
A commit references this bug:

Author: swills
Date: Wed Feb 22 19:57:46 UTC 2017
New revision: 434636
URL: https://svnweb.freebsd.org/changeset/ports/434636

Log:
  www/minio: update to 2017.02.16.01.47.30

  While here, add rc script and user

  PR:		217173
  Submitted by:	jhixson@gmail.com (with changes)

Changes:
  head/GIDs
  head/UIDs
  head/www/minio/Makefile
  head/www/minio/distinfo
  head/www/minio/files/minio.in
  head/www/minio/files/patch-buildscripts_gen-ldflags.go
Comment 13 Steve Wills freebsd_committer freebsd_triage 2017-02-22 19:59:02 UTC
Committed