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
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
|
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
2. Why?
3. Ok, you gave enough info on this one that it makes sense.
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).
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.
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.
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.