bson 4.9.0 → 4.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +15 -6
- data/ext/bson/bson-native.h +4 -0
- data/ext/bson/init.c +75 -23
- data/ext/bson/read.c +63 -11
- data/ext/bson/write.c +42 -3
- data/lib/bson/active_support.rb +1 -0
- data/lib/bson/array.rb +5 -1
- data/lib/bson/big_decimal.rb +67 -0
- data/lib/bson/binary.rb +8 -5
- data/lib/bson/boolean.rb +2 -1
- data/lib/bson/code.rb +2 -1
- data/lib/bson/code_with_scope.rb +2 -1
- data/lib/bson/config.rb +1 -0
- data/lib/bson/date.rb +1 -0
- data/lib/bson/date_time.rb +2 -1
- data/lib/bson/db_pointer.rb +2 -1
- data/lib/bson/dbref.rb +152 -0
- data/lib/bson/decimal128/builder.rb +27 -20
- data/lib/bson/decimal128.rb +39 -14
- data/lib/bson/document.rb +61 -18
- data/lib/bson/environment.rb +1 -0
- data/lib/bson/error.rb +13 -0
- data/lib/bson/ext_json.rb +24 -11
- data/lib/bson/false_class.rb +2 -1
- data/lib/bson/float.rb +21 -32
- data/lib/bson/hash.rb +18 -6
- data/lib/bson/int32.rb +3 -2
- data/lib/bson/int64.rb +3 -2
- data/lib/bson/integer.rb +3 -2
- data/lib/bson/json.rb +1 -0
- data/lib/bson/max_key.rb +3 -2
- data/lib/bson/min_key.rb +3 -2
- data/lib/bson/nil_class.rb +2 -1
- data/lib/bson/object.rb +1 -0
- data/lib/bson/object_id.rb +4 -3
- data/lib/bson/open_struct.rb +1 -0
- data/lib/bson/regexp.rb +24 -7
- data/lib/bson/registry.rb +1 -0
- data/lib/bson/specialized.rb +1 -0
- data/lib/bson/string.rb +3 -2
- data/lib/bson/symbol.rb +2 -1
- data/lib/bson/time.rb +4 -3
- data/lib/bson/time_with_zone.rb +1 -0
- data/lib/bson/timestamp.rb +7 -6
- data/lib/bson/true_class.rb +2 -1
- data/lib/bson/undefined.rb +2 -1
- data/lib/bson/version.rb +2 -1
- data/lib/bson.rb +8 -5
- data/spec/README.md +14 -0
- data/spec/bson/array_spec.rb +17 -0
- data/spec/bson/big_decimal_spec.rb +316 -0
- data/spec/bson/binary_spec.rb +1 -1
- data/spec/bson/binary_uuid_spec.rb +12 -0
- data/spec/bson/byte_buffer_read_spec.rb +59 -3
- data/spec/bson/byte_buffer_spec.rb +129 -6
- data/spec/bson/byte_buffer_write_spec.rb +96 -0
- data/spec/bson/date_time_spec.rb +53 -0
- data/spec/bson/dbref_legacy_spec.rb +169 -0
- data/spec/bson/dbref_spec.rb +487 -0
- data/spec/bson/decimal128_spec.rb +231 -0
- data/spec/bson/document_as_spec.rb +46 -0
- data/spec/bson/document_spec.rb +43 -1
- data/spec/bson/ext_json_parse_spec.rb +37 -0
- data/spec/bson/hash_as_spec.rb +57 -0
- data/spec/bson/hash_spec.rb +105 -0
- data/spec/bson/int64_spec.rb +4 -24
- data/spec/bson/raw_spec.rb +18 -1
- data/spec/bson/regexp_spec.rb +52 -0
- data/spec/runners/common_driver.rb +1 -1
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/bin/s3-copy +45 -0
- data/spec/shared/bin/s3-upload +69 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +231 -0
- data/spec/shared/lib/mrss/constraints.rb +386 -0
- data/spec/shared/lib/mrss/docker_runner.rb +271 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +200 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +191 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +120 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +179 -0
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +338 -0
- data/spec/shared/share/haproxy-1.conf +16 -0
- data/spec/shared/share/haproxy-2.conf +17 -0
- data/spec/shared/shlib/distro.sh +74 -0
- data/spec/shared/shlib/server.sh +367 -0
- data/spec/shared/shlib/set_env.sh +131 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/spec_tests/common_driver_spec.rb +2 -1
- data/spec/spec_tests/data/corpus/binary.json +33 -0
- data/spec/spec_tests/data/corpus/dbref.json +21 -1
- data/spec/spec_tests/data/corpus/document.json +4 -0
- data/spec/spec_tests/data/corpus/regex.json +2 -2
- data/spec/spec_tests/data/corpus/timestamp.json +10 -0
- data/spec/spec_tests/data/corpus/top.json +23 -12
- data/spec/support/spec_config.rb +8 -1
- data.tar.gz.sig +0 -0
- metadata +168 -93
- metadata.gz.sig +1 -0
@@ -0,0 +1,338 @@
|
|
1
|
+
# Python toolchain as of this writing is available on rhel62, debian92 and
|
2
|
+
# ubuntu1604.
|
3
|
+
#
|
4
|
+
# To run rhel62 in docker, host system must be configured to emulate syscalls:
|
5
|
+
# https://github.com/CentOS/sig-cloud-instance-images/issues/103
|
6
|
+
|
7
|
+
<%
|
8
|
+
|
9
|
+
python_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-python-driver-toolchain/#{distro}/ba92de2700c04ee2d4f82c3ffdfc33105140cb04/mongo_python_driver_toolchain_#{distro.gsub('-', '_')}_ba92de2700c04ee2d4f82c3ffdfc33105140cb04_19_11_14_15_33_33.tar.gz"
|
10
|
+
server_version = '4.3.3'
|
11
|
+
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
|
12
|
+
server_archive_basename = File.basename(server_url)
|
13
|
+
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
|
14
|
+
|
15
|
+
TOOLCHAIN_VERSION='35fb9fb797a941094bf4ee8678284da88849435c'
|
16
|
+
|
17
|
+
def ruby_toolchain_url(ruby)
|
18
|
+
"http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/#{TOOLCHAIN_VERSION}/#{distro}/#{ruby}.tar.xz"
|
19
|
+
end
|
20
|
+
|
21
|
+
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
|
22
|
+
|
23
|
+
%>
|
24
|
+
|
25
|
+
FROM <%= base_image %>
|
26
|
+
|
27
|
+
<% if debian? %>
|
28
|
+
|
29
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
30
|
+
|
31
|
+
<% else %>
|
32
|
+
|
33
|
+
RUN echo assumeyes=1 |tee -a /etc/yum.conf
|
34
|
+
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<% if ruby_head? %>
|
38
|
+
|
39
|
+
# To use current versions of mlaunch, Python 3.6+ is required.
|
40
|
+
# Most distros ship with older Pythons, therefore we need to install
|
41
|
+
# a newer Python from somewhere. This section installs the Python
|
42
|
+
# toolhcain which comes with recent Pythons.
|
43
|
+
# Alternatively, Ruby toolchain compiles its own copy of Python 3 but
|
44
|
+
# this is currently incomplete in that on older distros with old OpenSSL,
|
45
|
+
# the built Python has no ssl module and hence practically is unusable.
|
46
|
+
# Currently Ruby driver uses mtools-legacy which supports Python 2,
|
47
|
+
# avoiding this entire issue for the time being.
|
48
|
+
|
49
|
+
#RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
|
50
|
+
#RUN tar -xC /opt -zf python-toolchain.tar.gz
|
51
|
+
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<% if debian? %>
|
55
|
+
|
56
|
+
# zsh is not required for any scripts but it is a better interactive shell
|
57
|
+
# than bash.
|
58
|
+
# Ruby runtime dependencies: libyaml-0-2
|
59
|
+
# Compiling ruby libraries: gcc make
|
60
|
+
# Compiling pyhton packages: python2.7-dev
|
61
|
+
# JRuby: openjdk-8-jdk-headless
|
62
|
+
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
63
|
+
# Determining OS we are running on: lsb-release
|
64
|
+
# Load balancer testing: haproxy
|
65
|
+
# Kerberos testing: krb5-user
|
66
|
+
# Local Kerberos server: krb5-kdc krb5-admin-server
|
67
|
+
# Installing mlaunch from git: git
|
68
|
+
# ruby-head archive: bzip2
|
69
|
+
# nio4r on JRuby: libgmp-dev
|
70
|
+
# Snappy compression: libsnappy-dev
|
71
|
+
# nokogiri: zlib1g-dev
|
72
|
+
# Mongoid testing: tzdata shared-mime-info
|
73
|
+
# Mongoid application testing: nodejs (8.x or newer)
|
74
|
+
# Test suite: procps for ps (to kill JRubies)
|
75
|
+
#
|
76
|
+
# We currently use Python 2-compatible version of mtools, which
|
77
|
+
# is installable via pip (which uses Python 2). All of the MongoDB
|
78
|
+
# distros have pip installed (but none as of this writing have pip3)
|
79
|
+
# therefore install python-pip in all configurations here.
|
80
|
+
|
81
|
+
<% packages = %w(
|
82
|
+
procps lsb-release bzip2 curl zsh
|
83
|
+
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
84
|
+
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
85
|
+
haproxy
|
86
|
+
python3-pip
|
87
|
+
tzdata shared-mime-info
|
88
|
+
) %>
|
89
|
+
|
90
|
+
<% if distro =~ /ubuntu1404/ %>
|
91
|
+
# For building python & setuptools
|
92
|
+
<% packages += %w(libssl-dev unzip) %>
|
93
|
+
<% end %>
|
94
|
+
|
95
|
+
<% if distro !~ /ubuntu2004/ %>
|
96
|
+
<% packages += %w(python2.7-dev) %>
|
97
|
+
<% end %>
|
98
|
+
|
99
|
+
<% if distro =~ /ubuntu2004/ %>
|
100
|
+
<% packages << 'libsnmp35' %>
|
101
|
+
<% else %>
|
102
|
+
<% packages << 'libsnmp30' %>
|
103
|
+
<% end %>
|
104
|
+
|
105
|
+
<% if distro !~ /ubuntu2004/ %>
|
106
|
+
<% packages << 'python-pip' %>
|
107
|
+
<% end %>
|
108
|
+
|
109
|
+
<% if distro =~ /debian10/ %>
|
110
|
+
<% packages << 'openjdk-11-jdk-headless' %>
|
111
|
+
<% elsif distro =~ /ubuntu1404/ %>
|
112
|
+
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
113
|
+
<% else %>
|
114
|
+
<% packages << 'openjdk-8-jdk-headless' %>
|
115
|
+
<% end %>
|
116
|
+
|
117
|
+
# ubuntu1404, ubuntu1604: libcurl3
|
118
|
+
# ubuntu1804, ubuntu2004, debian10: libcurl4
|
119
|
+
<% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
|
120
|
+
<% packages << 'libcurl4' %>
|
121
|
+
<% else %>
|
122
|
+
<% packages << 'libcurl3' %>
|
123
|
+
<% end %>
|
124
|
+
|
125
|
+
<% if distro =~ /ubuntu1804/ %>
|
126
|
+
<% packages << 'nodejs' %>
|
127
|
+
<% end %>
|
128
|
+
|
129
|
+
<% if distro =~ /ubuntu2004/ %>
|
130
|
+
<% packages += %w(ruby ruby2.7 bundler python2 python2-dev) %>
|
131
|
+
<% end %>
|
132
|
+
|
133
|
+
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
134
|
+
<% else %>
|
135
|
+
|
136
|
+
<% if distro =~ /rhel6/ %>
|
137
|
+
|
138
|
+
# CentOS 6 is dead - to use it retrieve the packages from vault:
|
139
|
+
# https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
|
140
|
+
|
141
|
+
<%
|
142
|
+
|
143
|
+
cfg = <<-CFG
|
144
|
+
[base]
|
145
|
+
name=CentOS-$releasever - Base
|
146
|
+
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
|
147
|
+
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
|
148
|
+
baseurl=http://vault.centos.org/6.10/os/x86_64/
|
149
|
+
gpgcheck=1
|
150
|
+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
151
|
+
CFG
|
152
|
+
|
153
|
+
%>
|
154
|
+
|
155
|
+
RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
|
156
|
+
|
157
|
+
<% end %>
|
158
|
+
|
159
|
+
# Enterprise server: net-snmp
|
160
|
+
# lsb_release: redhat-lsb-core
|
161
|
+
# our runner scripts: which
|
162
|
+
# Ruby dependency: libyaml
|
163
|
+
# compiling python packages: gcc python-devel
|
164
|
+
# Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
|
165
|
+
# mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
|
166
|
+
# Local Kerberos server: krb5-server
|
167
|
+
# JRuby: java-1.8.0-openjdk
|
168
|
+
#
|
169
|
+
# Note: lacking cyrus-sasl-gssapi produces a cryptic message
|
170
|
+
# "SASL(-4): no mechanism available: No worthy mechs found"
|
171
|
+
# https://github.com/farorm/python-ad/issues/10
|
172
|
+
|
173
|
+
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
174
|
+
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
175
|
+
net-snmp python3
|
176
|
+
|
177
|
+
<% if distro =~ /rhel6/ %>
|
178
|
+
|
179
|
+
# RHEL 6 ships with Python 2.6.
|
180
|
+
|
181
|
+
RUN yum install -y centos-release-scl && \
|
182
|
+
yum install -y python27-python python27-python-devel
|
183
|
+
ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
|
184
|
+
LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
|
185
|
+
|
186
|
+
<% else %>
|
187
|
+
|
188
|
+
RUN yum install -y python-devel
|
189
|
+
|
190
|
+
<% end %>
|
191
|
+
|
192
|
+
<% end %>
|
193
|
+
|
194
|
+
<% if preload? %>
|
195
|
+
|
196
|
+
<% if distro =~ /ubuntu1404/ %>
|
197
|
+
|
198
|
+
# I couldn't find a prebuilt package of anything more recent than 2.7.6
|
199
|
+
# for 14.04.
|
200
|
+
RUN curl --retry 3 -fL https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz | \
|
201
|
+
tar xfJ - && \
|
202
|
+
cd Python-2.7.16 && \
|
203
|
+
./configure && \
|
204
|
+
nice make -j4 && \
|
205
|
+
make install && \
|
206
|
+
cd .. && rm -rf Python-2.7.16
|
207
|
+
|
208
|
+
ENV PATH=/usr/local/bin:$PATH
|
209
|
+
|
210
|
+
RUN curl --retry 3 -fL -o setuptools-44.1.1.zip https://files.pythonhosted.org/packages/b2/40/4e00501c204b457f10fe410da0c97537214b2265247bc9a5bc6edd55b9e4/setuptools-44.1.1.zip && \
|
211
|
+
unzip setuptools-44.1.1.zip && \
|
212
|
+
cd setuptools-44.1.1 && \
|
213
|
+
python setup.py install && \
|
214
|
+
cd .. && rm -rf setuptools-44.1.1
|
215
|
+
|
216
|
+
<% end%>
|
217
|
+
|
218
|
+
<% if true || distro =~ /rhel|ubuntu1604/ %>
|
219
|
+
|
220
|
+
# Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
|
221
|
+
#
|
222
|
+
# Ubuntu 16.04 apparently also ships a pip that does not work:
|
223
|
+
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
|
224
|
+
# Potentially this only affects environments with less than ideal
|
225
|
+
# connectivity (or, perhaps, when python package registry is experiencing
|
226
|
+
# availability issues) when pip must retry to install packages.
|
227
|
+
#
|
228
|
+
# rhel apparently does not package pip at all in core repoitories,
|
229
|
+
# therefore install it the manual way.
|
230
|
+
#
|
231
|
+
# https://pip.pypa.io/en/stable/installing/
|
232
|
+
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
|
233
|
+
|
234
|
+
<% end %>
|
235
|
+
|
236
|
+
# Current virtualenv fails with
|
237
|
+
# https://github.com/pypa/virtualenv/issues/1630
|
238
|
+
<% if distro =~ /ubuntu2004/ %>
|
239
|
+
RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
240
|
+
<% else %>
|
241
|
+
RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
242
|
+
<% end %>
|
243
|
+
|
244
|
+
RUN pip --version && \
|
245
|
+
pip install mtools-legacy[mlaunch]
|
246
|
+
|
247
|
+
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
248
|
+
# ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
|
249
|
+
# as specified by dependencies, causing OCSP mock to not work.
|
250
|
+
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
251
|
+
<% end %>
|
252
|
+
|
253
|
+
# FLE is tested against 4.0+ servers.
|
254
|
+
<% if @env.fetch('MONGODB_VERSION') >= '4.0' %>
|
255
|
+
# Requirements in drivers-evergreen-tools:
|
256
|
+
# boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
|
257
|
+
# cryptography does not install due to lacking setuptools_rust
|
258
|
+
# (either that version or anything that isn't part of system packages)
|
259
|
+
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0
|
260
|
+
<% end %>
|
261
|
+
|
262
|
+
<% unless ruby_head? || system_ruby? %>
|
263
|
+
|
264
|
+
RUN curl --retry 3 -fL <%= ruby_toolchain_url(ruby) %> |tar -xC /opt -Jf -
|
265
|
+
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
|
266
|
+
USE_OPT_TOOLCHAIN=1
|
267
|
+
#ENV PATH=/opt/rubies/python/3/bin:$PATH
|
268
|
+
|
269
|
+
<% end %>
|
270
|
+
|
271
|
+
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
272
|
+
mv mongo*/ /opt/mongodb
|
273
|
+
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
274
|
+
|
275
|
+
<% end %>
|
276
|
+
|
277
|
+
<% if distro =~ /debian|ubuntu/ %>
|
278
|
+
# mkdir was moved from /usr/bin to /bin and MongoDB's distros
|
279
|
+
# apparently keep using the old location.
|
280
|
+
# This definitely affects debian10.
|
281
|
+
# https://stackoverflow.com/questions/64653051/make-usr-bin-mkdir-command-not-found-during-gem-install-nokogiri-in-ubuntu
|
282
|
+
RUN test -f /usr/bin/mkdir || ln -s /bin/mkdir /usr/bin/mkdir
|
283
|
+
<% end %>
|
284
|
+
|
285
|
+
WORKDIR /app
|
286
|
+
|
287
|
+
<% if preload? && !ruby_head? %>
|
288
|
+
|
289
|
+
COPY Gemfile .
|
290
|
+
COPY gemfiles gemfiles
|
291
|
+
COPY *.gemspec .
|
292
|
+
COPY lib/<%= project_lib_subdir %>/version.rb lib/<%= project_lib_subdir %>/version.rb
|
293
|
+
RUN bundle install
|
294
|
+
COPY .evergreen/patch-debuggers .evergreen/patch-debuggers
|
295
|
+
<% if system_ruby? %>
|
296
|
+
# Running under docker with root access
|
297
|
+
RUN .evergreen/patch-debuggers /var/lib/gems
|
298
|
+
<% else %>
|
299
|
+
RUN .evergreen/patch-debuggers /opt/rubies
|
300
|
+
<% end %>
|
301
|
+
|
302
|
+
<% end %>
|
303
|
+
|
304
|
+
<% if fle? %>
|
305
|
+
RUN curl --retry 3 -fL "https://s3.amazonaws.com/mciuploads/libmongocrypt/all/master/latest/libmongocrypt-all.tar.gz" |tar zxf -
|
306
|
+
|
307
|
+
<%= "ENV LIBMONGOCRYPT_PATH #{libmongocrypt_path}" %>
|
308
|
+
<% end %>
|
309
|
+
|
310
|
+
<% if preload? %>
|
311
|
+
ENV DOCKER_PRELOAD=1
|
312
|
+
<% end %>
|
313
|
+
|
314
|
+
ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
315
|
+
PROJECT_DIRECTORY=/app \
|
316
|
+
<%= @env.map { |k, v| %Q`#{k}="#{v.gsub('$', "\\$").gsub('"', "\\\"")}"` }.join(" \\\n ") %>
|
317
|
+
|
318
|
+
<% if interactive? %>
|
319
|
+
ENV INTERACTIVE=1
|
320
|
+
<% end %>
|
321
|
+
|
322
|
+
COPY . .
|
323
|
+
|
324
|
+
<% if expose? %>
|
325
|
+
|
326
|
+
<% ports = [] %>
|
327
|
+
|
328
|
+
<% 0.upto(num_exposed_ports-1) do |i| %>
|
329
|
+
<% ports << 27017 + i %>
|
330
|
+
<% end %>
|
331
|
+
|
332
|
+
<% if @env['OCSP_ALGORITHM'] %>
|
333
|
+
<% ports << 8100 %>
|
334
|
+
<% end %>
|
335
|
+
|
336
|
+
EXPOSE <%= ports.map(&:to_s).join(' ') %>
|
337
|
+
|
338
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Modeled after
|
2
|
+
# https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
|
3
|
+
|
4
|
+
defaults
|
5
|
+
mode tcp
|
6
|
+
timeout connect 7s
|
7
|
+
timeout client 55s
|
8
|
+
timeout server 55s
|
9
|
+
|
10
|
+
frontend mongos_frontend
|
11
|
+
bind *:27017
|
12
|
+
use_backend mongos_backend
|
13
|
+
|
14
|
+
backend mongos_backend
|
15
|
+
mode tcp
|
16
|
+
server mongos_one 127.0.0.1:27117 check
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Modeled after
|
2
|
+
# https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
|
3
|
+
|
4
|
+
defaults
|
5
|
+
mode tcp
|
6
|
+
timeout connect 7s
|
7
|
+
timeout client 55s
|
8
|
+
timeout server 55s
|
9
|
+
|
10
|
+
frontend mongos_frontend
|
11
|
+
bind *:27017
|
12
|
+
use_backend mongos_backend
|
13
|
+
|
14
|
+
backend mongos_backend
|
15
|
+
mode tcp
|
16
|
+
server mongos_one 127.0.0.1:27117 check
|
17
|
+
server mongos_two 127.0.0.1:27118 check
|
@@ -0,0 +1,74 @@
|
|
1
|
+
detected_distro=
|
2
|
+
|
3
|
+
host_distro() {
|
4
|
+
if test -z "$detected_distro"; then
|
5
|
+
detected_distro=`_detect_distro`
|
6
|
+
fi
|
7
|
+
echo "$detected_distro"
|
8
|
+
}
|
9
|
+
|
10
|
+
_detect_distro() {
|
11
|
+
local distro
|
12
|
+
distro=
|
13
|
+
if test -f /etc/debian_version; then
|
14
|
+
# Debian or Ubuntu
|
15
|
+
if test "`uname -m`" = aarch64; then
|
16
|
+
release=`lsb_release -rs |tr -d .`
|
17
|
+
distro="ubuntu$release"-arm
|
18
|
+
elif lsb_release -is |grep -q Debian; then
|
19
|
+
release=`lsb_release -rs |tr -d .`
|
20
|
+
# In docker, release is something like 9.11.
|
21
|
+
# In evergreen, release is 9.2.
|
22
|
+
release=`echo $release |sed -e 's/^9.*/92/'`
|
23
|
+
distro="debian$release"
|
24
|
+
elif lsb_release -is |grep -q Ubuntu; then
|
25
|
+
if test "`uname -m`" = ppc64le; then
|
26
|
+
release=`lsb_release -rs |tr -d .`
|
27
|
+
distro="ubuntu$release-ppc"
|
28
|
+
else
|
29
|
+
release=`lsb_release -rs |tr -d .`
|
30
|
+
distro="ubuntu$release"
|
31
|
+
fi
|
32
|
+
else
|
33
|
+
echo 'Unknown Debian flavor' 1>&2
|
34
|
+
exit 1
|
35
|
+
fi
|
36
|
+
elif lsb_release -is |grep -qi suse; then
|
37
|
+
if test "`uname -m`" = s390x; then
|
38
|
+
release=`lsb_release -rs |sed -e 's/\..*//'`
|
39
|
+
distro="suse$release-s390x"
|
40
|
+
else
|
41
|
+
echo 'Unknown Suse arch' 1>&2
|
42
|
+
exit 1
|
43
|
+
fi
|
44
|
+
elif test -f /etc/redhat-release; then
|
45
|
+
# RHEL or CentOS
|
46
|
+
if test "`uname -m`" = s390x; then
|
47
|
+
distro=rhel72-s390x
|
48
|
+
elif test "`uname -m`" = ppc64le; then
|
49
|
+
distro=rhel71-ppc
|
50
|
+
elif lsb_release >/dev/null 2>&1; then
|
51
|
+
if lsb_release -is |grep -q RedHat; then
|
52
|
+
release=`lsb_release -rs |tr -d .`
|
53
|
+
distro="rhel$release"
|
54
|
+
elif lsb_release -is |grep -q CentOS; then
|
55
|
+
release=`lsb_release -rs |cut -c 1 |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
|
56
|
+
distro="rhel$release"
|
57
|
+
else
|
58
|
+
echo 'Unknown RHEL flavor' 1>&2
|
59
|
+
exit 1
|
60
|
+
fi
|
61
|
+
else
|
62
|
+
echo lsb_release missing, using /etc/redhat-release 1>&2
|
63
|
+
release=`grep -o 'release [0-9]' /etc/redhat-release |awk '{print $2}'`
|
64
|
+
release=`echo $release |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
|
65
|
+
distro=rhel$release
|
66
|
+
fi
|
67
|
+
else
|
68
|
+
lsb_release -a
|
69
|
+
echo 'Unknown distro' 1>&2
|
70
|
+
exit 1
|
71
|
+
fi
|
72
|
+
echo "Detected distro: $distro" 1>&2
|
73
|
+
echo $distro
|
74
|
+
}
|