Local MongoDB Enterprise environment with Ops Manager and Kubernetes Operator on macOS (Apple Silicon). Demonstrates API-driven automation and operational excellence with MongoDB Ops Manager.
┌─────────────────────────────────────────────────────────────┐
│ macOS (Apple Silicon) │
│ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ OrbStack │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────┐ │ │
│ │ │ VM: opsmanager (Ubuntu 22.04, x86_64 Rosetta) │ │ │
│ │ │ - MongoDB 8.0 AppDB (3-node replica set) │ │ │
│ │ │ - Ops Manager 8.0 │ │ │
│ │ │ - http://opsmanager.orb.local:8080 │ │ │
│ │ └─────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────┐ │ │
│ │ │ Kubernetes (OrbStack built-in) │ │ │
│ │ │ - MongoDB Enterprise Kubernetes Operator │ │ │
│ │ └─────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
- macOS 15+ on Apple Silicon
- OrbStack installed
- Rosetta enabled (Settings → System → Use Rosetta)
- Memory limit: 16+ GB recommended (Settings → System → Memory)
- Kubernetes enabled (Settings → Kubernetes → Enable)
- Homebrew installed (for Helm)
This project supports two deployment methods:
| Method | Best For | Guide |
|---|---|---|
| Shell Scripts | Learning, manual control | This README |
| Terraform | Automation, IaC, demos | terraform/USAGE.md |
git clone https://github.com/corbtastik/mongodb-pro.git
cd mongodb-proCreates an x86_64 Ubuntu VM using Rosetta emulation (required because Ops Manager is x86_64 only).
./scripts/01-create-opsmanager-vm.shInstalls MongoDB 8.0 as a 3-node replica set. This serves as the backend database for Ops Manager.
./scripts/02-install-appdb.shDownloads and installs Ops Manager 8.0.
./scripts/03-install-opsmanager.shEnables HTTPS with a self-signed certificate. Recommended for security-conscious demos.
./scripts/03a-configure-tls.shThis will:
- Generate a self-signed CA and server certificate
- Configure Ops Manager to use HTTPS on port 8443
- Export the CA certificate for Kubernetes operator use
After running, access Ops Manager at https://opsmanager.orb.local:8443 (browser will show certificate warning).
Open Ops Manager in your browser:
- HTTP: http://opsmanager.orb.local:8080
- HTTPS: https://opsmanager.orb.local:8443 (if Step 4a was run)
Complete initial setup:
- Register - Create your admin account (first user becomes admin)
- Configure - Accept defaults or configure SMTP if desired
- Create Organization - e.g., "myorg"
- Create API Key:
- Go to: Organization → Access Manager → API Keys → Create API Key
- Description: "automation"
- Permissions: Organization Owner
- Copy the Public Key and Private Key
- Add to Access List:
192.168.139.0/24
cp .env.example .envEdit .env with your Ops Manager values:
# Use HTTPS URL if Step 4a was run, otherwise HTTP
OPS_MANAGER_URL=http://opsmanager.orb.local:8080
# OPS_MANAGER_URL=https://opsmanager.orb.local:8443
OPS_MANAGER_ORG_ID=<your-24-char-org-id>
OPS_MANAGER_API_PUBLIC_KEY=<your-public-key>
OPS_MANAGER_API_PRIVATE_KEY=<your-private-key>Where to find these:
- Org ID: Organization → Settings → Organization ID
- API Keys: Created in Step 5
Installs the MongoDB Enterprise Kubernetes Operator and creates necessary secrets.
./scripts/04-setup-k8s-operator.sh# Ops Manager is accessible
curl -s -o /dev/null -w "%{http_code}\n" http://opsmanager.orb.local:8080
# Operator is running
kubectl get pods -n mongodb
# API credentials work
./scripts/create-project.sh test-projectIf all commands succeed, you're ready to deploy MongoDB clusters.
# 1. Create project in Ops Manager
./scripts/create-project.sh my-project
# 2. Generate Kustomize overlay
./scripts/new-overlay.sh my-project # Standalone (default)
./scripts/new-overlay.sh my-project --type ReplicaSet # 3-node replica set
# 3. Deploy
kubectl apply -k k8s/overlays/my-project
# 4. Check status
kubectl get mongodb,pods -n mongodb-my-project
# 5. Connect (after Running)
mongosh 'mongodb://dbUser:MongoDBPass123!@192.168.139.2:<nodeport>/admin'Each deployment gets its own isolated namespace (mongodb-<project-name>).
See docs/DEMO.md for a 30-minute walkthrough demonstrating:
- API-driven project creation
- Declarative MongoDB deployment
- Operational excellence with Ops Manager
./scripts/stop-all.sh./scripts/start-all.shDestroys everything including all data. Use when you want to start fresh.
./scripts/teardown.shTo set up again, start from Step 2.
# Check VM is running
orb list
# Check Ops Manager service
orb -m opsmanager -u root systemctl status mongodb-mms# Check operator logs
kubectl logs deployment/mongodb-enterprise-operator -n mongodb
# Verify secrets exist
kubectl get secrets -n mongodb- Verify
.envcredentials match Ops Manager - Ensure
192.168.139.0/24is in API key access list - Regenerate API key if needed
# Check MongoDB resource status
kubectl describe mongodb -n mongodb
# Check operator logs for errors
kubectl logs deployment/mongodb-enterprise-operator -n mongodb --tail=100mongodb-pro/
├── scripts/
│ ├── 01-create-opsmanager-vm.sh # Create VM
│ ├── 02-install-appdb.sh # Install MongoDB AppDB
│ ├── 03-install-opsmanager.sh # Install Ops Manager
│ ├── 03a-configure-tls.sh # Configure TLS (optional)
│ ├── 04-setup-k8s-operator.sh # Deploy K8s Operator
│ ├── create-project.sh # Create Ops Manager project (API)
│ ├── new-overlay.sh # Generate Kustomize overlay
│ ├── start-all.sh # Start environment
│ ├── stop-all.sh # Stop environment
│ └── teardown.sh # Destroy everything
├── terraform/
│ ├── control-plane/local/ # Ops Manager + K8s Operator (IaC)
│ ├── data-plane/local/ # MongoDB clusters (IaC)
│ ├── modules/ # Reusable Terraform modules
│ └── USAGE.md # Terraform guide
├── k8s/
│ ├── base/ # Kustomize base templates
│ └── overlays/ # Per-project configurations
├── docs/
│ └── DEMO.md # Demo walkthrough
├── .env.example # Environment template
└── README.md
Quick setup from scratch to a running MongoDB standalone:
# 1. Setup infrastructure
./scripts/01-create-opsmanager-vm.sh
./scripts/02-install-appdb.sh
./scripts/03-install-opsmanager.sh
./scripts/03a-configure-tls.sh
# 2. Manual: Open https://opsmanager.orb.local:8443
# - Create admin user
# - Create organization
# - Create API key (Organization Owner, add 192.168.139.0/24 to access list)
# - Update .env with HTTPS URL and credentials
# 3. Deploy K8s operator
./scripts/04-setup-k8s-operator.sh
# 4. Deploy MongoDB
./scripts/create-project.sh demo-01
./scripts/new-overlay.sh demo-01
kubectl apply -k k8s/overlays/demo-01
# 5. Verify
kubectl get mongodb,pods -n mongodb-demo-01 -w
# 6. Load sample data and run queries
./scripts/load-sample-data.sh demo-01
./scripts/query-sample-data.sh demo-01
# 7. Connect
mongosh 'mongodb://dbAdmin:MongoDBPass123%21@192.168.139.2:30100/admin'