FS#58260 - [minio] Must define home directory for user

Attached to Project: Community Packages
Opened by Oscar Garcia (ogarcia) - Wednesday, 18 April 2018, 15:38 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Friday, 27 April 2018, 12:27 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The user created by minio package has not home defined. I think that it must be a home directory defined and, for consistency with the rest of the packages, it must be `/var/lib/minio`.

In the other hand, in the package has an `/etc/minio/` directory, the config directory defined in minio.service must be something like `/etc/minio/conf.d` and not
`/srv/minio/conf/`. I think that `/srv/minio` should not exist into pakage.

Finally, minio.service has this line:
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in /etc/defaults/minio\""

The echo line is incorrect since the variable MINIO_VOLUMES is defined in `/etc/minio/minio.conf`.
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Friday, 27 April 2018, 12:27 GMT
Reason for closing:  Fixed
Comment by Doug Newgard (Scimmia) - Wednesday, 18 April 2018, 15:50 GMT
1. Why?
2. Why?
3. Ok, you gave enough info on this one that it makes sense.
Comment by Oscar Garcia (ogarcia) - Wednesday, 18 April 2018, 16:06 GMT
Mmmmm, for points 1 and 2 (re thinking):

By default minio generate its own files in his own directory in ${HOME}/.minio. If the user has not home and you simply execute minio with his own user it cannot write his own files. I think that is better define a home directory for the user and leave the config in its default directory. I say use `/var/lib/minio` for consistency with other packages that use `/var/lib/XXX`.

About the `/etc/minio/conf.d`, this was bad idea because minio writes into his own config directory (sorry, my fault).
Comment by Sven-Hendrik Haase (Svenstaro) - Monday, 23 April 2018, 19:50 GMT
Do you see a problem with setting the home to be /srv/minio? It would be in line with other packages since /srv/ftp is ft's home and /srv/http is http's home.
Comment by Oscar Garcia (ogarcia) - Tuesday, 24 April 2018, 06:49 GMT
I think that `/var/lib/minio` is better for his own configuration file. `/srv/minio` (or whatever) can be a good directory for the minio drive storage, but the home directory (what is where minio writes and read his own config) is better IMHO in `/var/lib` as transmission, nginx, samba, etc...
Comment by Sven-Hendrik Haase (Svenstaro) - Tuesday, 24 April 2018, 22:44 GMT
Ok seems fair. Please test the new package.
Comment by Oscar Garcia (ogarcia) - Wednesday, 25 April 2018, 07:02 GMT
Much better. :-)

But the minio.service need small changes:
WorkingDirectory=/srv/minio -> I think that can delete this line since minio has home directory

The line:
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in /etc/minio/minio.conf\""
makes the test of MINIO_VOLUMES variable and shows a message if the variable is not set, but not exit with error so the ExecStart will run without a needed argument. I think that is better some like this:
ExecStartPre=/bin/bash -c "[ -z \"${MINIO_VOLUMES}\" ] && echo \"Variable MINIO_VOLUMES not set in /etc/minio/minio.conf\" && exit 1"
If no MINIO_VOLUMES, show message and exit with error

And the ExecStart line may change from:
ExecStart=/usr/bin/minio -C /srv/minio/conf/ server $MINIO_OPTS $MINIO_VOLUMES
to:
ExecStart=/usr/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
To use minio home directory to read and write his own config.

Finally (this is a suggestion to maintain systems most clean possible), I think that MINIO_VOLUMES in config must be commented by default to force user that take a look it. And, if the line is commented, I will remove the `install -dm750 -o 103 -g 103 "${pkgdir}/srv/minio"` from `PKGBUILD` so give user the decision of use `/srv/minio` or any other directory. Take note that minio usually be configured with several volumes (and in several machines), and in those cases the `/srv/minio` directory will not used.
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 26 April 2018, 09:16 GMT
Please test the new package and see whether it seems good to you.

However, I won't make the last change because the current way is more in line with how the other packages work. For instance, apache and nginx just work without further config from a safe default dir.
Comment by Oscar Garcia (ogarcia) - Thursday, 26 April 2018, 11:44 GMT
Yes but sorry I have a big mistake in the ExecStartPre line. Must be:
ExecStartPre=/bin/bash -c "{ [ -z \"${MINIO_VOLUMES}\" ] && echo \"Variable MINIO_VOLUMES not set in /etc/minio/minio.conf\" && exit 1; } || true"

This is because if you have configured MINIO_VOLUMES the /bin/bash execution returns 1 and fails. Sorry my fault.

Other form can be:
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || { echo \"Variable MINIO_VOLUMES not set in /etc/minio/minio.conf\" && exit 1; }"

Both are tested and works well.

And sorry again.
Comment by Sven-Hendrik Haase (Svenstaro) - Friday, 27 April 2018, 08:09 GMT
Ok, try now. No worries.
Comment by Oscar Garcia (ogarcia) - Friday, 27 April 2018, 09:25 GMT
Perfect! Can close the bug. And sorry again for my mistakes.

Loading...