2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-23 04:29:02 +00:00

[Minor] Modified conf files to save pid and db to a path within bench

This commit is contained in:
shreyas 2016-02-24 12:56:42 +05:30 committed by Anand Doshi
parent e00ad34f9e
commit 14f42180cb
5 changed files with 25 additions and 13 deletions

View File

@ -88,36 +88,40 @@ def generate_nginx_config(bench='.'):
})
write_config_file(bench, 'nginx.conf', config)
def generate_redis_celery_broker_config(bench='.'):
def generate_redis_celery_broker_config(bench='.', pid_db_save_path):
"""Redis that is used for queueing celery tasks"""
_generate_redis_config(
template_name='redis_celery_broker.conf',
context={
"port": get_config().get('redis_async_broker_port', '12311'),
"bench_path": os.path.abspath(bench)
"bench_path": os.path.abspath(bench),
"pid_db_save_path": pid_db_save_path
},
bench=bench
)
def generate_redis_async_broker_config(bench='.'):
def generate_redis_async_broker_config(bench='.', pid_db_save_path):
"""Redis that is used to do pub/sub"""
_generate_redis_config(
template_name='redis_async_broker.conf',
context={
"port": get_config().get('redis_async_broker_port', '12311'),
"bench_path": os.path.abspath(bench)
"bench_path": os.path.abspath(bench),
"pid_db_save_path": pid_db_save_path
},
bench=bench
)
def generate_redis_cache_config(bench='.'):
def generate_redis_cache_config(bench='.', pid_db_save_path):
"""Redis that is used and optimized for caching"""
_generate_redis_config(
template_name='redis_cache.conf',
context={
"maxmemory": get_config().get('cache_maxmemory', '50'),
"port": get_config().get('redis_cache_port', '11311'),
"redis_version": get_redis_version()
"redis_version": get_redis_version(),
"bench_path": os.path.abspath(bench),
"pid_db_save_path": pid_db_save_path
},
bench=bench
)

View File

@ -1,4 +1,5 @@
dbfilename redis_async_broker.rdb
pidfile redis_async_broker.pid
dir {{pid_db_save_path}}
pidfile {{pid_db_save_path}}/redis_async_broker.pid
port {{port}}
bench_path {{bench_path}}

View File

@ -1,7 +1,9 @@
dbfilename redis_cache_dump.rdb
pidfile redis_cache.pid
dir {{pid_db_save_path}}
pidfile {{pid_db_save_path}}/redis_cache.pid
port {{port}}
maxmemory {{maxmemory}}mb
maxmemory-policy allkeys-lru
save ""
appendonly no
appendonly no
bench_path {{bench_path}}

View File

@ -1,4 +1,5 @@
dbfilename redis_async_broker.rdb
pidfile redis_async_broker.pid
dir {{pid_db_save_path}}
pidfile {{pid_db_save_path}}/redis_async_broker.pid
port {{port}}
bench_path {{bench_path}}

View File

@ -59,6 +59,10 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
for dirname in ('apps', 'sites', 'config', 'logs'):
os.mkdir(os.path.join(path, dirname))
# This is folder to save the pid and redis db files for each redis process
pid_db_save_path = os.path.join(path, 'config', 'files')
os.mkdir(pid_db_save_path)
setup_logging()
setup_env(bench=path)
@ -78,9 +82,9 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
setup_socketio(bench=path)
build_assets(bench=path)
generate_redis_celery_broker_config(bench=path)
generate_redis_cache_config(bench=path)
generate_redis_async_broker_config(bench=path)
generate_redis_celery_broker_config(bench=path, pid_db_save_path)
generate_redis_cache_config(bench=path, pid_db_save_path)
generate_redis_async_broker_config(bench=path, pid_db_save_path)
if not no_procfile:
setup_procfile(bench=path)