From 5e3f9a4fd82922d46c7223b712e5609df707e4fa Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 16 Oct 2023 11:41:49 -0700 Subject: [PATCH 1/6] Add oc/k8s config for Mongo --- mongo/6/Dockerfile | 10 ++++++++++ mongo/6/mongod.conf | 15 +++++++++++++++ mongo/7/Dockerfile | 10 ++++++++++ mongo/7/mongod.conf | 15 +++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 mongo/6/mongod.conf create mode 100644 mongo/7/mongod.conf diff --git a/mongo/6/Dockerfile b/mongo/6/Dockerfile index ed34b43a..4127f4c4 100644 --- a/mongo/6/Dockerfile +++ b/mongo/6/Dockerfile @@ -1 +1,11 @@ FROM mongo:6.0.11 + +# Health check +HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD ["mongosh", "--eval", "db.adminCommand('ping')"] + +# Non-root user (default) +USER mongodb + +# Start with custom config to keep resource usage down +COPY --chown=mongodb:mongodb ../mongod.conf /etc/ +CMD ["mongod", "--config", "/etc/mongod.conf"] diff --git a/mongo/6/mongod.conf b/mongo/6/mongod.conf new file mode 100644 index 00000000..e9486020 --- /dev/null +++ b/mongo/6/mongod.conf @@ -0,0 +1,15 @@ +systemLog: + destination: syslog +storage: + journal: + enabled: false + directoryPerDB: false + wiredTiger: + engineConfig: + cacheSizeGB: 0.25 + journalCompressor: zstd + zstdCompressionLevel: 22 + collectionConfig: + blockCompressor: zstd +setParameter: + enableLocalhostAuthBypass: true diff --git a/mongo/7/Dockerfile b/mongo/7/Dockerfile index fed16fe9..58cec0da 100644 --- a/mongo/7/Dockerfile +++ b/mongo/7/Dockerfile @@ -1 +1,11 @@ FROM mongo:7.0.2 + +# Health check +HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD ["mongosh", "--eval", "db.adminCommand('ping')"] + +# Non-root user (default) +USER mongodb + +# Start with custom config to keep resource usage down +COPY --chown=mongodb:mongodb ../mongod.conf /etc/ +CMD ["mongod", "--config", "/etc/mongod.conf"] diff --git a/mongo/7/mongod.conf b/mongo/7/mongod.conf new file mode 100644 index 00000000..e9486020 --- /dev/null +++ b/mongo/7/mongod.conf @@ -0,0 +1,15 @@ +systemLog: + destination: syslog +storage: + journal: + enabled: false + directoryPerDB: false + wiredTiger: + engineConfig: + cacheSizeGB: 0.25 + journalCompressor: zstd + zstdCompressionLevel: 22 + collectionConfig: + blockCompressor: zstd +setParameter: + enableLocalhostAuthBypass: true From d68c87b7ecb682b41892657bf0b2b1212a19a1f6 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 16 Oct 2023 11:57:40 -0700 Subject: [PATCH 2/6] Simplify config --- mongo/6/mongod.conf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mongo/6/mongod.conf b/mongo/6/mongod.conf index e9486020..14f9fb76 100644 --- a/mongo/6/mongod.conf +++ b/mongo/6/mongod.conf @@ -1,15 +1,9 @@ -systemLog: - destination: syslog +db: + maxIndexBuildMemoryUsageMegabytes: 50 storage: - journal: - enabled: false - directoryPerDB: false wiredTiger: engineConfig: cacheSizeGB: 0.25 - journalCompressor: zstd - zstdCompressionLevel: 22 + journalCompressor: snappy collectionConfig: blockCompressor: zstd -setParameter: - enableLocalhostAuthBypass: true From f693d5880b09f33abddf97626f886cb609653ab8 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 16 Oct 2023 11:58:05 -0700 Subject: [PATCH 3/6] Simplify config --- mongo/6/mongod.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongo/6/mongod.conf b/mongo/6/mongod.conf index 14f9fb76..bf640cf1 100644 --- a/mongo/6/mongod.conf +++ b/mongo/6/mongod.conf @@ -6,4 +6,4 @@ storage: cacheSizeGB: 0.25 journalCompressor: snappy collectionConfig: - blockCompressor: zstd + blockCompressor: snappy From 497304df5cae78c62333fe6ccf64d08419ad5166 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 16 Oct 2023 11:59:05 -0700 Subject: [PATCH 4/6] Use same config for 6 and 7 --- mongo/7/mongod.conf | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mongo/7/mongod.conf b/mongo/7/mongod.conf index e9486020..bf640cf1 100644 --- a/mongo/7/mongod.conf +++ b/mongo/7/mongod.conf @@ -1,15 +1,9 @@ -systemLog: - destination: syslog +db: + maxIndexBuildMemoryUsageMegabytes: 50 storage: - journal: - enabled: false - directoryPerDB: false wiredTiger: engineConfig: cacheSizeGB: 0.25 - journalCompressor: zstd - zstdCompressionLevel: 22 + journalCompressor: snappy collectionConfig: - blockCompressor: zstd -setParameter: - enableLocalhostAuthBypass: true + blockCompressor: snappy From d7720a819aa089b90dd8e5f93710cf4fcc66a584 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 16 Oct 2023 12:06:14 -0700 Subject: [PATCH 5/6] Fix setParameter in config --- mongo/6/mongod.conf | 2 +- mongo/7/mongod.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongo/6/mongod.conf b/mongo/6/mongod.conf index bf640cf1..2be1fa4a 100644 --- a/mongo/6/mongod.conf +++ b/mongo/6/mongod.conf @@ -1,4 +1,4 @@ -db: +setParameter: maxIndexBuildMemoryUsageMegabytes: 50 storage: wiredTiger: diff --git a/mongo/7/mongod.conf b/mongo/7/mongod.conf index bf640cf1..2be1fa4a 100644 --- a/mongo/7/mongod.conf +++ b/mongo/7/mongod.conf @@ -1,4 +1,4 @@ -db: +setParameter: maxIndexBuildMemoryUsageMegabytes: 50 storage: wiredTiger: From 174e8619c8c96f2fbbd624700bd2f7f98b64dc46 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 16 Oct 2023 13:37:57 -0700 Subject: [PATCH 6/6] Restore snappy compressor --- mongo/6/mongod.conf | 5 +++-- mongo/7/mongod.conf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mongo/6/mongod.conf b/mongo/6/mongod.conf index 2be1fa4a..cb82d81b 100644 --- a/mongo/6/mongod.conf +++ b/mongo/6/mongod.conf @@ -4,6 +4,7 @@ storage: wiredTiger: engineConfig: cacheSizeGB: 0.25 - journalCompressor: snappy + journalCompressor: zstd + zstdCompressionLevel: 22 collectionConfig: - blockCompressor: snappy + blockCompressor: zstd diff --git a/mongo/7/mongod.conf b/mongo/7/mongod.conf index 2be1fa4a..cb82d81b 100644 --- a/mongo/7/mongod.conf +++ b/mongo/7/mongod.conf @@ -4,6 +4,7 @@ storage: wiredTiger: engineConfig: cacheSizeGB: 0.25 - journalCompressor: snappy + journalCompressor: zstd + zstdCompressionLevel: 22 collectionConfig: - blockCompressor: snappy + blockCompressor: zstd