mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Adding db-mongo-analytics specific conf.
This commit is contained in:
parent
abfacef9c9
commit
078ce11034
3 changed files with 79 additions and 4 deletions
|
@ -79,6 +79,34 @@
|
|||
- /srv/newsblur/config/mongodb_keyfile.key:/srv/newsblur/config/mongodb_keyfile.key
|
||||
- /var/log/mongodb/:/var/log/mongodb/
|
||||
- /opt/mongo/newsblur/backup/:/backup/
|
||||
when: (inventory_hostname | regex_replace('[0-9]+', '')) in ['db-mongo', 'db-mongo-secondary']
|
||||
|
||||
- name: Start db-mongo-analytics docker container
|
||||
become: yes
|
||||
docker_container:
|
||||
name: mongo
|
||||
image: mongo:3.6
|
||||
state: started
|
||||
container_default_behavior: no_defaults
|
||||
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"
|
||||
command: --config /etc/mongod.conf
|
||||
volumes:
|
||||
- /mnt/{{ inventory_hostname | regex_replace('db-|-', '') }}:/data/db
|
||||
- /srv/newsblur/ansible/roles/mongo/templates/mongo.analytics.conf:/etc/mongod.conf
|
||||
- /srv/newsblur/config/mongodb_keyfile.key:/srv/newsblur/config/mongodb_keyfile.key
|
||||
- /var/log/mongodb/:/var/log/mongodb/
|
||||
- /opt/mongo/newsblur/backup/:/backup/
|
||||
when: (inventory_hostname | regex_replace('[0-9]+', '')) in ['db-mongo', 'db-mongo-secondary']
|
||||
|
||||
- name: Register mongo in consul
|
||||
tags: consul
|
||||
|
@ -86,7 +114,7 @@
|
|||
template:
|
||||
src: consul_service.json
|
||||
dest: /etc/consul.d/mongo.json
|
||||
when: (inventory_hostname | regex_replace('[0-9]+', '')) in ['db-mongo', 'db-mongo-secondary'] or inventory_hostname.startswith('db2')
|
||||
when: (inventory_hostname | regex_replace('[0-9]+', '')) in ['db-mongo', 'db-mongo-secondary']
|
||||
notify:
|
||||
- reload consul
|
||||
|
||||
|
@ -96,7 +124,7 @@
|
|||
template:
|
||||
src: consul_service.analytics.json
|
||||
dest: /etc/consul.d/mongo.json
|
||||
when: (inventory_hostname | regex_replace('[0-9]+', '')) == 'db-mongo-analytics' or inventory_hostname.startswith('db3')
|
||||
when: (inventory_hostname | regex_replace('[0-9]+', '')) == 'db-mongo-analytics'
|
||||
notify:
|
||||
- reload consul
|
||||
|
||||
|
|
48
ansible/roles/mongo/templates/mongo.analytics.conf
Normal file
48
ansible/roles/mongo/templates/mongo.analytics.conf
Normal file
|
@ -0,0 +1,48 @@
|
|||
# mongod.conf
|
||||
|
||||
# for documentation of all options, see:
|
||||
# http://docs.mongodb.org/manual/reference/configuration-options/
|
||||
|
||||
# Where and how to store data.
|
||||
storage:
|
||||
dbPath: /data/db
|
||||
journal:
|
||||
enabled: true
|
||||
# engine:
|
||||
# mmapv1:
|
||||
# wiredTiger:
|
||||
|
||||
# where to write logging data.
|
||||
systemLog:
|
||||
destination: file
|
||||
logAppend: true
|
||||
path: /var/log/mongodb/mongod.log
|
||||
|
||||
# network interfaces
|
||||
net:
|
||||
port: 27017
|
||||
bindIpAll: true
|
||||
|
||||
# how the process runs
|
||||
processManagement:
|
||||
timeZoneInfo: /usr/share/zoneinfo
|
||||
|
||||
# security:
|
||||
# keyFile: /srv/newsblur/config/mongodb_keyfile.key
|
||||
# authorization: enabled
|
||||
# transitionToAuth: true
|
||||
|
||||
operationProfiling:
|
||||
mode: slowOp
|
||||
slowOpThresholdMs: 1000
|
||||
|
||||
# replication:
|
||||
# replSetName: nbset
|
||||
|
||||
#sharding:
|
||||
|
||||
## Enterprise-Only Options:
|
||||
|
||||
#auditLog:
|
||||
|
||||
#snmp:
|
|
@ -62,12 +62,11 @@ class RedisDumpMiddleware(object):
|
|||
for a, arg in enumerate(args):
|
||||
if isinstance(arg, Connection):
|
||||
redis_connection = arg
|
||||
redis_server_name = redis_connection.host
|
||||
continue
|
||||
if len(str(arg)) > 100:
|
||||
arg = "[%s bytes]" % len(str(arg))
|
||||
query.append(str(arg).replace('\n', ''))
|
||||
return { 'query': ' '.join(query), 'redis_server_name': redis_server_name }
|
||||
return { 'query': ' '.join(query), 'redis_server_name': redis_connection.host }
|
||||
|
||||
def __call__(self, request):
|
||||
response = None
|
||||
|
|
Loading…
Add table
Reference in a new issue