-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminio.rb
123 lines (112 loc) · 3.88 KB
/
minio.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
class Minio < Formula
# minio specific
git_tag = "RELEASE.2020-07-24T22-43-05Z"
desc "High Performance Object Storage compatible with Amazon S3 API"
homepage "https://min.io"
url "https://github.com/minio/minio"
version git_tag
revision 1
if OS.mac?
url "https://dl.minio.io/server/minio/release/darwin-amd64/minio.#{version}"
sha256 "674de47afe5128f2e482f593dd7ae3414823324dd888c1e1dec2750db3072fa1"
elsif OS.linux?
url "https://dl.minio.io/server/minio/release/linux-amd64/minio.#{version}"
sha256 "d4a98db20b29b3ef74b5835b885b82f6cdd741f9aa031e33c9540dd11e6fd35b"
end
bottle :unneeded
depends_on :arch => :x86_64
def install
bin.install Dir.glob("minio.*").first => "minio"
end
def post_install
(var/"minio").mkpath
(etc/"minio").mkpath
ohai "Download complete!"
ohai "Useful links:"
puts <<~EOS
Command-line Access: https://docs.min.io/docs/minio-client-quickstart-guide
Object API (Amazon S3 compatible):
Go: https://docs.min.io/docs/golang-client-quickstart-guide
Java: https://docs.min.io/docs/java-client-quickstart-guide
Python: https://docs.min.io/docs/python-client-quickstart-guide
JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
.NET: https://docs.min.io/docs/dotnet-client-quickstart-guide
Talk to the community: https://slack.min.io
EOS
ohai "Get started:"
puts `#{bin}/minio server -h`
end
plist_options :manual => "minio server"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/minio</string>
<string>server</string>
<string>--config-dir=#{etc}/minio</string>
<string>--address=:9000</string>
<string>#{var}/minio</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/minio.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/minio.log</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
(testpath/"config.json").write <<~EOS
{
"version": "14",
"credential": {
"accessKey": "minio",
"secretKey": "minio123"
},
"region": "us-east-1",
"browser": "on",
"logger": {
"console": {
"level": "error",
"enable": true
},
"file": {
"level": "error",
"enable": false,
"filename": ""
}
},
"notify": {
"redis": {
"1": {
"enable": true,
"address": "127.0.0.1:6379",
"password": "",
"key": "minio_events"
}
}
}
}
EOS
minio_io = IO.popen("#{bin}/minio --config-dir #{testpath} server #{testpath}/export", :err=>[:child, :out])
sleep 1
Process.kill("INT", minio_io.pid)
assert_match("connection refused", minio_io.read)
end
end