mirror of https://github.com/jumpserver/jumpserver
fix: 修复部署在无证书的Redis上,定时任务不执行的问题-v2.23
parent
dd2c736b8e
commit
a6367af7d3
|
@ -12,33 +12,23 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
APPS_DIR = os.path.join(BASE_DIR, 'apps')
|
APPS_DIR = os.path.join(BASE_DIR, 'apps')
|
||||||
|
|
||||||
sys.path.insert(0, BASE_DIR)
|
sys.path.insert(0, BASE_DIR)
|
||||||
|
sys.path.insert(0, APPS_DIR)
|
||||||
from apps.jumpserver.const import CONFIG
|
from apps.jumpserver.const import CONFIG
|
||||||
|
from apps.jumpserver.settings import base as jms_settings
|
||||||
|
|
||||||
os.environ.setdefault('PYTHONOPTIMIZE', '1')
|
os.environ.setdefault('PYTHONOPTIMIZE', '1')
|
||||||
if os.getuid() == 0:
|
if os.getuid() == 0:
|
||||||
os.environ.setdefault('C_FORCE_ROOT', '1')
|
os.environ.setdefault('C_FORCE_ROOT', '1')
|
||||||
|
|
||||||
REDIS_SSL_KEYFILE = os.path.join(BASE_DIR, 'data', 'certs', 'redis_client.key')
|
|
||||||
if not os.path.exists(REDIS_SSL_KEYFILE):
|
|
||||||
REDIS_SSL_KEYFILE = None
|
|
||||||
|
|
||||||
REDIS_SSL_CERTFILE = os.path.join(BASE_DIR, 'data', 'certs', 'redis_client.crt')
|
|
||||||
if not os.path.exists(REDIS_SSL_CERTFILE):
|
|
||||||
REDIS_SSL_CERTFILE = None
|
|
||||||
|
|
||||||
REDIS_SSL_CA_CERTS = os.path.join(BASE_DIR, 'data', 'certs', 'redis_ca.crt')
|
|
||||||
if not os.path.exists(REDIS_SSL_CA_CERTS):
|
|
||||||
REDIS_SSL_CA_CERTS = os.path.join(BASE_DIR, 'data', 'certs', 'redis_ca.pem')
|
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
'host': CONFIG.REDIS_HOST,
|
'host': CONFIG.REDIS_HOST,
|
||||||
'port': CONFIG.REDIS_PORT,
|
'port': CONFIG.REDIS_PORT,
|
||||||
'password': CONFIG.REDIS_PASSWORD,
|
'password': CONFIG.REDIS_PASSWORD,
|
||||||
"ssl": CONFIG.REDIS_USE_SSL,
|
"ssl": CONFIG.REDIS_USE_SSL,
|
||||||
'ssl_cert_reqs': CONFIG.REDIS_SSL_REQUIRED,
|
'ssl_cert_reqs': CONFIG.REDIS_SSL_REQUIRED,
|
||||||
"ssl_keyfile": REDIS_SSL_KEYFILE,
|
"ssl_keyfile": jms_settings.REDIS_SSL_KEYFILE,
|
||||||
"ssl_certfile": REDIS_SSL_CERTFILE,
|
"ssl_certfile": jms_settings.REDIS_SSL_CERTFILE,
|
||||||
"ssl_ca_certs": REDIS_SSL_CA_CERTS
|
"ssl_ca_certs": jms_settings.REDIS_SSL_CA_CERTS
|
||||||
}
|
}
|
||||||
redis = Redis(**params)
|
redis = Redis(**params)
|
||||||
scheduler = "django_celery_beat.schedulers:DatabaseScheduler"
|
scheduler = "django_celery_beat.schedulers:DatabaseScheduler"
|
||||||
|
|
Loading…
Reference in New Issue