bench
bench copied to clipboard
group = "frappe:" cause an error to restart supervisor when bench didn't installed with frappe user.
Issue: Bug report
bench --version 5.14.3
Do the checklist before filing an issue:
- [x] Can you replicate the issue on the supported bench versions?
- [ ] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome
Describe the bug :chart_with_downwards_trend: As you see, frappe user is hard-coded which shouldn't be. This cause an error in restarting supervisor while installing apps and supervisor restarts that time. There are so many use cases where bench has to be installed with existing users, or other than frappe user.
Errors are: $ supervisorctl restart frappe: frappe: ERROR (no such group) frappe: ERROR (no such group)
Hard-coded at: https://github.com/frappe/bench/blob/fcbc2eaa470dbd083d1a1be75dc79d71916d0a80/bench/utils/bench.py#L302
To Reproduce :page_with_curl: Steps to reproduce the behavior:
- Install bench with another use than frappe.
- Install app. After successful installation of app, supervisor will restart, and cause error as follows:
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js
Done in 1.06s.
$ supervisorctl restart frappe:
frappe: ERROR (no such group)
frappe: ERROR (no such group)
ERROR:
Traceback (most recent call last):
File "/usr/local/bin/bench", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.8/dist-packages/bench/cli.py", line 127, in cli
bench_command()
File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/bench/commands/make.py", line 159, in get_app
get_app(
File "/usr/local/lib/python3.8/dist-packages/bench/app.py", line 432, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File "/usr/local/lib/python3.8/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/bench/app.py", line 230, in install
install_app(
File "/usr/local/lib/python3.8/dist-packages/bench/app.py", line 577, in install_app
bench.reload()
File "/usr/local/lib/python3.8/dist-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 150, in reload
restart_supervisor_processes(bench_path=self.name, web_workers=web)
File "/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py", line 304, in restart_supervisor_processes
bench.run(f"{sudo}supervisorctl restart {group}")
File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 47, in run
return exec_cmd(cmd, cwd=cwd or self.cwd)
File "/usr/local/lib/python3.8/dist-packages/bench/utils/__init__.py", line 155, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError
OS (please complete the following information): :cyclone:
- [x] Linux:
ubuntu:20.04.5
- [ ] macOS:
version
- [ ] Windows
version
- [ ] Others?
haros:distro:version
Version Information
Can be found out by running bench version
in your respective bench folder.
- Bench Branch: v5.14.3
- Frappe Version: v13.40.0
Additional context :page_facing_up: This issue was reported earlier, there are workaround suggested, but didn't worked for me:
- https://discuss.erpnext.com/t/error-bench-restart-when-bench-setup-production-supervisorctl-restart-frappe-frappe-error-no-such-group-frappe-error-no-such-group-error/93481/2
Possible Solution :bookmark_tabs: This should dynamically fetch user and need to work as intended.
i spent the whole weekend debuging this , and no success i hope there is a fix
If you're facing this issue, simply downgrade bench to 5.12.0 using this command: sudo pip3 install frappe-bench==5.12.0
. It worked for me.
Happened with me as well, the issue was because symlink wasn't created correctly. Run the commnds in this section to solve it: https://frappeframework.com/docs/v14/user/en/bench/guides/setup-production#supervisor
You just re-execute your command production " sudo bench setup production {user-name} " this is work every time ^^
same error
same error which version do you have?
I think, I have the same error...
bench --version = 5.16.1
I write this command bench restart
15ITL6:~/frappe-bench$ bench restart $ supervisorctl restart frappe: frappe: ERROR (no such group) frappe: ERROR (no such group) ERROR: Traceback (most recent call last): File "/home/moqam/.local/bin/bench", line 8, in
sys.exit(cli()) File "/home/moqam/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli bench_command() File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in call return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/moqam/.local/lib/python3.10/site-packages/bench/commands/utils.py", line 41, in restart Bench(".").reload(web, supervisor, systemd) File "/home/moqam/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn return fn(*args, **kwargs) File "/home/moqam/.local/lib/python3.10/site-packages/bench/bench.py", line 151, in reload restart_supervisor_processes(bench_path=self.name, web_workers=web, _raise=_raise) File "/home/moqam/.local/lib/python3.10/site-packages/bench/utils/bench.py", line 315, in restart_supervisor_processes failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise) File "/home/moqam/.local/lib/python3.10/site-packages/bench/bench.py", line 48, in run return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise) File "/home/moqam/.local/lib/python3.10/site-packages/bench/utils/init.py", line 158, in exec_cmd raise CommandFailedError bench.exceptions.CommandFailedError INFO: A newer version of bench is available: 5.16.1 → 5.16.2
in supervisord.conf
[unix_http_server] file=/var/run/supervisor.sock ; (the path to the socket file) chmod=0770 ; sockef file mode (default 0700) chown=frappe:frappe chown=user:supervisor
sudo pip3 install frappe-bench==5.12.0
.
downgrade the bench version to version 5.10 by using the command sudo pip3 install frappe-bench==5.10.0 then rewrite the command of production mode
Happened with me as well, the issue was because symlink wasn't created correctly. Run the commnds in this section to solve it: https://frappeframework.com/docs/v14/user/en/bench/guides/setup-production#supervisor
Can confirm it was the same issue for me.
For some reason running the following commands on Ubuntu 22.04
bench setup supervisor
sudo ln -s "pwd"/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
did not make the correct symlink and the file at destination /etc/supervisor/conf.d/frappe-bench.conf
was empty
To solve this:
- Manually created a file at
/etc/supervisor/conf.d/
usingsudo nano /etc/supervisor/conf.d/frappe-bench.conf
- Manually copied the contents of
frappe-bench/config/supervisor.conf
into/etc/supervisor/conf.d/frappe-bench.conf
- The do
sudo service supervisor restart
to restart supervisor will all the required processes of frappe
Check everything is working fine using sudo service supervisor status
and you should see list of frappe processes running
sudo vim /etc/supervisor/supervisord.conf
To modify lines of chmod and chown as below:
chmod = 0760 chown = frappe:frappe
Then: bench setup systemd
**### right way is 👍 ** when I run $bench get-app --branch version-mac erpnext https://xxxxxxxxx under your erp user: not root. $ sudo vi /etc/supervisor/supervisord.conf
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
chown=wwerp:wwerp ; chown=your_erp_user:your_erp_user
[group:frappe]
$ sudo service supervisor restart
and retry your: $ bench get-app --branch version-mac erpnext https://xxxxxxxxx
I usually do what others have suggested above, but this also just worked for me:
sudo bench setup production <OS username>