Linux 配置单机 minio 服务
原创
©著作权归作者所有:来自51CTO博客作者isea533的原创作品,请联系作者获取转载授权,否则将追究法律责任
为了在 gitlab-runner 中使用 cache,配置了一个 minio 服务用于存储缓存的中间文件。
- 下载 minio 服务端
- 配置
/etc/default/minio
配置文件
# 修改存储数据的路径
MINIO_VOLUMES="/tmp/minio/"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9000 --console-address :9001"
# Root user for the server.
MINIO_ROOT_USER=Root-User
# Root secret for the server.
MINIO_ROOT_PASSWORD=Root-Password
- 下载
minio.service
文件
[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[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=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=1048576
# 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
# Built for ${project.name}-${project.version} (${project.name})
注意
在2中,设置了一个 minio 的存储目录,在 3 中设置了用户和组,为了避免使用 root,添加下面的组和用户:
sudo groupadd minio
sudo useradd
然后设置 2 中目录的权限:
sudo chown
- 启用和启动服务
- 访问:http://IP:9001
gitlab-runner 的 config.toml
配置
修改 cache 相关的配置:
[runners.cache]
Type = "s3"
Shared = true
[runners.cache.s3]
ServerAddress = "IP:9000"
AccessKey = "USER"
SecretKey = "PASSWORD"
BucketName = "gitlab-runner"
Insecure = true