Unable to setup production on Mac OSX High Sierra permission issues

Hi I am unable to setup prodution mode on OSX High Sierra.

getting user error. any clue how to fix it

Kashifs-MacBook-Air:frappe-bench kashifbashir$ sudo bench setup production KashifBashir
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site tradelink assigned port: 80
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/kashifbashir/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/Library/Python/2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/kashifbashir/bench-repo/bench/commands/setup.py", line 57, in setup_production
    setup_production(user=user, yes=yes)
  File "/Users/kashifbashir/bench-repo/bench/config/production_setup.py", line 9, in setup_production
    fix_prod_setup_perms(bench_path, frappe_user=user)
  File "/Users/kashifbashir/bench-repo/bench/utils.py", line 527, in fix_prod_setup_perms
    gid = grp.getgrnam(frappe_user).gr_gid
KeyError: 'getgrnam(): name not found: KashifBashir'

Delvepoer mode works fine but not able to setup production mode and try to setup supervisor that also failed

Kashifs-MacBook-Air:frappe-bench kashifbashir$ bench setup supervisor
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/kashifbashir/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/Library/Python/2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/kashifbashir/bench-repo/bench/commands/setup.py", line 35, in setup_supervisor
    generate_supervisor_config(bench_path=".", user=user, yes=yes)
  File "/Users/kashifbashir/bench-repo/bench/config/supervisor.py", line 41, in generate_supervisor_config
    with open(conf_path, 'w') as f:
IOError: [Errno 13] Permission denied: './config/supervisor.conf'
Kashifs-MacBook-Air:frappe-bench kashifbashir$ 

and also bench restart error with connection refused

Kashifs-MacBook-Air:frappe-bench kashifbashir$ bench restart
INFO:bench.utils:sudo supervisorctl restart frappe:
http://localhost:9001 refused connection

Please help me to fix it.

I’m using:

Works fine, try it instead of installing directly in mac osx

IOError: [Errno 13] Permission denied: ‘./config/supervisor.conf’

There’s this - you installed as non-root user for eg frappe user account and run as that?

edit: Your file system group and file ownership permissions are the issue?

For eg frappe user and group, like this working setup:

frappe@erpnext:~/frappe-bench$ ls -al …/bench-repo/
total 104
drwxrwxr-x 9 frappe frappe 4096 Sep 5 21:25 .
drwxr-xr-x 14 frappe frappe 4096 Nov 16 16:44 …
drwxrwxr-x 6 frappe frappe 4096 Oct 13 19:28 bench
drwxr-xr-x 2 root root 4096 Oct 12 2016 bench.egg-info
-rw-rw-r-- 1 frappe frappe 650 Oct 12 2016 completion.sh
drwxrwxr-x 2 frappe frappe 4096 Oct 13 19:28 docs
drwxrwxr-x 8 frappe frappe 4096 Nov 5 11:23 .git
-rw-rw-r-- 1 frappe frappe 58 Oct 12 2016 .gitignore
drwxrwxr-x 2 frappe frappe 4096 Oct 12 2016 install_scripts
-rw-rw-r-- 1 frappe frappe 35121 Oct 12 2016 LICENSE.md
-rw-rw-r-- 1 frappe frappe 116 Oct 12 2016 MANIFEST.in
drwxrwxr-x 5 frappe frappe 4096 Oct 13 19:28 playbooks
-rwxrwxr-x 1 frappe frappe 6797 Sep 5 21:25 README.md
-rw-rw-r-- 1 frappe frappe 100 Oct 12 2016 requirements.txt
-rw-rw-r-- 1 frappe frappe 846 Oct 12 2016 setup.py
-rw-rw-r-- 1 frappe frappe 999 Sep 5 21:25 .travis.yml
drwxrwxr-x 4 frappe frappe 4096 Oct 12 2016 vm

frappe@erpnext:~/frappe-bench$ ls -al
total 68
drwxrwxr-x 11 frappe frappe 4096 Jun 23 14:19 .
drwxr-xr-x 14 frappe frappe 4096 Nov 16 16:44 …
drwxrwxr-x 6 frappe frappe 4096 Nov 23 2016 apps
drwxrwxr-x 3 frappe frappe 4096 Jan 15 2017 config

Able to fix permission and all other error now getting user error even after added new frappe user
any clue how to fix it.

developer working great but not able to setup prodution

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/kashifbashir/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/Library/Python/2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/kashifbashir/bench-repo/bench/commands/setup.py", line 57, in setup_production
    setup_production(user=user, yes=yes)
  File "/Users/kashifbashir/bench-repo/bench/config/production_setup.py", line 9, in setup_production
    fix_prod_setup_perms(bench_path, frappe_user=user)
  File "/Users/kashifbashir/bench-repo/bench/utils.py", line 527, in fix_prod_setup_perms
    gid = grp.getgrnam(frappe_user).gr_gid
KeyError: 'getgrnam(): name not found: frappe'

A group permission issue…

how can i do that

Search and learn - the experimental process!

Another Error woke up

 File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/kashifbashir/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/Library/Python/2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/kashifbashir/bench-repo/bench/commands/setup.py", line 57, in setup_production
    setup_production(user=user, yes=yes)
  File "/Users/kashifbashir/bench-repo/bench/config/production_setup.py", line 17, in setup_production
    bench_name=bench_name, extn=supervisor_conf_extn))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

I Guess this is because of supervisor because it is giving connection refuse error.

http://localhost:9001 refused connection

not know how to fix it.