-
Notifications
You must be signed in to change notification settings - Fork 8
/
tokumx-bin.rb
269 lines (214 loc) · 9.07 KB
/
tokumx-bin.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
require "formula"
class TokumxBin < Formula
homepage "http://www.tokutek.com/tokumx-for-mongodb"
version "2.0.0"
conflicts_with "mongodb"
url "https://s3.amazonaws.com/tokumx-2.0.0/tokumx-2.0.0-osx-x86_64-main.tar.gz"
sha1 "ad575f0868a778bca45eea404346e9823d6d5ef2"
option "email=", "Provide your email address to keep up with TokuMX news"
raise FormulaSpecificationError, 'Formula requires Mavericks or Yosemite (OSX 10.9 or 10.10)' unless MacOS.version >= :mavericks
def install
email = ARGV.value("email")
email.strip! if email
unless email and not email.empty?
email = `osascript -e 'Tell application "System Events" to display dialog "Provide your email address to keep up with TokuMX news:" default answer "email address"' -e "text returned of result"`
raise CannotInstallFormulaError, "Canceling at user request." unless $?.success?
end
email.strip!
if email.empty?
curl "-X", "POST", "--data-urlencode", "[email protected]", "--data-urlencode", "source=homebrew", "--data-urlencode", "product=tokumx", "-o", "/dev/null", "-s", "http://www.tokutek.com/simple_create_account.php"
else
curl "-X", "POST", "--data-urlencode", "email=#{email}", "--data-urlencode", "source=homebrew", "--data-urlencode", "product=tokumx", "-o", "/dev/null", "-s", "http://www.tokutek.com/simple_create_account.php"
end
bin.install Dir["bin/*"]
lib.install Dir["lib64/*"]
share.install Dir["scripts"]
doc.install "GNU-AGPL-3.0", "THIRD-PARTY-NOTICES", "NEWS", "README", "README-TOKUKV"
(buildpath+"tokumx.conf").write tokumx_conf
etc.install "tokumx.conf"
(var+"tokumx").mkpath
(var+"log/tokumx").mkpath
(var+"run/tokumx").mkpath
end
def tokumx_conf; <<-EOS.undent
# tokumx.conf
#
# This configuration file contains most of the useful options and their
# defaults for TokuMX. For the full set of all available options, see
# the Users" Guide available at
# http://www.tokutek.com/products/downloads/tokumx-ce-downloads/
########################################################################
# PROCESS OPTIONS
# Where to store the data.
#
# Note: if you run tokumx as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn"t mutable by the tokumx user.
dbpath = #{var}/tokumx
# Where to log informational and debugging messages.
logpath = #{var}/log/tokumx/tokumx.log
# Use the syslog facility instead of a log file.
#syslog = false
# Append entries to the log rather than rotating old logs out.
logappend = true
# Port to accept client connections.
#port = 27017
# Only accept local connections
bind_ip = 127.0.0.1
# fork and run in background
#fork = false
# location of pidfile (default: no pidfile)
#pidfilepath = #{var}/run/tokumx/tokumx.pid
########################################################################
# FRACTAL TREE STORAGE OPTIONS
# Amount of memory (in bytes) used to cache documents and indexes in
# memory, uncompressed. Value can be specified with K/M/G/T suffix.
# Default is half of physical memory, determined at startup.
#cacheSize = 8G
# Use direct I/O to access data on disk, bypassing the kernel page
# cache. When using direct I/O, it is usually good to set cacheSize
# higher (around 80% of physical memory). Out-of-memory workloads
# typically perform better with direct I/O on and a larger cacheSize.
#directio = false
# Flush the recovery log every logFlushPeriod milliseconds (similar to
# journalCommitInterval in vanilla mongodb). Unlike vanilla mongodb,
# logFlushPeriod=0 means flush after every operation commit, which can
# be slow. getLastError commands with {j:1} force this flush. Valid
# values are 0-300ms, default is 100ms.
#logFlushPeriod = 100
# Directory where the recovery log (similar to mongodb durability
# journal) is stored.
#logDir = <same as dbpath>
# Directory where TokuMX will place temporary files used by the bulk
# loader for building collections and indexes (used by mongorestore,
# mongoimport, and non-background index creation).
#tmpDir = <same as dbpath>
########################################################################
# REPLICATION OPTIONS
# in replica set configuration, specify the name of the replica set
#replSet = setname
# How many days of oplog data to keep. If a secondary falls more than
# this many days behind, it will need to resync.
#expireOplogDays = 14
########################################################################
# MISC OPTIONS
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security. Off is currently the default
#noauth = true
#auth = true
# Verbose logging output.
#verbose = true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
# Enable db quota management
#quota = true
# Set oplogging level where n is
# 0=off (default)
# 1=W
# 2=R
# 3=both
# 7=W+some reads
#diaglog = 0
# Ignore query hints
#nohints = true
# Disable the HTTP interface (Defaults to localhost:28017).
#nohttpinterface = true
# Turns off server-side scripting. This will result in greatly limited
# functionality
#noscripting = true
# Turns off table scans. Any query that would do a table scan fails.
#notablescan = true
########################################################################
# MMS OPTIONS
# Account token for Mongo monitoring server.
#mms-token = <token>
# Server name for Mongo monitoring server.
#mms-name = <server-name>
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>
########################################################################
# ADVANCED FRACTAL TREE STORAGE OPTIONS
#
# In most cases, these options should be left at their default settings.
#
# Number of milliseconds that a transaction will wait for a lock held by
# another transaction to be released. If the conflicting transaction
# does not release the lock within the lock timeout, the transaction
# that was waiting for the lock will get a lock timeout error. A value
# of 0 disables lock waiting.
#lockTimeout = 4000
# Amount of memory (in bytes) used by the tree that tracks
# document-level locking. Default value is 10% of cacheSize (this
# memory is taken in addition to the cache, not taken from the cache"s
# allowance).
#locktreeMaxMemory = 800M
# Amount of memory (in bytes) used by the bulk loader when a bulk load
# is active.
#loaderMaxMemory = 100M
# Time in seconds between the start of consecutive checkpoints.
#checkpointPeriod = 60
# Time in seconds between consecutive cleaner thread runs. 0 disables
# the cleaner thread.
#cleanerPeriod = 2
# How many nodes to flush on each run of the cleaner thread. 0 disables
# cleaner threads.
#cleanerIterations = 5
# Percentage of the filesystem"s size that must be free to allow inserts
# and updates. If free space falls below this percentage, the database
# will go into read-only mode.
#fsRedzone = 5
# Only affects replica sets. Amount in bytes of oplog data a
# transaction will store in memory before spilling the data to disk in
# the local.oplog.refs collection. Maximum value is 2MB.
#txnMemLimit = 1M
# Whether the bulk loader (used by mongoimport/mongorestore and
# non-background index builds) compresses intermediate files before
# writing to disk. These are the intermediate files that are written
# in tmpDir (see above).
#loaderCompressTmp = true
EOS
end
plist_options :manual => "mongod --config #{HOMEBREW_PREFIX}/etc/tokumx.conf"
def plist; <<-EOS.undent
<?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>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/mongod</string>
<string>--config</string>
<string>#{etc}/tokumx.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/tokumx/output.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/tokumx/output.log</string>
<key>HardResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>1024</integer>
</dict>
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>1024</integer>
</dict>
</dict>
</plist>
EOS
end
test do
system "#{bin}/mongod", "--sysinfo"
end
end