Git Product home page Git Product logo

mongo-infra-docker's Introduction

mongo-infra-docker

Get an Ops Manager (or Cloud Manager) environment up and running on your Mac (M1/Intel) or PC (Windows/Linux) with a single command. Batteries included.

Features

Feature Supported Notes
Ops Manager ✔️ cd ops-manager
Cloud Manager ✔️ cd cloud-manager If you have low RAM, consider this instead of Ops Manager
MongoDB Agent ✔️ -
BI Connector ✔️ Check OM Release notes for RHEL8 x86/ARM support
Blockstore Backup ✔️ -
S3 Backup ✔️ S3 Backup
File Backup ✔️ use /filesystem in Ops Manager
Snapshot Restore ✔️ -
PIT Restore ✔️ -
Queryable Restore ✔️ Queryable

For more complex tests the following have been included already. Nothing is stopping you using your own also, these will be added based on demand.

Optional Extras Supported Notes
TLS Certificates ✔️ For Deployments see Enable TLS
Load-balancer ✔️ Balancer in front of single Ops Manager
Proxy ✔️ Squid running on port proxy.om.internal:3128
SMTP ✔️ smtp.om.internal on 1025, web viewer in 1080
Prometeus Not included yet
LDAP Not included yet
Kerberos Not included yet
KMIP Not included yet

Usage

Example 1:

Ops Manager and one MongoDB Agent (Make sure docker has access to 12G of RAM or more... ...if you want to do backup testing)

  1. cd ops-manager then bash quick-start.sh

  2. The script will download, build and deploy Ops Manager, please click Sign Up and register your first user who will be the Global Admin then complete the Initial Setup screens (we have pre defined some values in conf-mms.properties, so you just need to click Continue until its done)

  3. Once the project appears go to Deployment >> Agents >> Downloads & Settings >> Select any operating system

    1. On the wizard that appears click +Generate Key
    2. Take note of the values for
    mmsGroupId=123412341234123412341234
    
    mmsApiKey=123412341234123412341234123412341234123412341234123412341234123412341234
    
    mmsBaseUrl=http://ops.om.internal:8080
    
    1. Update the file ops-manager/mongod-mms/automation-agent.config with these values, it will be used by the node container in the next step
  4. Press any key to unpause the script, it will download an Agent and start up a container with it running inside that is connected to the Ops Manager you deployed earlier, your environment is setup.

  5. Optional: run bash extras.sh and select the option you would like setup, it looks like this:

bash extras.sh 
Please choose some extras:
1) pause            3) more-servers    5) oplog           7) proxy           9) smtp           11) Quit
2) un-pause         4) metadata        6) blockstore      8) load-balancer  10) s3
#? 9
Starting smtp on smtp.om.internal
localhost:1025 is where you can send emails
localhost:1080 is where you can read them
[+] Running 5/5
 ✔ smtp 4 layers [⣿⣿⣿⣿]      0B/0B      Pulled 
   ✔ 619be1103602 Pull  
   ✔ d87a23ae4383 Pull 
   ✔ 49bc41facb3d Pull 
   ✔ de31bd6756d2 Pull 
[+] Building 0.0s
docker:default
[+] Running 1/1
 ✔ Container smtp  Started 0.1s 

Result

If you followed steps 1 - 5 you should have something like this within 10 minutes:

Hints and tips:

  • Ops Manager needs 8G RAM to run reliably, an Agent 2.5G, so for Monitoring/Automation your looking at giving docker 10.5G
  • TLS certificates (testing use only) are available, please see Enable TLS for more details
  • Stopping/Starting Ops Manager and Containers
    • docker compose pause # will pause all the containers from running state
    • docker compose unpause # will get them all going again
  • Getting a Shell / SSH on the containers
    • docker exec -it ops /bin/bash runs bash as root on the ops container
    • docker exec -it node1 /bin/bash runs bash as root on the node1 container
    • you can just look at the docker-compose.yml to see what each container is called, or you can see it in docker ps
    • docker stats is a great way to see the cpu/memory usage and limits of each container

Example 2:

3x MongoDB Agents for Cloud Manager (with systemd)

  1. Create a Cloud Manager project
    1. Create a Cloud Manager project on https://cloud.mongodb.com and go to Deployment >> Agents >> Downloads & Settings >> Select your operating system
    2. Pick any OS and on the wizard that appears, click generate an API key
    3. Take note of the values for
    mmsGroupId=123412341234123412341234
    
    mmsApiKey=123412341234123412341234123412341234123412341234123412341234123412341234
    
    1. Update the file cloud-manager/mongod-mms/automation-agent.config with these values
  2. cd cloud-manager and run only 1 of these download scripts to obtain the agent for your architechture
bash assets/aarch64_CM-agent.sh # if your are on M1/ARM/Aarch64
bash assets/x86_64_CM-agent.sh  # if your are on Intel Mac/Windows/Linux
  1. Optional: update the cloud-manager/docker-compose.yml file, to select the right build file, the default is aarch64 for M1/ARM/Aarch64, you can change it to x86_64 for Intel Mac/Windows/Linux on line 6, 30, 54

  2. docker compose up -d n1cm n2cm n3cm this will build three containers with all the tools and dependencies you need. It will install and configure the MongoDB Agent (for Cloud Manager) that you downloaded in step 2, and connect it to the group you setup in step 1. The container has systemd and behaves like an operating system and is visible in your Cloud Manager project under Deployment >> Agents >> Servers.

  3. Optional: if you need more nodes you can run docker compose up -d n4cm n5cm n6cm, they will appear in the same project. Each uses about 2.5GB of Memory.

Disclaimer

This software is not supported by MongoDB, Inc under any of their commercial support subscriptions or otherwise. Any usage of this tool is at your own risk. It's intended only to serve as a test and environment.

Changelog

  • 2024-06-05 Added extras.sh to streamline addisions to the basic environment
  • 2024-06-04 Queryable works on ARM by default with 6.0.15 being available for queryable instance
  • 2024-05-30 Queryable pem SANs have localhost, ops.om.internal, lb.om.internal, support for ARM by renaming x86 binaries
  • 2024-05-29 Added Queryable Backup support for x86_64, set certs to expire every 28 days
  • 2024-05-20 Atlas Local testing complete on M1, update from 7.0.5 to 7.0.6, BIC, filesystem backup
  • 2024-05-10 Added Atlas Local on Docker Compose (not podman)
  • 2024-05-07 Added a single script with menu to select platform/arch
  • 2024-05-03 Added disclaimer and feature tables to README.md
  • 2024-05-01 Initial run at a simplified s3 setup
  • 2024-04-25 Set some defaults in conf-mms.properties so initial startup is faster, add smtp catcher, initial attempt at s3 support
  • 2024-04-23 Added working nginx loadbalancer and squid proxy
  • 2024-04-22 Single command needed to do everything, added oplog/blockstores/metadata with resonable sizes
  • 2024-04-16 Confirmed working on ARM/M1/Aaarch64, updated docs, set aarch64 as default as most users of this project (80%) are using M1's to run test environments
  • 2024-04-15 Make CM act more like the OM container, change container names so you can run OM/CM agents at the same time with no clash
  • 2024-04-11 Initial x86_64 Ops Manager Proof of Concept aarch64 for Cloud Manager confirmed good on Windows/M-series mac
  • 2024-04-10 Initial x86_64 Cloud Manager Proof of Concept, with an untested version for aarch64

Copyright 2024 Karl Denby

mongo-infra-docker's People

Contributors

karl-denby avatar 222dmx222 avatar

Stargazers

Baptiste Blanchard avatar Yuval Herziger avatar Gregory Vinopal avatar

Watchers

 avatar

mongo-infra-docker's Issues

Missing dependencies error when DOCKER_DEFAULT_PLATFORM is set to linux/amd64

This error can be seen when running with:
DOCKER_DEFAULT_PLATFORM=linux/amd64

warning: /root/mongodb-enterprise.aarch64.rpm: Header V3 RSA/SHA256 Signature, key ID 64c3c388: NOKEY
error: Failed dependencies:
ld-linux-aarch64.so.1()(64bit) is needed by mongodb-enterprise-server-6.0.0-1.el8.aarch64
...

It essentially is cause by us using an arm image, but when we install arm software it wants the amd64 dep, we need to remove this with

unset DOCKER_DEFAULT_PLATFORM

add bi-connector support

This will need to be an Ubuntu container as BIC doesn't work with RHEL8 right now. Might not support systemd in the same way, investigate.

Separate build and run steps

I'm seeing a weird issue where limits don't apply to a container that had a build step, should investigate this as a workaround, potentially we build a container with a name:tag like mongo-infra-docker:ops or mongo-infra-docker:node1 and then deploy from there in the next step.

Bug in sed on MacOS

Apparently on MacOS sed is a bit funny and needs an extra blank string, so we will give it and see

7.0.5 is removed, update to 7.0.6

7.0.5 had an issue with its agent that caused it to spawn many connections, it has since been removed from downloads causing us to get a 404, lets bump version to 7.0.6

Re-use existing downloaded packages

We should have an option to use packages we already downloaded in case the existing internet connection is slow or whatever, this also gives us the option of using a custom binary.

However we probably want to keep info about:

  • what version was downloaded

Update to put downloads in a folder, and write a file that gives us some basic info about it.

certs are misplaced

new version of the certs are in the ops-manager folder not the ops-manager/certs folder, seem where you run the script from is important, this should be fixed as well as moving the certs

extra nodes don't come up

[+] Running 1/2
 ✔ Container node3  Started                                                                                                                                              0.5s 
 ⠴ Container node2  Starting                                                                                                                                             0.5s 
Error response from daemon: driver failed programming external connectivity on endpoint node2 (d65d7ccce5b2fdb5a08408c41fde1e7323a5e3cbdc6dfaff21e3d5418e980488): Bind for 0.0.0.0:27017 failed: port is already allocated

Add Ops Manager x86

Cloud Manager is cool and all, but Ops Manager would give around 80% coverage of our use case.

We need a local S3 for testing backup/oplog

We have oplog/blockstore for mongod (as backup storage of other mongod's), but we also have the metadata store which is much lighter if we offload blocks to s3, investigate using garage for this.

Certs for Ops Manager need SAN updates

PEM cert /certs/n1om.om.internal.pem verification error. err=x509: certificate is valid for n1.om.internal, n1, n1.alt.internal, not n1om.om.internal

We could also do a single cert that is valid for more than 1 host, this seems to be what the UI expects over a cert for each server, which could be argued is a better approach.

Add a cli menu

Something like this to set env variables / urls, then the rest of the script uses those to download binaries

#!/bin/bash

options=("Option 1" "Option 2" "Option 3")

select opt in "${options[@]}" -p "Please choose an option: "; do
    case $opt in
        Option 1)
            echo "You chose option 1."
            break
            ;;
        Option 2)
            echo "You chose option 2."
            break
            ;;
        Option 3)
            echo "You chose option 3."
            break
            ;;
    esac
done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.