2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-02 22:00:17 +00:00

feat: add more flexibility to procfile render

This commit is contained in:
David 2024-11-26 12:54:30 +01:00
parent 0bb5ffeb69
commit ac08ec6dee
No known key found for this signature in database
GPG Key ID: AB15A6AF1101390D
2 changed files with 17 additions and 9 deletions

View File

@ -4,12 +4,14 @@ import platform
import click
import bench
from bench.app import use_rq
from bench.bench import Bench
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
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")
.render(
node=which("node") or which("nodejs"),
use_rq=use_rq(bench_path),
webserver_port=config.get("webserver_port"),
CI=os.environ.get("CI"),
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", {}),
is_mac=is_mac,
)

View File

@ -2,15 +2,18 @@
redis_cache: redis-server config/redis_cache.conf
redis_queue: redis-server config/redis_queue.conf
{% 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
{% if not CI %}
{% endif %}
{% if not skip_watch %}
watch: bench watch
{% endif %}
{% if not skip_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
{% 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