Files
Olares/cli/pkg/storage/templates/minio.go

64 lines
2.0 KiB
Go

package templates
import (
"text/template"
"github.com/lithammer/dedent"
)
var MinioService = template.Must(template.New("minio.service").Parse(
dedent.Dedent(`[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable={{ .MinioCommand }}
StartLimitIntervalSec=0
[Service]
WorkingDirectory=/usr/local
User=minio
Group=minio
ProtectProc=invisible
EnvironmentFile=-/etc/default/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
ExecStart={{ .MinioCommand }} server $MINIO_OPTS $MINIO_VOLUMES
# MinIO RELEASE.2023-05-04T21-44-30Z adds support for Type=notify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=)
# This may improve systemctl setups where other services use After=minio.server
# Uncomment the line to enable the functionality
# Type=notify
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Specifies the maximum number of threads this process can create
TasksMax=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
`),
))
var MinioEnv = template.Must(template.New("minio.env").Parse(
dedent.Dedent(`# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
# This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
# Omit to use the default values 'minioadmin:minioadmin'.
# MinIO recommends setting non-default values as a best practice, regardless of environment
MINIO_VOLUMES={{ .MinioDataPath }}
MINIO_OPTS="--console-address {{ .LocalIP }}:9090 --address {{ .LocalIP }}:9000"
MINIO_ROOT_USER={{ .User }}
MINIO_ROOT_PASSWORD={{ .Password }}
`),
))