=> 🏡 Home | Back to notes

MongoDB

Last updated on 31 October 2023

This is a reference quick-start note for deploying MongoDB via Docker, and with working self-signed TLS.

Note: This setup does not yet consider replica sets. Coming soon...

  1. Generate keys for TLS

E.g. with one year expiry:

openssl req -nodes -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
cp cert.pem certificateKey.pem
cat key.pem >> certificateKey.pem

  1. Create a Docker Compose file

Ensure to reference the correct locations via volume mounts.

services:

mongo:

image: mongo:5

restart: always

command: "--auth --tlsMode requireTLS --tlsCertificateKeyFile /data/certificateKey.pem"

ports:

  - "27017:27017"

volumes:

  - /data/mongo:/data/db

  - ./certificateKey.pem:/data/certificateKey.pem

Proxy Information
Original URL
gemini://wilw.capsule.town/notes/mongodb.gmi
Status Code
Success (20)
Meta
text/gemini;lang=en-GB
Capsule Response Time
235.477766 milliseconds
Gemini-to-HTML Time
0.446738 milliseconds

This content has been proxied by September (ba2dc).