diff --git a/frappe/commands/scheduler.py b/frappe/commands/scheduler.py old mode 100644 new mode 100755 index c6d90ff40f..3b2e81c44b --- a/frappe/commands/scheduler.py +++ b/frappe/commands/scheduler.py @@ -125,11 +125,14 @@ def doctor(site=None): @pass_context def show_pending_jobs(context, site=None): "Get diagnostic info about background jobs" + from frappe.utils.doctor import pending_jobs as _pending_jobs if not site: site = get_site(context) - from frappe.utils.doctor import pending_jobs as _pending_jobs - return _pending_jobs(site=site) + with frappe.init_site(site): + pending_jobs = _pending_jobs(site=site) + + return pending_jobs @click.command('purge-jobs') @click.option('--site', help='site name') diff --git a/frappe/docs/user/en/bench/guides/adding-custom-domains.md b/frappe/docs/user/en/bench/guides/adding-custom-domains.md new file mode 100755 index 0000000000..15a54bf7a8 --- /dev/null +++ b/frappe/docs/user/en/bench/guides/adding-custom-domains.md @@ -0,0 +1,28 @@ +# Adding Custom Domains to your Site + +You can add **multiple custom domains** for your site, just run: + + bench setup add-domain [desired-domain] + +On running the command you will be asked for which site you want to set the custom domain for. + +You can also setup SSL for your custom domain by using the options: + + --ssl-certificate [path-to-certificate] + --ssl-certificate-key [path-to-certificate-key] + +Example: + + bench setup add-domain custom.erpnext.com --ssl-certificate /etc/letsencrypt/live/erpnext.cert --ssl-certificate-key /etc/letsencrypt/live/erpnext.key + +Domain configuration is stored in the respective site's site_config.json + + "domains": [ + { + "ssl_certificate": "/etc/letsencrypt/live/erpnext.cert", + "domain": "erpnext.com", + "ssl_certificate_key": "/etc/letsencrypt/live/erpnext.key" + } + ], + +**You will need to regenerate the nginx configuration by runnning `bench setup nginx` and reload the nginx service put your custom domain in effect** \ No newline at end of file diff --git a/frappe/docs/user/en/bench/guides/diagnosing-the-scheduler.md b/frappe/docs/user/en/bench/guides/diagnosing-the-scheduler.md index 0b7e70e238..a0661dbb17 100755 --- a/frappe/docs/user/en/bench/guides/diagnosing-the-scheduler.md +++ b/frappe/docs/user/en/bench/guides/diagnosing-the-scheduler.md @@ -5,55 +5,27 @@ If you're experiencing delays in scheduled jobs or they don't seem to run, you c ### `bench doctor` This will output the following in order: -- Worker Status - Scheduler Status per site +- Number of Workers - Pending Tasks -- Timed out locks + Desirable output: - Workers online: True - Pending tasks 0 - Timed out locks: + Workers online: 0 + -----None Jobs----- - -### `bench celery-doctor` +### `bench --site [site-name] show-pending-jobs` This will output the following in order: -- Queue Status -- Running Tasks +- Queue +- Tasks within Queue Desirable output: - Queue Status - ------------ - [ - { - "total": 0 - } - ] - - Running Tasks - ------------ - { - "async@erpnext": [], - "longjobs@erpnext": [], - "jobs@erpnext": [] - } + -----Pending Jobs----- -### `bench dump-queue-status` - -This will output detailed diagnostic information for task queues in JSON - -Desirable output: - - - [ - { - "total": 0 - } - ] - Pending Tasks Queue - -------------------- +### `bench purge-jobs` +This will remove all pending jobs from all queues \ No newline at end of file diff --git a/frappe/docs/user/en/bench/guides/how-to-change-host-name-from-localhost.md b/frappe/docs/user/en/bench/guides/how-to-change-host-name-from-localhost.md deleted file mode 100755 index 39d0008ec8..0000000000 --- a/frappe/docs/user/en/bench/guides/how-to-change-host-name-from-localhost.md +++ /dev/null @@ -1,18 +0,0 @@ -While using a virtual machine, links within emails will be point to your host, e.g. localhost, like **http://localhost/set-password** etc. - -Frappe will automatically extract the host name from the incoming request, or from the `host_name` property from `site_config`. - -### bench set-config - -To fix this, you can use **bench set-config** to set your public IP or domain name as the host name. - -#### Example: - - bench --site mysite.com set-config host_name mysite.com - ---- - -Or edit the `frappe-bench/sites/mysite.com/site_config.json` and add a `host_name` property. - - - \ No newline at end of file diff --git a/frappe/docs/user/en/bench/guides/lets-encrypt-ssl-setup.md b/frappe/docs/user/en/bench/guides/lets-encrypt-ssl-setup.md index 916361c28f..c0bb85c943 100755 --- a/frappe/docs/user/en/bench/guides/lets-encrypt-ssl-setup.md +++ b/frappe/docs/user/en/bench/guides/lets-encrypt-ssl-setup.md @@ -16,6 +16,14 @@ Just run: You will be faced with several prompts, respond to them accordingly. This command will also add an entry to the crontab of the user that will attempt to renew the certificate every month. +### Custom Domains + +You can setup Let's Encrypt for [custom domains](adding-custom-domains.html) as well. Just use the `--custom-domain` option + + sudo -H bench setup lets-encrypt [site-name] --custom-domain [custom-domain] + +### Renew Certificates + To renew certificates manually you can use: sudo bench renew-lets-encrypt diff --git a/frappe/docs/user/en/bench/guides/stop-production-and-start-development.md b/frappe/docs/user/en/bench/guides/stop-production-and-start-development.md deleted file mode 100644 index 7a27ad70f2..0000000000 --- a/frappe/docs/user/en/bench/guides/stop-production-and-start-development.md +++ /dev/null @@ -1,20 +0,0 @@ -Moving back to a Development setup is pretty easy - -Change directory to your bench directory - - cd frappe-bench - -Remove supervisor and nginx configs - - rm config/supervisor.conf - rm config/nginx.conf - -Stop running services - - sudo service nginx stop - sudo service supervisord stop - -Setup procfile again and start bench - - bench setup procfile - bench start diff --git a/frappe/docs/user/en/bench/resources/background-services.md b/frappe/docs/user/en/bench/resources/background-services.md index a4fe1c4702..d019d25d8c 100755 --- a/frappe/docs/user/en/bench/resources/background-services.md +++ b/frappe/docs/user/en/bench/resources/background-services.md @@ -17,14 +17,14 @@ Frappe Processes Werkzeug WSGI server is used and in production, gunicorn (automatically configured in supervisor) is used. -* Celery Worker Processes +* Redis Worker Processes * The Celery worker processes execute background jobs in the Frappe system. These processes are automatically started when `bench start` is run and for production are configured in supervisor configuration. -* Celery Worker Beat Process +* Scheduler Process - * The Celery worker beat process schedules enqeueing of scheduled jobs in the + * The Scheduler process schedules enqeueing of scheduled jobs in the Frappe system. This process is automatically started when `bench start` is run and for production are configured in supervisor configuration. \ No newline at end of file diff --git a/frappe/docs/user/en/bench/resources/bench-commands-cheatsheet.md b/frappe/docs/user/en/bench/resources/bench-commands-cheatsheet.md old mode 100644 new mode 100755 index 172640688d..8dc304cdd6 --- a/frappe/docs/user/en/bench/resources/bench-commands-cheatsheet.md +++ b/frappe/docs/user/en/bench/resources/bench-commands-cheatsheet.md @@ -1,6 +1,9 @@ ### General Usage +* `bench --version` - Show bench version +* `bench src` - Show bench repo directory * `bench --help` - Show all commands and help * `bench [command] --help` - Show help for command +* `bench init [bench-name]` - Create a new bench (Run from home dir) * `bench --site [site-name] COMMAND` - Specify site for command * `bench update` - Pulls changes for bench-repo and all apps, applies patches, builds JS and CSS, and then migrates. * `--pull` Pull changes in all the apps in bench @@ -11,10 +14,13 @@ * `--restart-supervisor` restart supervisor processes after update * `--upgrade` Does major upgrade (Eg. ERPNext 6 -> 7) * `--no-backup` Don't take a backup before update +* `bench restart` Restart all bench services * `bench backup` Backup * `bench backup-all-sites` Backup all sites * `--with-files` Backup site with files * `bench restore` Restore + * `--with-private-files` Restore site with private files (Path to tar file) + * `--with-public-files` Restore site with public files (Path to tar file) * `bench migrate` Will read JSON files and make changes to the database accordingly ###Config @@ -37,14 +43,16 @@ * `socketio ` Setup node deps for socketio server * `sudoers ` Add commands to sudoers list for execution... * `supervisor ` generate config for supervisor + * `add-domain ` add custom domain for site ###Development * `bench new-app [app-name]` Creates a new app -* `bench get-app [app-name] [repo-link]` - Downloads an app from an online git repository and installs it +* `bench get-app [repo-link]` - Downloads an app from a git repository and installs it * `bench install-app [app-name]` Installs existing app * `bench remove-from-installed-apps [app-name]` Remove app from the list of apps * `bench uninstall-app [app-name]` Delete app and everything linked to the app +* `bench remove-app [app-name]` Remove app from the bench entirely * `bench new-site [sitename]` - Creates a new site * `--db-name` Database name * `--mariadb-root-username` Root username for MariaDB @@ -68,7 +76,7 @@ * `--test` Specific Test * `--module` Run a particular module that has tests * `--profile` Runs a Python profiler on the test - +* `bench disable-production` - Disables production environment ###Scheduler diff --git a/frappe/docs/user/en/bench/resources/bench-procfile.md b/frappe/docs/user/en/bench/resources/bench-procfile.md index 196240556f..61ecfc6eec 100755 --- a/frappe/docs/user/en/bench/resources/bench-procfile.md +++ b/frappe/docs/user/en/bench/resources/bench-procfile.md @@ -5,12 +5,13 @@ The various process that are needed to run frappe are: 1. `bench start` - the web server -2. celery task queue for background workers (scheduled jobs and other async tasks) -3. celery worker beat to trigger periodic tasks -4. `redis` for caching (general) -5. `redis` for managing queue for background workers -6. `redis` as a message broker for real-time updates / updates from background workers -7. `node` to run `socketio` for real-time messaging. +4. `redis_cache` for caching (general) +5. `redis_queue` for managing queue for background workers +6. `redis_socketio` as a message broker for real-time updates / updates from background workers +7. `web` for the frappe web server. +7. `socketio` for real-time messaging. +3. `schedule` to trigger periodic tasks +3. `worker_*` redis workers to handle async jobs Optionally if you are developing for frappe you can add: @@ -18,11 +19,13 @@ Optionally if you are developing for frappe you can add: ### Sample - web: bench --site test.erpnext.com serve --port 8001 - redis_async_broker: redis-server config/redis_async_broker.conf - socketio: node apps/frappe/socketio.js - workerbeat: sh -c 'cd sites && exec ../env/bin/python -m frappe.celery_app beat -s scheduler.schedule' - worker: sh -c 'cd sites && exec ../env/bin/python -m frappe.celery_app worker' redis_cache: redis-server config/redis_cache.conf - redis: redis-server - watch: bench watch \ No newline at end of file + redis_socketio: redis-server config/redis_socketio.conf + redis_queue: redis-server config/redis_queue.conf + web: bench serve --port 8000 + socketio: /usr/bin/node apps/frappe/socketio.js + watch: bench watch + schedule: bench schedule + worker_short: bench worker --queue short + worker_long: bench worker --queue long + worker_default: bench worker --queue default