mirror of
https://github.com/viq/NewsBlur.git
synced 2025-04-13 09:38:09 +00:00
Adding authSource to mongodb auth
This commit is contained in:
parent
0d266d7569
commit
4dd3bafbfb
5 changed files with 6 additions and 4 deletions
|
@ -8,6 +8,8 @@ create_user: nb
|
||||||
local_key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
|
local_key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
|
||||||
copy_local_key: "{{ lookup('file', '/srv/secrets-newsblur/keys/docker.key.pub') }}"
|
copy_local_key: "{{ lookup('file', '/srv/secrets-newsblur/keys/docker.key.pub') }}"
|
||||||
mongodb_keyfile: "{{ lookup('file', '/srv/secrets-newsblur/keys/mongodb_keyfile.key') }}"
|
mongodb_keyfile: "{{ lookup('file', '/srv/secrets-newsblur/keys/mongodb_keyfile.key') }}"
|
||||||
|
mongodb_username: "{{ lookup('ini', 'mongodb_username section=nbauth file=/srv/secrets-newsblur/configs/mongodb_auth.ini') }}"
|
||||||
|
mongodb_password: "{{ lookup('ini', 'mongodb_password section=nbauth file=/srv/secrets-newsblur/configs/mongodb_auth.ini') }}"
|
||||||
sys_packages: [
|
sys_packages: [
|
||||||
'git',
|
'git',
|
||||||
'python3',
|
'python3',
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
networks:
|
networks:
|
||||||
- name: newsblurnet
|
- name: newsblurnet
|
||||||
env:
|
env:
|
||||||
MONGODB_URI: 'mongodb://nb:KCi@db-mongo.service.nyc1.consul:27017/admin?'
|
MONGODB_URI: 'mongodb://{{ mongodb_username }}:{{ mongodb_password }}@db-mongo.service.nyc1.consul:27017/admin?authSource=nbauth'
|
||||||
ports:
|
ports:
|
||||||
- '9216:9216'
|
- '9216:9216'
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ processManagement:
|
||||||
timeZoneInfo: /usr/share/zoneinfo
|
timeZoneInfo: /usr/share/zoneinfo
|
||||||
|
|
||||||
security:
|
security:
|
||||||
authorization: enabled
|
|
||||||
keyFile: /srv/newsblur/config/mongodb_keyfile.key
|
keyFile: /srv/newsblur/config/mongodb_keyfile.key
|
||||||
|
# authorization: enabled # No RBAC
|
||||||
|
|
||||||
operationProfiling:
|
operationProfiling:
|
||||||
mode: slowOp
|
mode: slowOp
|
||||||
|
|
|
@ -67,7 +67,7 @@ def db_check_mysql():
|
||||||
@app.route("/db_check/mongo")
|
@app.route("/db_check/mongo")
|
||||||
def db_check_mongo():
|
def db_check_mongo():
|
||||||
try:
|
try:
|
||||||
client = pymongo.MongoClient(f'mongodb://{settings.MONGO_DB['username']}:{settings.MONGO_DB['password']}@db-mongo.server.nyc1.consul')
|
client = pymongo.MongoClient(f'mongodb://{settings.MONGO_DB['username']}:{settings.MONGO_DB['password']}@db-mongo.server.nyc1.consul?authSource=nbauth')
|
||||||
db = client.newsblur
|
db = client.newsblur
|
||||||
except:
|
except:
|
||||||
abort(503)
|
abort(503)
|
||||||
|
|
|
@ -20,7 +20,7 @@ def main():
|
||||||
r = redis.Redis(connection_pool=settings.REDIS_ANALYTICS_POOL)
|
r = redis.Redis(connection_pool=settings.REDIS_ANALYTICS_POOL)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = pymongo.MongoClient(f'mongodb://{settings.MONGO_DB['username']}:{settings.MONGO_DB['password']}@{settings.MONGO_DB['host']}')
|
client = pymongo.MongoClient(f'mongodb://{settings.MONGO_DB['username']}:{settings.MONGO_DB['password']}@{settings.MONGO_DB['host']}?authSource=nbauth')
|
||||||
feeds_fetched = client.newsblur.statistics.find_one({"key": "feeds_fetched"})['value']
|
feeds_fetched = client.newsblur.statistics.find_one({"key": "feeds_fetched"})['value']
|
||||||
redis_task_fetches = int(r.get(monitor_key) or 0)
|
redis_task_fetches = int(r.get(monitor_key) or 0)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Reference in a new issue