Created
January 22, 2019 10:04
-
-
Save Wavefarer42/9486fb03a1425398be3091f320d23a06 to your computer and use it in GitHub Desktop.
MongoDB Charts (docker-compose)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
mongo: | |
image: mongo:4.1.1 | |
restart: on-failure | |
command: --wiredTigerCacheSizeGB 3 | |
ports: | |
# Charts db is available under port 27018 to not block the default mongo port | |
- "8082:8081" | |
- "27018:27017" | |
volumes: | |
- ./data/db:/data/db | |
charts: | |
image: quay.io/mongodb/charts:v0.11.0 | |
hostname: charts | |
ports: | |
# host:container port mapping. If you want MongoDB Charts to be | |
# reachable on a different port on the docker host, change this | |
# to <port>:80, e.g. 8888:80. | |
- 80:80 | |
- 443:443 | |
volumes: | |
- ./data/keys:/mongodb-charts/volumes/keys | |
- ./data/logs:/mongodb-charts/volumes/logs | |
- ./data/db-certs:/mongodb-charts/volumes/db-certs | |
- ./data/web-certs:/mongodb-charts/volumes/web-certs | |
environment: | |
# The presence of following 2 environment variables will enable HTTPS on Charts server. | |
# All HTTP requests will be redirected to HTTPS as well. | |
# To enable HTTPS, upload your certificate and key file to the web-certs volume, | |
# uncomment the following lines and replace with the names of your certificate and key file. | |
# CHARTS_HTTPS_CERTIFICATE_FILE: charts-https.crt | |
# CHARTS_HTTPS_CERTIFICATE_KEY_FILE: charts-https.key | |
# This environment variable controls the built-in support widget and | |
# metrics collection in MongoDB Charts. To disable both, set the value | |
# to "off". The default is "on". | |
CHARTS_SUPPORT_WIDGET_AND_METRICS: "on" | |
# Directory where you can upload SSL certificates (.pem format) which | |
# should be considered trusted self-signed or root certificates when | |
# Charts is accessing MongoDB servers with ?ssl=true | |
SSL_CERT_DIR: /mongodb-charts/volumes/db-certs | |
CHARTS_MONGODB_URI: mongodb://172.17.0.1:27018 | |
networks: | |
- backend | |
networks: | |
backend: | |
volumes: | |
keys: | |
logs: | |
db-certs: | |
web-certs: |
How "hostname" property should be used? i was guessing it would set the server uri on javascript connections to backend of MongoDB Charts, but when i try to login it shows an error:
(TRANSPORT_ERROR): the request transport encountered an error communicating with Stitch: Network request failed
I am deploying the docker on an ubuntu server behind nginx with https, proxy passing to 8080 port which was already binded on docker-compose file to port 80 of container.
version: "3.3"
services:
mongo:
image: mongo:4.1.1
container_name: mongotest
restart: on-failure
command: --wiredTigerCacheSizeGB 3
ports:
- "8082:8081"
- "27017:27017"
volumes:
- ./data/db:/data/db
charts:
image: quay.io/mongodb/charts:v0.11.0
hostname: charts
ports:
- 80:80
volumes:
- ./data/keys:/mongodb-charts/volumes/keys
- ./data/logs:/mongodb-charts/volumes/logs
- ./data/db-certs:/mongodb-charts/volumes/db-certs
- ./data/web-certs:/mongodb-charts/volumes/web-certs
environment:
CHARTS_SUPPORT_WIDGET_AND_METRICS: "on"
SSL_CERT_DIR: /mongodb-charts/volumes/db-certs
CHARTS_MONGODB_URI: mongodb://mongotest:27017
volumes:
keys:
logs:
db-certs:
web-certs:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if i expose docker in ngnix behind /mongochart it is failing to load javascript and css