mirror of
https://github.com/frappe/bench.git
synced 2025-01-04 22:55:25 +00:00
feat: add more flexibility to procfile render
This commit is contained in:
parent
0bb5ffeb69
commit
ac08ec6dee
@ -4,12 +4,14 @@ import platform
|
|||||||
import click
|
import click
|
||||||
|
|
||||||
import bench
|
import bench
|
||||||
from bench.app import use_rq
|
|
||||||
from bench.bench import Bench
|
from bench.bench import Bench
|
||||||
from bench.utils import which
|
from bench.utils import which
|
||||||
|
|
||||||
|
|
||||||
def setup_procfile(bench_path, yes=False, skip_redis=False):
|
def setup_procfile(bench_path, yes=False, skip_redis=False, skip_web=False, skip_watch=None, skip_socketio=False, skip_schedule=False, with_coverage=False):
|
||||||
|
if skip_watch is None:
|
||||||
|
# backwards compatibilty; may be eventually removed
|
||||||
|
skip_watch = os.environ.get("CI")
|
||||||
config = Bench(bench_path).conf
|
config = Bench(bench_path).conf
|
||||||
procfile_path = os.path.join(bench_path, "Procfile")
|
procfile_path = os.path.join(bench_path, "Procfile")
|
||||||
|
|
||||||
@ -25,10 +27,13 @@ def setup_procfile(bench_path, yes=False, skip_redis=False):
|
|||||||
.get_template("Procfile")
|
.get_template("Procfile")
|
||||||
.render(
|
.render(
|
||||||
node=which("node") or which("nodejs"),
|
node=which("node") or which("nodejs"),
|
||||||
use_rq=use_rq(bench_path),
|
|
||||||
webserver_port=config.get("webserver_port"),
|
webserver_port=config.get("webserver_port"),
|
||||||
CI=os.environ.get("CI"),
|
|
||||||
skip_redis=skip_redis,
|
skip_redis=skip_redis,
|
||||||
|
skip_web=skip_web,
|
||||||
|
skip_watch=skip_watch,
|
||||||
|
skip_socketio=skip_socketio,
|
||||||
|
skip_schedule=skip_schedule,
|
||||||
|
with_coverage=with_coverage,
|
||||||
workers=config.get("workers", {}),
|
workers=config.get("workers", {}),
|
||||||
is_mac=is_mac,
|
is_mac=is_mac,
|
||||||
)
|
)
|
||||||
|
@ -2,15 +2,18 @@
|
|||||||
redis_cache: redis-server config/redis_cache.conf
|
redis_cache: redis-server config/redis_cache.conf
|
||||||
redis_queue: redis-server config/redis_queue.conf
|
redis_queue: redis-server config/redis_queue.conf
|
||||||
{% endif %}
|
{% endif %}
|
||||||
web: bench serve {% if webserver_port -%} --port {{ webserver_port }} {%- endif %}
|
{% if not skip_web %}
|
||||||
|
web: bench serve {% if with_coverage -%} --with-coverage {%- endif %} {% if webserver_port -%} --port {{ webserver_port }} {%- endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if not skip_socketio %}
|
||||||
socketio: {{ node }} apps/frappe/socketio.js
|
socketio: {{ node }} apps/frappe/socketio.js
|
||||||
|
{% endif %}
|
||||||
{% if not CI %}
|
{% if not skip_watch %}
|
||||||
watch: bench watch
|
watch: bench watch
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if not skip_schedule %}
|
||||||
schedule: bench schedule
|
schedule: bench schedule
|
||||||
|
{% endif %}
|
||||||
worker: {{ 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES NO_PROXY=*' if is_mac else '' }} bench worker 1>> logs/worker.log 2>> logs/worker.error.log
|
worker: {{ 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES NO_PROXY=*' if is_mac else '' }} bench worker 1>> logs/worker.log 2>> logs/worker.error.log
|
||||||
{% for worker_name, worker_details in workers.items() %}
|
{% for worker_name, worker_details in workers.items() %}
|
||||||
worker_{{ worker_name }}: {{ 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES NO_PROXY=*' if is_mac else '' }} bench worker --queue {{ worker_name }} 1>> logs/worker.log 2>> logs/worker.error.log
|
worker_{{ worker_name }}: {{ 'OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES NO_PROXY=*' if is_mac else '' }} bench worker --queue {{ worker_name }} 1>> logs/worker.log 2>> logs/worker.error.log
|
||||||
|
Loading…
Reference in New Issue
Block a user