mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02:30
Merge pull request #4374 from AlanCoding/logger_reloading_PR
Chain reloading uWSGI on log setting change
This commit is contained in:
2
Makefile
2
Makefile
@@ -406,7 +406,7 @@ uwsgi: collectstatic
|
|||||||
@if [ "$(VENV_BASE)" ]; then \
|
@if [ "$(VENV_BASE)" ]; then \
|
||||||
. $(VENV_BASE)/tower/bin/activate; \
|
. $(VENV_BASE)/tower/bin/activate; \
|
||||||
fi; \
|
fi; \
|
||||||
uwsgi -b 32768 --socket :8050 --module=awx.wsgi:application --home=/venv/tower --chdir=/tower_devel/ --vacuum --processes=5 --harakiri=60 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket
|
uwsgi -b 32768 --socket :8050 --module=awx.wsgi:application --home=/venv/tower --chdir=/tower_devel/ --vacuum --processes=5 --harakiri=60 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket --master-fifo=/tmp/awxfifo --lazy-apps
|
||||||
|
|
||||||
daphne:
|
daphne:
|
||||||
@if [ "$(VENV_BASE)" ]; then \
|
@if [ "$(VENV_BASE)" ]; then \
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ from django.core.mail import send_mail
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.utils.log import configure_logging
|
|
||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
from awx.main.constants import CLOUD_PROVIDERS
|
from awx.main.constants import CLOUD_PROVIDERS
|
||||||
@@ -85,6 +84,14 @@ def celery_startup(conf=None, **kwargs):
|
|||||||
logger.error("Failed to rebuild schedule {}: {}".format(sch, e))
|
logger.error("Failed to rebuild schedule {}: {}".format(sch, e))
|
||||||
|
|
||||||
|
|
||||||
|
def uwsgi_reload():
|
||||||
|
# http://uwsgi-docs.readthedocs.io/en/latest/MasterFIFO.html#available-commands
|
||||||
|
logger.warn('Initiating uWSGI chain reload of server')
|
||||||
|
TRIGGER_CHAIN_RELOAD = 'c'
|
||||||
|
with open('/tmp/awxfifo', 'w') as awxfifo:
|
||||||
|
awxfifo.write(TRIGGER_CHAIN_RELOAD)
|
||||||
|
|
||||||
|
|
||||||
@task(queue='broadcast_all')
|
@task(queue='broadcast_all')
|
||||||
def clear_cache_keys(cache_keys):
|
def clear_cache_keys(cache_keys):
|
||||||
set_of_keys = set([key for key in cache_keys])
|
set_of_keys = set([key for key in cache_keys])
|
||||||
@@ -92,12 +99,7 @@ def clear_cache_keys(cache_keys):
|
|||||||
cache.delete_many(set_of_keys)
|
cache.delete_many(set_of_keys)
|
||||||
for setting_key in set_of_keys:
|
for setting_key in set_of_keys:
|
||||||
if setting_key.startswith('LOG_AGGREGATOR_'):
|
if setting_key.startswith('LOG_AGGREGATOR_'):
|
||||||
LOGGING = settings.LOGGING
|
uwsgi_reload()
|
||||||
if settings.LOG_AGGREGATOR_ENABLED:
|
|
||||||
LOGGING['handlers']['http_receiver']['class'] = 'awx.main.utils.handlers.HTTPSHandler'
|
|
||||||
else:
|
|
||||||
LOGGING['handlers']['http_receiver']['class'] = 'awx.main.utils.handlers.HTTPSNullHandler'
|
|
||||||
configure_logging(settings.LOGGING_CONFIG, LOGGING)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -999,7 +999,7 @@ LOGGING = {
|
|||||||
'propagate': False,
|
'propagate': False,
|
||||||
},
|
},
|
||||||
'awx.analytics': {
|
'awx.analytics': {
|
||||||
'handlers': ['null'],
|
'handlers': ['http_receiver'],
|
||||||
'level': 'INFO',
|
'level': 'INFO',
|
||||||
'propagate': False
|
'propagate': False
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user