Mongo analytics is its own server, with authentication.

This commit is contained in:
Samuel Clay 2021-08-03 19:43:27 -04:00
parent bc69e859eb
commit 4a81611b01
5 changed files with 16 additions and 16 deletions

View file

@ -29,7 +29,7 @@ groups:
elasticsearch: inventory_hostname.startswith('db-elasticsearch')
redis: inventory_hostname.startswith('db-redis')
postgres: inventory_hostname.startswith('db-postgres')
mongo: inventory_hostname.startswith('db-mongo')
mongo: inventory_hostname.startswith('db-mongo') and not inventory_hostname.startswith('db-mongo-analytics')
mongo_analytics: inventory_hostname.startswith('db-mongo-analytics')
consul: inventory_hostname.startswith('db-consul')
metrics: inventory_hostname.startswith('db-metrics')

View file

@ -91,14 +91,14 @@
hostname: "{{ inventory_hostname }}"
restart_policy: unless-stopped
networks_cli_compatible: yes
network_mode: host
# network_mode: default
# networks:
# - name: newsblurnet
# aliases:
# - mongo
# ports:
# - "27017:27017"
# network_mode: host
network_mode: default
networks:
- name: newsblurnet
aliases:
- mongo
ports:
- "27017:27017"
command: --config /etc/mongod.conf
volumes:
- /mnt/{{ inventory_hostname | regex_replace('db-|-', '') }}:/data/db

View file

@ -27,9 +27,9 @@ net:
processManagement:
timeZoneInfo: /usr/share/zoneinfo
# security:
# keyFile: /srv/newsblur/config/mongodb_keyfile.key
# authorization: enabled
security:
keyFile: /srv/newsblur/config/mongodb_keyfile.key
authorization: enabled
# transitionToAuth: true
operationProfiling:

View file

@ -172,14 +172,14 @@ backend mongo
{% for host in groups.mongo %}
server {{host}} {{host}}.node.nyc1.consul:5579
{% endfor %}
{#
backend mongo_analytics
option httpchk GET /db_check/mongo
option httpchk GET /db_check/mongo_analytics
default-server check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
{% for host in groups.mongo_analytics %}
server {{host}} {{host}}.node.nyc1.consul:5579
{% endfor %}
#}
backend db_redis_user
option httpchk GET /db_check/redis
server db-redis-user db-redis-user.node.nyc1.consul:5579 check inter 2000ms resolvers consul resolve-opts allow-dup-ip init-addr none

View file

@ -109,7 +109,7 @@ def db_check_mongo():
@app.route("/db_check/mongo_analytics")
def db_check_mongo_analytics():
try:
client = pymongo.MongoClient(f"mongodb://{settings.MONGO_DB['username']}:{settings.MONGO_DB['password']}@{settings.SERVER_NAME}/?authSource=admin")
client = pymongo.MongoClient(f"mongodb://{settings.MONGO_ANALYTICS_DB['username']}:{settings.MONGO_ANALYTICS_DB['password']}@{settings.SERVER_NAME}/?authSource=admin")
db = client.nbanalytics
except:
abort(503)