Error while setting up bench to production mode

Hello everyone, i somehow managed to installed erpnext, and it’s working fine on local address, now i want to setup production mode, but when i tried it gives me error.
ERROR: bench setup role fail2ban

darklord@darklord:~/frappe-bench$ sudo bench setup production darklord
Setting Up prerequisites…
$ bench setup role fail2ban
ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1.
ERROR: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 1.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 132, 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 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 “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 370, in setup_roles
run_playbook(“site.yml”, extra_vars=extra_vars, tag=role)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 345, in run_playbook
subprocess.check_call(args, cwd=os.path.join(bench.path[0], “playbooks”))
File “/usr/lib/python3.10/subprocess.py”, line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 1.
ERROR: bench setup role fail2ban
subprocess.CalledProcessError: Command ‘bench setup role fail2ban’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 132, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 110, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 37, in setup_production
setup_production_prerequisites()
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 28, in setup_production_prerequisites
exec_cmd(“bench setup role fail2ban”)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 178, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench setup role fail2ban

darklord@darklord:~/frappe-bench$
Thanks

This is an issue with your environment. You can switch to a UTF-8 locale using the following guide:

@corentin
i tried and now dont know what to do here after writing this command.

sudo dpkg-reconfigure locales

which one to change and how ?
Thank You

I think you want to check en_US.UTF-8 at least, other locales can be added later if needed.

it’s already ticked

Oh okay, so this step is good. You can proceed with <Ok> (you can navigate to it quickly with the Tab key I believe).

i tried and then tried the production command but received the same error

Maybe reopen your terminal? The bench setup production won’t work unless your locale is en_US.UTF-8. You can check your currently active locale with the locale command.

Yeah it’s not good: you should have something like LANG=en_US.UTF-8 / LANG=en_IN.UTF-8.

Mayeb the extra steps could help?

image

after reboot i managed to run the command.

CAN YOU PLEASE SHARE THE NEXT PRODUCTION STEPS.

THANK YOU

Thanks the site is now accessible via ip address directly, do i need to configure anything else ?

Thank you

dear how did you fix the issue. I am still facing

reboot and try these Error while setting up bench to production mode - #10 by corentin

and if it’s not working let me know , you can try the script install it’s easy and working perfectly fine.

Thanks

I tried, still the issue

from where did you tried ?

1st remove all earlier data then

try this one - GitHub - flexcomng/erpnext_quick_install: Unattended install script for ERPNext Versions, 13, 14 and 15