2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-24 04:59:01 +00:00

Merge branch 'develop' into update-supervisord-conf

This commit is contained in:
Gavin D'souza 2020-07-07 16:33:03 +05:30
commit fa6519c901
8 changed files with 36 additions and 7 deletions

View File

@ -108,7 +108,7 @@ def get_app(git_url, branch=None, bench_path='.', skip_assets=False, verbose=Fal
sys.exit(1) sys.exit(1)
# Gets repo name from URL # Gets repo name from URL
repo_name = git_url.rsplit('/', 1)[1].rsplit('.', 1)[0] repo_name = git_url.rstrip('/').rsplit('/', 1)[1].rsplit('.', 1)[0]
shallow_clone = '--depth 1' if check_git_for_shallow_clone() else '' shallow_clone = '--depth 1' if check_git_for_shallow_clone() else ''
branch = '--branch {branch}'.format(branch=branch) if branch else '' branch = '--branch {branch}'.format(branch=branch) if branch else ''
else: else:

View File

@ -32,8 +32,8 @@ def cli():
change_dir() change_dir()
change_uid() change_uid()
if is_dist_editable(bench.PROJECT_NAME) and len(sys.argv) > 1 and sys.argv[1] != "src": if is_dist_editable(bench.PROJECT_NAME) and len(sys.argv) > 1 and sys.argv[1] != "src" and not get_config(".").get("developer_mode"):
print("\033[93mWARN: 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`\033[0m\n") 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)
if not is_bench_directory() and not cmd_requires_root() and len(sys.argv) > 1 and sys.argv[1] not in ("init", "find", "src"): if not is_bench_directory() and not cmd_requires_root() and len(sys.argv) > 1 and sys.argv[1] not in ("init", "find", "src"):
log("Command not being executed in bench directory", level=3) log("Command not being executed in bench directory", level=3)

View File

@ -5,3 +5,4 @@ bench.patches.v4.update_node
bench.patches.v4.update_socketio bench.patches.v4.update_socketio
bench.patches.v4.install_yarn #2 bench.patches.v4.install_yarn #2
bench.patches.v5.fix_user_permissions bench.patches.v5.fix_user_permissions
bench.patches.v5.fix_backup_cronjob

View File

@ -0,0 +1,15 @@
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 backup sites every minute per 6 hours
"""
user = get_config(bench_path=bench_path).get('frappe_user')
user_crontab = CronTab(user=user)
for job in user_crontab.find_comment("bench auto backups set for every 6 hours"):
job.every(6).hours()
user_crontab.write()

View File

@ -33,9 +33,9 @@
- name: install pdf prerequisites for Ubuntu >= 18.04 - name: install pdf prerequisites for Ubuntu >= 18.04
apt: apt:
pkg: pkg:
- libssl1.0-dev - libssl1.1
state: present state: present
force: yes force: yes
when: ansible_distribution_version is version_compare('18.04', 'ge') when: ansible_distribution_version is version_compare('18.04', 'ge')
... ...

View File

@ -20,6 +20,12 @@
force: yes force: yes
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
- 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'
- name: download wkthmltox Ubuntu 18 - name: download wkthmltox Ubuntu 18
get_url: get_url:
url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_{{ "amd64" if ansible_architecture == "x86_64" else "i386"}}.deb url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_{{ "amd64" if ansible_architecture == "x86_64" else "i386"}}.deb

View File

@ -70,9 +70,16 @@ def log(message, level=0):
2: color.red + 'ERROR', # fail 2: color.red + 'ERROR', # fail
3: color.yellow + 'WARN' # warn/suggest 3: color.yellow + 'WARN' # warn/suggest
} }
loggers = {
2: logger.error,
3: logger.warning
}
start_line = (levels.get(level) + ': ') if level in levels else '' start_line = (levels.get(level) + ': ') if level in levels else ''
level_logger = loggers.get(level, logger.info)
end_line = '\033[0m' end_line = '\033[0m'
level_logger(message)
print(start_line + message + end_line) print(start_line + message + end_line)
@ -393,7 +400,7 @@ def setup_backups(bench_path='.'):
if job_command not in str(system_crontab): if job_command not in str(system_crontab):
job = system_crontab.new(command=job_command, comment="bench auto backups set for every 6 hours") job = system_crontab.new(command=job_command, comment="bench auto backups set for every 6 hours")
job.hour.every(6) job.every(6).hours()
system_crontab.write() system_crontab.write()

View File

@ -88,4 +88,4 @@ TLDR; Save the logs!
3. A lot of things can go wrong in setting up the environment due to prior settings, company protocols or even breaking changes in system packages and their dependencies. 3. A lot of things can go wrong in setting up the environment due to prior settings, company protocols or even breaking changes in system packages and their dependencies.
4. Sharing your logfile in any issues opened related to this can help us find solutions to it faster and make the sript better! 4. Sharing your logfile in any issues opened related to this can help us find solutions to it faster and make the script better!