Bench Manager - [beta]

Check if there is bench_manager in apps.txt in sites folder and remove it

@Mohammed_Redha thanks for the quick tip. I followed your instruction and not only is my site back up, i was able to complete the bench manager installation. I am however faced with the same problem as above when i run the bench update from /home/frappe/frappe-bench directory. i get the following error after running the process:

INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)

Cannot proceed with update: You have local changes in app “frappe” that are not committed.

Here are your choices:

  1. Merge the frappe app manually with “git pull” / “git pull --rebase” and fix conflicts.
  2. Temporarily remove your changes with “git stash” or discard them completely
    with “bench update --reset” or for individual repositries “git reset --hard”
  3. If your changes are helpful for others, send in a pull request via GitHub and
    wait for them to be merged in the core.

you can give ma a quick advise on what to do here.

try this:

admin@erpnext:/home/frappe/frappe-bench$ cd apps/frappe
admin@erpnext:/home/frappe/frappe-bench/apps/frappe$ git checkout .
admin@erpnext:/home/frappe/frappe-bench/apps/frappe$ cd ..
admin@erpnext:/home/frappe/frappe-bench/apps$ cd ..
admin@erpnext:/home/frappe/frappe-bench$sudo bench update

@Mohammed_Redha now it’s saying i have local changes in app erpnext that are not committed. do i run the same process in the erpnext directory?

If you want to save these changes you have to commit.

If it is not, do same process in the erpnext directory

@Mohammed_Redha i ran the same commands in the erpnext directory. Mind you, git checkout failed to work initially. i had to run the following commands in both frappe and erpnext directories:
$ git pull
$ git stash
$ git pull --rebase
before i could run
$ git checkout

i ran the “$ sudo bench update” command and got this error after a few processes completed:

INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream master
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream master
    error: cannot open .git/FETCH_HEAD: Permission denied

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/update.py”, line 62, in update
_update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
File “/home/frappe/.bench/bench/commands/update.py”, line 79, in _update
pull_all_apps(bench_path=bench_path, reset=reset)
File “/home/frappe/.bench/bench/app.py”, line 170, in pull_all_apps
remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)
File “/home/frappe/.bench/bench/utils.py”, line 140, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull upstream master

The main issue is from this :

So you have to be the owner of this directory

Try This:

/frappe-bench$ sudo chown $USER -R ~/frappe-bench

@Mohammed_Redha now it’s giving me permission error on /bench/logs/bench.log.

how can i seize ownership of all folders, directories and files in the entire system for the default user which is “ubuntu”?

I don’t think this is a good idea.

Just do it for bench directory and see

@Mohammed_Redha still no luck. Here’s the full error:

ubuntu@ip-172-31-37-46:/home/frappe/frappe-bench$ sudo bench update
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1063, in invoke
Command.invoke(self, ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/init.py”, line 21, in bench_command
setup_logging(bench_path=bench_path)
File “/home/frappe/.bench/bench/utils.py”, line 294, in setup_logging
hdlr = logging.FileHandler(log_file)
File “/usr/lib/python2.7/logging/init.py”, line 913, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python2.7/logging/init.py”, line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log

Make sure you are the owner of that file:

@Mohammed_Redha my instance is in the cloud and so i don’t have GUI interface access. I have run chown command on log file located in /home/frappe/frappe-bench/logs/bench.log but it is still throwing the permission denied error

Try to check and change it with command line

@Mohammed_Redha i’ve used the command line and it appears the command works because i don’t see any error after running the chown command. It is still giving me permission denied when i run the bench update though

Show me the complete error, please

@Mohammed_Redha this is the full error:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1063, in invoke
Command.invoke(self, ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/init.py”, line 21, in bench_command
setup_logging(bench_path=bench_path)
File “/home/frappe/.bench/bench/utils.py”, line 294, in setup_logging
hdlr = logging.FileHandler(log_file)
File “/usr/lib/python2.7/logging/init.py”, line 913, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python2.7/logging/init.py”, line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log

could you run this in log directory:

ls -l

and see if you have the ownership?

@Mohammed_Redha

this is the result:

ubuntu@ip-172-31-37-46:/home/frappe/frappe-bench/logs$ ls -l
total 32032
-rw-rw-r-- 1 ubuntu frappe 189 Sep 14 10:00 auto_update_log.log
-rwxr-xr-x 1 ubuntu frappe 3741 Sep 14 13:47 bench.log
-rw-r–r-- 1 ubuntu frappe 28232 Sep 14 15:22 frappe.log
-rw-r–r-- 1 ubuntu frappe 99864 Sep 14 05:37 frappe.log.1

Very strange!!!

Final try :sweat_smile:

Delete all logs in log directory and try again

@Mohammed_Redha now this is really weird!!! I deleted all the logs in the log directory and checked checked the directory using ls -a to be sure there are no files in there. I ran sudo bench update and still had the permission error for bench.log

ubuntu@ip-172-31-37-46:/home/frappe/frappe-bench/logs$ sudo rm *
ubuntu@ip-172-31-37-46:/home/frappe/frappe-bench/logs$ ls -a
. …
ubuntu@ip-172-31-37-46:/home/frappe/frappe-bench/logs$ cd …
ubuntu@ip-172-31-37-46:/home/frappe/frappe-bench$ sudo bench update
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1063, in invoke
Command.invoke(self, ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/init.py”, line 21, in bench_command
setup_logging(bench_path=bench_path)
File “/home/frappe/.bench/bench/utils.py”, line 294, in setup_logging
hdlr = logging.FileHandler(log_file)
File “/usr/lib/python2.7/logging/init.py”, line 913, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python2.7/logging/init.py”, line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log

i have gone back into the log directory and there’s not a single log file in there.