Minio it is self-hosted storage compartible with s3 API
Create key and secret
cat /proc/cpuinfo /proc/iomem | sha512sum | awk '{print "\nkey = " substr($1,1,24) "\nsecret = " substr($1,25,64) }'
Make nomad file
job "minio-test" {
datacenters = ["dc1"]
type = "service"
group "minio" {
count = 1
task "minio-test" {
driver = "docker"
config {
image = "minio/minio:edge"
args = [ "server", "/data" ]
port_map {
http = 9000
}
volumes = [
"/tmp/minio-test/data:/data",
"/tmp/minio-test/config:/root/.minio"
]
}
env {
"MINIO_ACCESS_KEY" = "642a51...eff82eb",
"MINIO_SECRET_KEY" = "0c936a31990cc515a0da1e748....7795c74cfcc60cc256f47880db7b"
}
resources {
cpu = 600 # 600 MHz
memory = 1024 # 1024 MB
network {
mbits = 100
port "http" {
static = 12345
}
}
}
service {
name = "minio-test"
tags = [ "minio", "web", "urlprefix-/minio" ]
port = "http"
check {
type = "tcp"
interval = "60s"
timeout = "5s"
}
}
}
}
}
Get mc
– CLI for Minio
wget https://dl.min.io/client/mc/release/linux-amd64/mc
mv mc /usr/local/mc
chmod +x /usr/local/mc
Create connection to storage and add bucket
mc config host add minio-cloud http://10.0.0.1:10002 <key> <secret>
mc mb minio-cloud/reverse
Create file with policy user.json
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:PutBucketPolicy",
"s3:GetBucketPolicy",
"s3:DeleteBucketPolicy",
"s3:ListAllMyBuckets",
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::reverse"
],
"Sid": ""
},
{
"Action": [
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:GetObject",
"s3:ListMultipartUploadParts",
"s3:PutObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::reverse/*"
],
"Sid": ""
}
]
}
Add policy
mc admin policy add minio-cloud user user.json
mc admin policy info minio-cloud user
Add user
mc admin user add minio-cloud <user> <pass>
Apply policy to user
mc admin policy set minio-cloud user user=user
mc admin user list minio-cloud --json
Go to another server/OS configure connect to minio and test upload
mc cp /var/log/messages minio-cloud/reverse/log/
Done
Documentation – https://docs.min.io/docs/minio-client-complete-guide.html