From d979751e0c44f8b519e77a4bb11c7e6e3f6333ee Mon Sep 17 00:00:00 2001 From: Adam Tang <37611541+adamtang79@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:07:43 +0800 Subject: [PATCH 01/37] fix: warning on pip reinstall frappe version-12[-hotfix] has six==1.13.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e00b90ea..e800a59b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ python-crontab==2.4.0 requests==2.22.0 semantic-version==2.8.2 setuptools==40.8.0 -six==1.12.0 +six==1.13.0 virtualenv==16.6.0 From d5aebc0569018112f98e94bc45c3ba92c41fd4c5 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 31 Aug 2020 14:11:29 +0530 Subject: [PATCH 02/37] docs: Add development on bench README --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 8bdc2af4..abbbb7f4 100755 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Bench is a command-line utility that helps you to install, update, and manage mu - [Bench Manager](#bench-manager) - [Guides](#guides) - [Resources](#resources) + - [Development](#development) - [License](#license) @@ -254,6 +255,36 @@ For an exhaustive list of guides, check out [Bench Guides](https://frappe.io/doc For an exhaustive list of resources, check out [Bench Resources](https://frappe.io/docs/user/en/bench/resources). +## Development + +To contribute and develop on the bench CLI tool, clone this repo and create an editable install. In editable mode, you may get the following warning everytime you run a bench command: + + WARN: bench is installed in editable mode! + + This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench` + + +```sh +$ git clone https://github.com/frappe/bench ~/bench-repo +$ pip3 install -e ~/bench-repo +$ bench src +/Users/frappe/bench-repo +``` + +To clear up the editable install and switch to a stable version of bench, uninstall via pip and delete the corresponding egg file from the python path. + + +```sh +# Delete bench installed in editable install +$ rm -r $(find ~ -name '*.egg-info') +$ pip3 uninstall frappe-bench + +# Install latest released version of bench +$ pip3 install -U frappe-bench +``` + +To confirm the switch, check the output of `bench src`. It should change from something like `$HOME/bench-repo` to `/usr/local/lib/python3.6/dist-packages` and stop the editable install warnings from getting triggered at every command. + ## License This repository has been released under the [GNU GPLv3 License](LICENSE). From 550f55d1460cc29197c7ec9dddc59b0d81684e9f Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 3 Sep 2020 12:46:28 +0530 Subject: [PATCH 03/37] fix: Update package lists and setup prereqs before setting up script deps --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index 2b70d7f4..ac09bde7 100644 --- a/install.py +++ b/install.py @@ -464,11 +464,11 @@ if __name__ == '__main__': with warnings.catch_warnings(): warnings.simplefilter("ignore") setup_log_stream(args) + install_prerequisites() setup_script_requirements() check_distribution_compatibility() check_system_package_managers() check_environment() - install_prerequisites() install_bench(args) log("Bench + Frappe + ERPNext has been successfully installed!") From 0ad44214cf739812ce8dc0175f5774bdd376ebf1 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 3 Sep 2020 13:07:13 +0530 Subject: [PATCH 04/37] fix: Use 'develop' bench if not specified! --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index ac09bde7..91dff3f2 100644 --- a/install.py +++ b/install.py @@ -269,7 +269,7 @@ def install_bench(args): def clone_bench_repo(args): '''Clones the bench repository in the user folder''' - branch = args.bench_branch or 'master' + branch = args.bench_branch or 'develop' repo_url = args.repo_url or 'https://github.com/frappe/bench' if os.path.exists(tmp_bench_repo): From 9d1f7a7ed7ca3caaf9978c3f75292984078caf69 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 3 Sep 2020 13:11:31 +0530 Subject: [PATCH 05/37] fix: Allow bench src as root --- bench/cli.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index de949aba..95ca545d 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -29,9 +29,12 @@ def cli(): change_working_directory() logger = setup_logging() or logging.getLogger(bench.PROJECT_NAME) logger.info(command) - check_uid() + + if sys.argv[1] not in ("src", ): + check_uid() + change_uid() + change_dir() - change_uid() if is_dist_editable(bench.PROJECT_NAME) and len(sys.argv) > 1 and sys.argv[1] != "src" and not get_config(".").get("developer_mode"): log("bench is installed in editable mode!\n\nThis is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`\n", level=3) From 28302f67a30e061d771a5607f67b2b03b1205a7d Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 3 Sep 2020 13:13:24 +0530 Subject: [PATCH 06/37] fix: Log in ~/bench.log if not running inside bench directory --- bench/cli.py | 2 +- bench/utils.py | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index de949aba..b3eb871d 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -27,7 +27,7 @@ def cli(): command = " ".join(sys.argv) change_working_directory() - logger = setup_logging() or logging.getLogger(bench.PROJECT_NAME) + logger = setup_logging() logger.info(command) check_uid() change_dir() diff --git a/bench/utils.py b/bench/utils.py index 4a4fa813..7e2f6662 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -443,15 +443,18 @@ def setup_logging(bench_path='.'): logging.Logger.log = logv if os.path.exists(os.path.join(bench_path, 'logs')): - logger = logging.getLogger(bench.PROJECT_NAME) log_file = os.path.join(bench_path, 'logs', 'bench.log') - formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') - hdlr = logging.FileHandler(log_file) - hdlr.setFormatter(formatter) - logger.addHandler(hdlr) - logger.setLevel(logging.DEBUG) + else: + log_file = os.path.join(os.path.expanduser("~"), 'bench.log') - return logger + logger = logging.getLogger(bench.PROJECT_NAME) + formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') + hdlr = logging.FileHandler(log_file) + hdlr.setFormatter(formatter) + logger.addHandler(hdlr) + logger.setLevel(logging.DEBUG) + + return logger def get_process_manager(): From 61567be3f69aa34b11a60fbd807aed00f9dc40a7 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 3 Sep 2020 13:45:38 +0530 Subject: [PATCH 07/37] fix: Install wheel during ansible setup Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index 91dff3f2..46ce4247 100644 --- a/install.py +++ b/install.py @@ -163,7 +163,7 @@ def install_prerequisites(): install_package('pip3', 'python3-pip') success = run_os_command({ - 'python3': "sudo -H python3 -m pip install --upgrade setuptools cryptography ansible==2.8.5 pip" + 'python3': "sudo -H python3 -m pip install --upgrade setuptools wheel cryptography ansible==2.8.5 pip" }) if not (success or shutil.which('ansible')): From 03576d10b45046659fc356fb8113fddf06d2bc33 Mon Sep 17 00:00:00 2001 From: gavin Date: Thu, 3 Sep 2020 13:58:54 +0530 Subject: [PATCH 08/37] fix: Unpin setuptools, six and virtualenv --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index e00b90ea..ea1bdd08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,6 @@ Jinja2==2.10.3 python-crontab==2.4.0 requests==2.22.0 semantic-version==2.8.2 -setuptools==40.8.0 -six==1.12.0 -virtualenv==16.6.0 +setuptools +six +virtualenv From 7a7b0fea3786c1c4009fb580e96ae16c84f69cb3 Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Mon, 7 Sep 2020 18:58:24 +0530 Subject: [PATCH 09/37] fix: update letsencrypt renew cron frequency --- bench/config/lets_encrypt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index 5f0396b9..872cd129 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -90,7 +90,7 @@ def setup_crontab(): system_crontab = CronTab(user='root') if job_command not in str(system_crontab): job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month") - job.day.on(1) + job.every(1).day() system_crontab.write() From 7dcd5f9ce3c3322f0a5d96f1b9624c6215f76448 Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Tue, 8 Sep 2020 12:15:35 +0530 Subject: [PATCH 10/37] fix: force renew on monthly bases --- bench/config/lets_encrypt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index 872cd129..f9e596e0 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -86,11 +86,11 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True) def setup_crontab(): - job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' + job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' system_crontab = CronTab(user='root') if job_command not in str(system_crontab): job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month") - job.every(1).day() + job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 system_crontab.write() From 097879e1fb855d4223fcce3ad359a2f9ec81d835 Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Tue, 8 Sep 2020 12:58:56 +0530 Subject: [PATCH 11/37] feat: patch for older setups with wrong cron format --- .../v5/fix_letsencrypt_renew_frequency.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bench/patches/v5/fix_letsencrypt_renew_frequency.py diff --git a/bench/patches/v5/fix_letsencrypt_renew_frequency.py b/bench/patches/v5/fix_letsencrypt_renew_frequency.py new file mode 100644 index 00000000..eda219ba --- /dev/null +++ b/bench/patches/v5/fix_letsencrypt_renew_frequency.py @@ -0,0 +1,19 @@ +from bench.config.common_site_config import get_config +from crontab import CronTab + + +def execute(bench_path): + """ + This patch fixes a cron job that would renew letsencrypt certificate + """ + + job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' + system_crontab = CronTab(user='root') + job_comment = "Renew lets-encrypt every month" + + for job in system_crontab.find_comment(job_comment) + system_crontab.remove(job) + job = system_crontab.new(command=job_command, comment=job_comment) + job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 + system_crontab.write() + break From 1e97cdf0c831e0ae46b3e7c579c96e05ca185916 Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Tue, 8 Sep 2020 12:58:56 +0530 Subject: [PATCH 12/37] feat: patch for older setups with wrong cron format --- .../v5/fix_letsencrypt_renew_frequency.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bench/patches/v5/fix_letsencrypt_renew_frequency.py diff --git a/bench/patches/v5/fix_letsencrypt_renew_frequency.py b/bench/patches/v5/fix_letsencrypt_renew_frequency.py new file mode 100644 index 00000000..2c17d98d --- /dev/null +++ b/bench/patches/v5/fix_letsencrypt_renew_frequency.py @@ -0,0 +1,19 @@ +from bench.config.common_site_config import get_config +from crontab import CronTab + + +def execute(bench_path): + """ + This patch fixes a cron job that would renew letsencrypt certificate + """ + + job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' + system_crontab = CronTab(user='root') + job_comment = "Renew lets-encrypt every month" + + for job in system_crontab.find_comment(job_comment) + system_crontab.remove(job) + job = system_crontab.new(command=job_command, comment=job_comment) + job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 + system_crontab.write() + break From 137a78a6b0fa826a947deb0d07bb05bcf1fafe70 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 8 Sep 2020 17:13:26 +0530 Subject: [PATCH 13/37] feat: pitch erpnext support to VM users --- vm/scripts/set_message_production.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/scripts/set_message_production.sh b/vm/scripts/set_message_production.sh index 74182ca6..2fddcb77 100644 --- a/vm/scripts/set_message_production.sh +++ b/vm/scripts/set_message_production.sh @@ -6,7 +6,7 @@ message=" Please access ERPNext by going to http://localhost:8080 on the host system. The username is \"Administrator\" and password is \"admin\" - Do consider donating at https://frappe.io/buy + Consider buying professional support from us at https://erpnext.com/support To update, login as username: frappe From bc2eb7b4cb02e795607c668ade5606c1bc82d10c Mon Sep 17 00:00:00 2001 From: gavin Date: Wed, 9 Sep 2020 15:03:50 +0530 Subject: [PATCH 14/37] docs: Update bench CLI update method --- docs/commands_and_usage.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/commands_and_usage.md b/docs/commands_and_usage.md index 92ad33bc..ed71cc59 100644 --- a/docs/commands_and_usage.md +++ b/docs/commands_and_usage.md @@ -2,9 +2,14 @@ * Updating - Currently, `bench update` can be run from any directory however the context of the command changes. If run from a bench directory, the vanilla command itself updates all apps, runs migrations and backs up all sites. +To update the bench CLI tool, depending on your method of installation, you may use - bench update + pip3 install -U frappe-bench + + +To backup, update all apps and sites on your bench, you may use + + bench update To manually update the bench, run `bench update` to update all the apps, run From 1237d604ce9dd78a1644e7f33f3da2dd03655ee9 Mon Sep 17 00:00:00 2001 From: gavin Date: Wed, 9 Sep 2020 15:38:55 +0530 Subject: [PATCH 15/37] docs: Update operation fix --- docs/bench_usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bench_usage.md b/docs/bench_usage.md index cf9a0364..807d021f 100644 --- a/docs/bench_usage.md +++ b/docs/bench_usage.md @@ -72,7 +72,7 @@ These commands belong directly to the bench group so they can be invoked directl - **init**: Initialize a new bench instance in the specified path. This sets up a complete bench folder with an `apps` folder which contains all the Frappe apps available in the current bench, `sites` folder that stores all site data seperated by individual site folders, `config` folder that contains your redis, NGINX and supervisor configuration files. The `env` folder consists of all python dependencies the current bench and installed Frappe applications have. - **restart**: Restart web, supervisor, systemd processes units. Used in production setup. - - **update**: Updates bench tool and if executed in a bench directory, without any flags will backup, pull, setup requirements, build, run patches and restart bench. Using specific flags will only do certain tasks instead of all. + - **update**: If executed in a bench directory, without any flags will backup, pull, setup requirements, build, run patches and restart bench. Using specific flags will only do certain tasks instead of all. - **migrate-env**: Migrate Virtual Environment to desired Python version. This regenerates the `env` folder with the specified Python version. - **retry-upgrade**: Retry a failed upgrade - **disable-production**: Disables production environment for the bench. From 408676c80e3fa37e3794584b12e73c2060cfa55f Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Wed, 9 Sep 2020 19:38:18 +0530 Subject: [PATCH 16/37] fix: removed force renewal as it would extend by 3 months every month, now the job runs daily --- bench/config/lets_encrypt.py | 4 ++-- bench/patches/v5/fix_letsencrypt_renew_frequency.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index f9e596e0..bea1b86b 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -86,11 +86,11 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True) def setup_crontab(): - job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' + job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' system_crontab = CronTab(user='root') if job_command not in str(system_crontab): job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month") - job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 + job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month system_crontab.write() diff --git a/bench/patches/v5/fix_letsencrypt_renew_frequency.py b/bench/patches/v5/fix_letsencrypt_renew_frequency.py index 61b82111..73806c54 100644 --- a/bench/patches/v5/fix_letsencrypt_renew_frequency.py +++ b/bench/patches/v5/fix_letsencrypt_renew_frequency.py @@ -7,13 +7,13 @@ def execute(bench_path): This patch fixes a cron job that would renew letsencrypt certificate """ - job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' + job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' system_crontab = CronTab(user='root') job_comment = "Renew lets-encrypt every month" - for job in system_crontab.find_comment(job_comment) + for job in system_crontab.find_comment(job_comment): system_crontab.remove(job) job = system_crontab.new(command=job_command, comment=job_comment) - job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 + job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month system_crontab.write() break From 87edc4e10932a9ce92215fef00daada5f6817b7d Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Wed, 9 Sep 2020 21:31:57 +0530 Subject: [PATCH 17/37] fix: removed patch --- bench/config/lets_encrypt.py | 15 +++++++++++---- .../v5/fix_letsencrypt_renew_frequency.py | 19 ------------------- 2 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 bench/patches/v5/fix_letsencrypt_renew_frequency.py diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index bea1b86b..2615784d 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -87,11 +87,15 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True) def setup_crontab(): job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' + job_comment = 'Renew lets-encrypt every month' system_crontab = CronTab(user='root') - if job_command not in str(system_crontab): - job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month") - job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month - system_crontab.write() + + for job in system_crontab.find_comment(comment=job_comment): # Removes older entries + system_crontab.remove(job) + + job = system_crontab.new(command=job_command, comment=job_comment) + job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month + system_crontab.write() def create_dir_if_missing(path): @@ -113,10 +117,13 @@ def get_certbot_path(): def renew_certs(): + # Needs to be run with sudo click.confirm('Running this will stop the nginx service temporarily causing your sites to go offline\n' 'Do you want to continue?', abort=True) + setup_crontab() + service('nginx', 'stop') exec_cmd("{path} renew".format(path=get_certbot_path())) service('nginx', 'start') diff --git a/bench/patches/v5/fix_letsencrypt_renew_frequency.py b/bench/patches/v5/fix_letsencrypt_renew_frequency.py deleted file mode 100644 index 73806c54..00000000 --- a/bench/patches/v5/fix_letsencrypt_renew_frequency.py +++ /dev/null @@ -1,19 +0,0 @@ -from bench.config.common_site_config import get_config -from crontab import CronTab - - -def execute(bench_path): - """ - This patch fixes a cron job that would renew letsencrypt certificate - """ - - job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' - system_crontab = CronTab(user='root') - job_comment = "Renew lets-encrypt every month" - - for job in system_crontab.find_comment(job_comment): - system_crontab.remove(job) - job = system_crontab.new(command=job_command, comment=job_comment) - job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month - system_crontab.write() - break From 31f2999b4b971176b57c09ecef5d5edfe39dcb53 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 10 Sep 2020 10:10:55 +0530 Subject: [PATCH 18/37] fix: Use NullHandler for commands executed outside a bench dir --- bench/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/utils.py b/bench/utils.py index 7e2f6662..8e76903f 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -444,12 +444,12 @@ def setup_logging(bench_path='.'): if os.path.exists(os.path.join(bench_path, 'logs')): log_file = os.path.join(bench_path, 'logs', 'bench.log') + hdlr = logging.FileHandler(log_file) else: - log_file = os.path.join(os.path.expanduser("~"), 'bench.log') + hdlr = logging.NullHandler() logger = logging.getLogger(bench.PROJECT_NAME) formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') - hdlr = logging.FileHandler(log_file) hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.setLevel(logging.DEBUG) From c9abac299a3b46f08b0b4406449bb82ed90a60a2 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 10 Sep 2020 10:53:51 +0530 Subject: [PATCH 19/37] fix: Updated command help and verbosity while setting crontab --- bench/commands/utils.py | 2 +- bench/config/lets_encrypt.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bench/commands/utils.py b/bench/commands/utils.py index 78899d19..5d9ac6d5 100644 --- a/bench/commands/utils.py +++ b/bench/commands/utils.py @@ -111,7 +111,7 @@ def download_translations(): download_translations_p() -@click.command('renew-lets-encrypt', help="Renew Let's Encrypt certificate") +@click.command('renew-lets-encrypt', help="Sets Up latest cron and Renew Let's Encrypt certificate") def renew_lets_encrypt(): from bench.config.lets_encrypt import renew_certs renew_certs() diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index 2615784d..32ca3380 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -88,6 +88,8 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True) def setup_crontab(): job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' job_comment = 'Renew lets-encrypt every month' + print("Setting Up cron job to {0}".format(job_comment)) + system_crontab = CronTab(user='root') for job in system_crontab.find_comment(comment=job_comment): # Removes older entries From 31e4aeeab8bca4a8d58ad72db735128670a7480b Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 24 Sep 2020 12:56:11 +0530 Subject: [PATCH 20/37] fix: Handle no args passed in CLI --- bench/cli.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 95ca545d..e0d94f1a 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -30,11 +30,10 @@ def cli(): logger = setup_logging() or logging.getLogger(bench.PROJECT_NAME) logger.info(command) - if sys.argv[1] not in ("src", ): + if len(sys.argv) > 1 and sys.argv[1] not in ("src", ): check_uid() change_uid() - - change_dir() + change_dir() if is_dist_editable(bench.PROJECT_NAME) and len(sys.argv) > 1 and sys.argv[1] != "src" and not get_config(".").get("developer_mode"): log("bench is installed in editable mode!\n\nThis is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`\n", level=3) From 28067f6f9c68037afe43160b71d59b6508e067b0 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 24 Sep 2020 13:09:58 +0530 Subject: [PATCH 21/37] test: Add bench utils tests --- bench/tests/test_init.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bench/tests/test_init.py b/bench/tests/test_init.py index 69d49a45..77e4a3a0 100755 --- a/bench/tests/test_init.py +++ b/bench/tests/test_init.py @@ -27,6 +27,11 @@ class TestBenchInit(TestBenchBase): self.assertEqual( get_bumped_version('11.0.5-beta.22', 'prerelease'), '11.0.5-beta.23' ) + def test_utils(self): + self.assertEqual(subprocess.call("bench"), 0) + self.assertEqual(os.path.dirname(bench.cli.src), subprocess.check_output(["bench", "src"], cwd=".").decode('utf8')) + + def test_init(self, bench_name="test-bench", **kwargs): self.init_bench(bench_name, **kwargs) self.assert_folders(bench_name) From 2f0b508d2ef1d4935ccd4a74d374ee6be28a7bec Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 24 Sep 2020 13:35:47 +0530 Subject: [PATCH 22/37] fix: Add bench.cli namespace --- bench/tests/test_init.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bench/tests/test_init.py b/bench/tests/test_init.py index 77e4a3a0..4ebcae15 100755 --- a/bench/tests/test_init.py +++ b/bench/tests/test_init.py @@ -9,6 +9,7 @@ import git # imports - module imports import bench +import bench.cli import bench.utils from bench.release import get_bumped_version from bench.tests.test_base import FRAPPE_BRANCH, TestBenchBase From b8ed4f6a4bc35f7a8935793c3616fc1258ff2685 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 24 Sep 2020 16:16:31 +0530 Subject: [PATCH 23/37] fix: Remove src test --- bench/tests/test_init.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bench/tests/test_init.py b/bench/tests/test_init.py index 4ebcae15..2f409899 100755 --- a/bench/tests/test_init.py +++ b/bench/tests/test_init.py @@ -30,7 +30,6 @@ class TestBenchInit(TestBenchBase): def test_utils(self): self.assertEqual(subprocess.call("bench"), 0) - self.assertEqual(os.path.dirname(bench.cli.src), subprocess.check_output(["bench", "src"], cwd=".").decode('utf8')) def test_init(self, bench_name="test-bench", **kwargs): From df0562d59b423f1d833c929a38ea5e380bbcae4f Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Sun, 4 Oct 2020 00:13:23 +0700 Subject: [PATCH 24/37] fix(install): Install dev packages for Arm 64-bit Until psycopg2-binary is available for aarch64 (Arm 64-bit), we'll need libpq and libssl dev packages to build psycopg2 from source Fixes https://github.com/frappe/bench/issues/1084 --- install.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install.py b/install.py index 46ce4247..4831d52b 100644 --- a/install.py +++ b/install.py @@ -156,6 +156,14 @@ def install_prerequisites(): 'sudo yum install -y epel-release redhat-lsb-core git python-setuptools python-devel openssl-devel libffi-devel' ] }) + + # until psycopg2-binary is available for aarch64 (Arm 64-bit), we'll need libpq and libssl dev packages to build psycopg2 from source + if platform.machine() == 'aarch64': + log("Installing libpq and libssl dev packages to build psycopg2 for aarch64...") + run_os_command({ + 'apt-get': ['sudo apt-get install -y libpq-dev libssl-dev'], + 'yum': ['sudo yum install -y libpq-devel openssl-devel'] + }) install_package('curl') install_package('wget') From e146919f9d642b7d28ef2e9d905fc394f04f19f8 Mon Sep 17 00:00:00 2001 From: gavin Date: Tue, 27 Oct 2020 13:57:05 +0530 Subject: [PATCH 25/37] chore: Added semantic config Installed https://github.com/zeke/semantic-pull-requests and added config for repo --- .github/semantic.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/semantic.yml diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 00000000..e1e53bc1 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,13 @@ +# Always validate the PR title AND all the commits +titleAndCommits: true + +# Allow use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns") +# this is only relevant when using commitsOnly: true (or titleAndCommits: true) +allowMergeCommits: true + +# Allow use of Revert commits (eg on github: "Revert "feat: ride unicorns"") +# this is only relevant when using commitsOnly: true (or titleAndCommits: true) +allowRevertCommits: true + +# For allowed PR types: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json +# Tool Reference: https://github.com/zeke/semantic-pull-requests From f17c579ffdbb82526acff00dea03e0b624c2bd81 Mon Sep 17 00:00:00 2001 From: Karan Sharma Date: Wed, 24 Oct 2018 16:41:05 +0530 Subject: [PATCH 26/37] build(config): Change default worker count --- bench/config/common_site_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/config/common_site_config.py b/bench/config/common_site_config.py index 02c6778a..d71d9efd 100644 --- a/bench/config/common_site_config.py +++ b/bench/config/common_site_config.py @@ -55,7 +55,7 @@ def get_gunicorn_workers(): '''This function will return the maximum workers that can be started depending upon number of cpu's present on the machine''' return { - "gunicorn_workers": multiprocessing.cpu_count() + "gunicorn_workers": multiprocessing.cpu_count() * 2 + 1 } def update_config_for_frappe(config, bench_path): From 482bb2e59182c11f66b45539d12414a366b5bb72 Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Sat, 3 Oct 2020 23:58:18 +0700 Subject: [PATCH 27/37] build(install): Upgrade Ansible to 2.8.15 (or later patch version) --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index 46ce4247..b5bd43f5 100644 --- a/install.py +++ b/install.py @@ -163,7 +163,7 @@ def install_prerequisites(): install_package('pip3', 'python3-pip') success = run_os_command({ - 'python3': "sudo -H python3 -m pip install --upgrade setuptools wheel cryptography ansible==2.8.5 pip" + 'python3': "sudo -H python3 -m pip install --upgrade setuptools wheel cryptography ansible~=2.8.15 pip" }) if not (success or shutil.which('ansible')): From 608b28c2460adf2b6ee1504b21a7e69dfdb06a1e Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Sun, 4 Oct 2020 07:07:41 +0000 Subject: [PATCH 28/37] fix(install): Obey --without-site --- bench/playbooks/roles/bench/tasks/setup_erpnext.yml | 5 +++-- install.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bench/playbooks/roles/bench/tasks/setup_erpnext.yml b/bench/playbooks/roles/bench/tasks/setup_erpnext.yml index 32e498d1..9db153ab 100644 --- a/bench/playbooks/roles/bench/tasks/setup_erpnext.yml +++ b/bench/playbooks/roles/bench/tasks/setup_erpnext.yml @@ -13,16 +13,17 @@ - name: Check whether the site already exists stat: path="{{ bench_path }}/sites/{{ site }}" register: site_folder + when: not without_site - name: Create a new site command: "bench new-site {{ site }} --admin-password '{{ admin_password }}' --mariadb-root-password '{{ mysql_root_password }}'" args: chdir: "{{ bench_path }}" - when: not site_folder.stat.exists + when: not without_site and not site_folder.stat.exists - name: Install ERPNext to default site command: "bench --site {{ site }} install-app erpnext" args: chdir: "{{ bench_path }}" - when: not without_erpnext + when: not without_site and not without_erpnext ... \ No newline at end of file diff --git a/install.py b/install.py index 46ce4247..8a08c1db 100644 --- a/install.py +++ b/install.py @@ -327,8 +327,8 @@ def get_passwords(args): mysql_root_password = '' continue - # admin password - if not admin_password: + # admin password, only needed if we're also creating a site + if not admin_password and not args.without_site: admin_password = getpass.unix_getpass(prompt='Please enter the default Administrator user password: ') conf_admin_passswd = getpass.unix_getpass(prompt='Re-enter Administrator password: ') From f2e7702fdefe30ee8d0546da5dc09e9042f7f570 Mon Sep 17 00:00:00 2001 From: Adam Tang <37611541+adamtang79@users.noreply.github.com> Date: Wed, 28 Oct 2020 09:04:41 +0800 Subject: [PATCH 29/37] fix: utf8mb4_general_ci fix: prevent error while bench new-site --- bench/playbooks/roles/mariadb/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bench/playbooks/roles/mariadb/tasks/main.yml b/bench/playbooks/roles/mariadb/tasks/main.yml index 1f119005..8079583d 100644 --- a/bench/playbooks/roles/mariadb/tasks/main.yml +++ b/bench/playbooks/roles/mariadb/tasks/main.yml @@ -48,6 +48,10 @@ [mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock + + # setting appeared inside mysql but overwritten by mariadb inside mariadb.conf.d/xx-server.cnf valued as utf8mb4_general_ci + + collation-server = utf8mb4_unicode_ci create: yes become: yes become_user: root From 6a207ca57ab36d3d43b169b8a7609ba87dc8611b Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Sat, 3 Oct 2020 16:12:39 +0700 Subject: [PATCH 30/37] fix(install): Allow override of frappe_branch and erpnext_branch Regardless of args.version (which always has a default set). Additionally, print useful log of (non-credentials) variables used. --- install.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.py b/install.py index 7a33ba11..6dcf30a6 100644 --- a/install.py +++ b/install.py @@ -247,12 +247,11 @@ def install_bench(args): else: frappe_branch = "version-{0}".format(args.version) erpnext_branch = "version-{0}".format(args.version) - else: - if args.frappe_branch: - frappe_branch = args.frappe_branch - - if args.erpnext_branch: - erpnext_branch = args.erpnext_branch + # Allow override of frappe_branch and erpnext_branch, regardless of args.version (which always has a default set) + if args.frappe_branch: + frappe_branch = args.frappe_branch + if args.erpnext_branch: + erpnext_branch = args.erpnext_branch extra_vars.update(frappe_branch=frappe_branch) extra_vars.update(erpnext_branch=erpnext_branch) @@ -261,6 +260,7 @@ def install_bench(args): extra_vars.update(bench_name=bench_name) # Will install ERPNext production setup by default + log("Initializing bench using bench_name=%s frappe_branch=%s erpnext_branch=%s ..." % (bench_name, frappe_branch, erpnext_branch)) run_playbook('site.yml', sudo=True, extra_vars=extra_vars) if os.path.exists(tmp_bench_repo): From 2c4659a7aab2c4c8ed7734438ffc42360c9c6023 Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Fri, 30 Oct 2020 17:35:19 +0700 Subject: [PATCH 31/37] fix(install): Helpful logging Co-authored-by: gavin --- install.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index 6dcf30a6..40dba36e 100644 --- a/install.py +++ b/install.py @@ -260,7 +260,10 @@ def install_bench(args): extra_vars.update(bench_name=bench_name) # Will install ERPNext production setup by default - log("Initializing bench using bench_name=%s frappe_branch=%s erpnext_branch=%s ..." % (bench_name, frappe_branch, erpnext_branch)) + if args.without_erpnext: + log("Initializing bench {bench_name}:\n\tFrappe Branch: {frappe_branch}\n\tERPNext will not be installed due to --without-erpnext".format(bench_name=bench_name, frappe_branch=frappe_branch)) + else: + log("Initializing bench {bench_name}:\n\tFrappe Branch: {frappe_branch}\n\tERPNext Branch: {erpnext_branch}".format(bench_name=bench_name, frappe_branch=frappe_branch, erpnext_branch=erpnext_branch)) run_playbook('site.yml', sudo=True, extra_vars=extra_vars) if os.path.exists(tmp_bench_repo): @@ -273,11 +276,15 @@ def clone_bench_repo(args): repo_url = args.repo_url or 'https://github.com/frappe/bench' if os.path.exists(tmp_bench_repo): + log('Not cloning already existing Bench repository at {tmp_bench_repo}'.format(tmp_bench_repo=tmp_bench_repo)) return 0 elif args.without_bench_setup: clone_path = os.path.join(os.path.expanduser('~'), 'bench') + log('--without-bench-setup specified, clone path is: {clone_path}'.format(clone_path=clone_path)) else: clone_path = tmp_bench_repo + # Not logging repo_url to avoid accidental credential leak in case credential is embedded in URL + log('Cloning bench repository branch {branch} into {clone_path}'.format(branch=branch, clone_path=clone_path)) success = run_os_command( {'git': 'git clone --quiet {repo_url} {bench_repo} --depth 1 --branch {branch}'.format( @@ -336,6 +343,8 @@ def get_passwords(args): passwords_didnt_match("Administrator") admin_password = '' continue + elif args.without_site: + log("Not creating a new site due to --without-site") pass_set = False else: @@ -405,8 +414,8 @@ def parse_commandline_args(): args_group.add_argument('--develop', dest='develop', action='store_true', default=False, help='Install developer setup') args_group.add_argument('--production', dest='production', action='store_true', default=False, help='Setup Production environment for bench') - parser.add_argument('--site', dest='site', action='store', default='site1.local', help='Specifiy name for your first ERPNext site') - parser.add_argument('--without-site', dest='without_site', action='store_true', default=False) + parser.add_argument('--site', dest='site', action='store', default='site1.local', help='Specify name for your first ERPNext site') + parser.add_argument('--without-site', dest='without_site', action='store_true', default=False, help='Do not create a new site') parser.add_argument('--verbose', dest='verbose', action='store_true', default=False, help='Run the script in verbose mode') parser.add_argument('--user', dest='user', help='Install frappe-bench for this user') parser.add_argument('--bench-branch', dest='bench_branch', help='Clone a particular branch of bench repository') From d6d1b91a79b3b74a5595a2b943041659ff5928bd Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Sat, 3 Oct 2020 14:33:12 +0700 Subject: [PATCH 32/37] fix(playbooks): Support wkhtmltox arm64 architecture For Ubuntu 20.04 LTS and later --- bench/playbooks/roles/wkhtmltopdf/tasks/main.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml b/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml index aea2f55f..a2c6086d 100644 --- a/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml +++ b/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml @@ -20,11 +20,17 @@ force: yes when: ansible_os_family == 'Debian' -- name: download wkthmltox Ubuntu 20 +- name: download wkthmltox Ubuntu 20 amd64 get_url: url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb dest: /tmp/wkhtmltox.deb - when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' + when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' and ansible_architecture == 'x86_64' +- name: download wkthmltox Ubuntu 20 arm64 + get_url: + # wkhtmltox supports arm64 starting from 0.12.6 + url: https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_arm64.deb + dest: /tmp/wkhtmltox.deb + when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' and ansible_architecture == 'aarch64' - name: download wkthmltox Ubuntu 18 get_url: From 6ef6e37b80fd08ff45d6ae0171646b07c38b5641 Mon Sep 17 00:00:00 2001 From: Hendy Irawan Date: Fri, 30 Oct 2020 18:00:26 +0700 Subject: [PATCH 33/37] style: Apply suggestions from code review Co-authored-by: gavin --- bench/playbooks/roles/wkhtmltopdf/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml b/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml index a2c6086d..2a6a89ea 100644 --- a/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml +++ b/bench/playbooks/roles/wkhtmltopdf/tasks/main.yml @@ -20,11 +20,12 @@ force: yes when: ansible_os_family == 'Debian' -- name: download wkthmltox Ubuntu 20 amd64 +- name: download wkthmltox Ubuntu 20 get_url: url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb dest: /tmp/wkhtmltox.deb - when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' and ansible_architecture == 'x86_64' + when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' and ansible_architecture != 'aarch64' + - name: download wkthmltox Ubuntu 20 arm64 get_url: # wkhtmltox supports arm64 starting from 0.12.6 From 54e6bcfe9c967137e0be00cefe93a5ddaec30056 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 30 Oct 2020 17:22:02 +0530 Subject: [PATCH 34/37] fix: Run compileall in bench after update --- bench/commands/update.py | 5 +++-- bench/utils.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bench/commands/update.py b/bench/commands/update.py index dee57d28..e1113b40 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -15,11 +15,12 @@ from bench.utils import post_upgrade, patch_sites, build_assets @click.option('--restart-supervisor', is_flag=True, help="Restart supervisor processes after update") @click.option('--restart-systemd', is_flag=True, help="Restart systemd units after update") @click.option('--no-backup', is_flag=True, help="If this flag is set, sites won't be backed up prior to updates. Note: This is not recommended in production.") +@click.option('--no-compile', is_flag=True, help="If set, Python bytecode won't be compiled before restarting the processes") @click.option('--force', is_flag=True, help="Forces major version upgrades") @click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull") -def update(pull, apps, patch, build, requirements, restart_supervisor, restart_systemd, no_backup, force, reset): +def update(pull, apps, patch, build, requirements, restart_supervisor, restart_systemd, no_backup, no_compile, force, reset): from bench.utils import update - update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, force=force, reset=reset) + update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, compile=not no_compile, force=force, reset=reset) @click.command('retry-upgrade', help="Retry a failed upgrade") diff --git a/bench/utils.py b/bench/utils.py index 8e76903f..bb1b55e4 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- # imports - standard imports +import compileall import errno import glob import grp @@ -183,8 +184,8 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False, copy_patches_txt(path) -def update(pull=False, apps=None, patch=False, build=False, requirements=False, backup=True, force=False, reset=False, - restart_supervisor=False, restart_systemd=False): +def update(pull=False, apps=None, patch=False, build=False, requirements=False, backup=True, compile=True, + force=False, reset=False, restart_supervisor=False, restart_systemd=False): """command: bench update""" from bench import patches from bench.app import is_version_upgrade, pull_apps, validate_branch @@ -218,7 +219,6 @@ def update(pull=False, apps=None, patch=False, build=False, requirements=False, if version_upgrade[0] or (not version_upgrade[0] and force): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) - conf.update({ "maintenance_mode": 1, "pause_scheduler": 1 }) update_config(conf, bench_path=bench_path) @@ -246,6 +246,10 @@ def update(pull=False, apps=None, patch=False, build=False, requirements=False, if version_upgrade[0] or (not version_upgrade[0] and force): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) + if pull and compile: + print("Compiling Python files...") + compileall.compile_dir('../apps', quiet=1, rx=re.compile('.*node_modules.*')) + if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) @@ -481,7 +485,7 @@ def start(no_dev=False, concurrency=None, procfile=None, no_prefix=False): if no_prefix: command.extend(['--no-prefix']) - + os.execv(program, command) From aae7ec4ca65d95d0033e9f4a264e14128f98af22 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Tue, 24 Nov 2020 15:46:51 +0530 Subject: [PATCH 35/37] chore: Remove extra whitespaces --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index d4f963f5..69b9a3a4 100644 --- a/install.py +++ b/install.py @@ -156,7 +156,7 @@ def install_prerequisites(): 'sudo yum install -y epel-release redhat-lsb-core git python-setuptools python-devel openssl-devel libffi-devel' ] }) - + # until psycopg2-binary is available for aarch64 (Arm 64-bit), we'll need libpq and libssl dev packages to build psycopg2 from source if platform.machine() == 'aarch64': log("Installing libpq and libssl dev packages to build psycopg2 for aarch64...") From e9c046d56b15e39630490bc64ebaaa6727623186 Mon Sep 17 00:00:00 2001 From: Samuel Danieli <23150094+scdanieli@users.noreply.github.com> Date: Tue, 1 Dec 2020 16:04:57 +0100 Subject: [PATCH 36/37] fix: wrong flag description --- bench/commands/make.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/commands/make.py b/bench/commands/make.py index 7fc799e6..2f9f8ac0 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -11,8 +11,8 @@ import click @click.option('--frappe-branch', default=None, help="path to frappe repo") @click.option('--clone-from', default=None, help="copy repos from path") @click.option('--clone-without-update', is_flag=True, help="copy repos from path without update") -@click.option('--no-procfile', is_flag=True, help="Pull changes in all the apps in bench") -@click.option('--no-backups',is_flag=True, help="Run migrations for all sites in the bench") +@click.option('--no-procfile', is_flag=True, help="Do not create a Procfile") +@click.option('--no-backups',is_flag=True, help="Do not set up automatic backup creation for every (new) site") @click.option('--skip-redis-config-generation', is_flag=True, help="Skip redis config generation if already specifying the common-site-config file") @click.option('--skip-assets',is_flag=True, default=False, help="Do not build assets") @click.option('--verbose',is_flag=True, help="Verbose output during install") From 9de383a760a604a73509d72c230f59e5a0fac11e Mon Sep 17 00:00:00 2001 From: Samuel Danieli <23150094+scdanieli@users.noreply.github.com> Date: Wed, 2 Dec 2020 12:01:25 +0100 Subject: [PATCH 37/37] feat: better flag description Co-authored-by: gavin --- bench/commands/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/commands/make.py b/bench/commands/make.py index 2f9f8ac0..554b0603 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -12,7 +12,7 @@ import click @click.option('--clone-from', default=None, help="copy repos from path") @click.option('--clone-without-update', is_flag=True, help="copy repos from path without update") @click.option('--no-procfile', is_flag=True, help="Do not create a Procfile") -@click.option('--no-backups',is_flag=True, help="Do not set up automatic backup creation for every (new) site") +@click.option('--no-backups',is_flag=True, help="Do not set up automatic periodic backups for all sites on this bench") @click.option('--skip-redis-config-generation', is_flag=True, help="Skip redis config generation if already specifying the common-site-config file") @click.option('--skip-assets',is_flag=True, default=False, help="Do not build assets") @click.option('--verbose',is_flag=True, help="Verbose output during install")