ERPNext is not starting automatically even after production setup

I am using ERPNext 13.32.0 and Frappe 13.31.0.

I am successfully running ERPNext in development mode on port 8000.

I have successfully used the below command to set up the production mode

sudo bench setup production <erpnext_user>

The setup has ended successfully.

But I am facing a strange behavior,

on localhost it is giving “sorry we will be back soon” error, but if I do bench start like in the development environment, erpnext works on localhost:8000 and also on localhost.

Please help, thank you in anticipation.

@abubakar what’s the result of bench restart

Here is the response of bench restart

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 121, in cli
    raise e
  File "/usr/local/lib/python3.8/dist-packages/bench/cli.py", line 111, 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/utils.py", line 29, in restart
    Bench(".").reload(web, supervisor, systemd)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 142, 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 280, in restart_supervisor_processes
    bench.run(f"{sudo}supervisorctl restart {group}")
  File "/usr/local/lib/python3.8/dist-packages/bench/bench.py", line 43, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/__init__.py", line 126, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

@abubakar bench setup production was not a success . try again (sudo bench setup production user_name) , an share results.

Here are the results of sudo bench setup production user_name

should I share the results of doing setup production from scratch? I have the VM backup.


Site example.site.com assigned port: 80
Setting Up symlinks and reloading services...
$ /usr/bin/supervisorctl reread
erpnext-redis: available
erpnext-web: available
erpnext-workers: available
$ /usr/bin/supervisorctl update
erpnext-redis: added process group
erpnext-web: added process group
erpnext-workers: added process group
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

@bahaou I had “development_mode” : 1, in the site config file.

Does this could affect? like to setup production we need to remove this from site config file?

@abubakar no it does not affect . nginx looks fine . but supervisor is not running the website . try this ( sudo supervisorctl restart all)

@bahaou

encountered with very strange behavior.

after executing sudo bench setup production myuser second time I am getting the following output

Setting Up prerequisites...
Setting Up supervisor...
Update your /etc/supervisor/supervisord.conf with the following values:
[unix_http_server]
chmod=0760
chown=myuser:myuser
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site example.site.com assigned port: 80
Setting Up symlinks and reloading services...
$ /usr/bin/supervisorctl reread
erpnext-redis: available
erpnext-web: available
erpnext-workers: available
$ /usr/bin/supervisorctl update
erpnext-redis: added process group
erpnext-web: added process group
erpnext-workers: added process group
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

after this when I am executing
sudo bench restart
or
sudo supervisorctl restart all

I am getting the successful response respectively as followed

erpnext-workers:erpnext-frappe-schedule: stopped erpnext-workers:erpnext-frappe-default-worker-0: stopped erpnext-workers:erpnext-frappe-short-worker-0: stopped erpnext-workers:erpnext-frappe-long-worker-0: stopped erpnext-web:erpnext-node-socketio: stopped erpnext-web:erpnext-frappe-web: stopped erpnext-workers:erpnext-frappe-schedule: started erpnext-workers:erpnext-frappe-default-worker-0: started erpnext-workers:erpnext-frappe-short-worker-0: started erpnext-workers:erpnext-frappe-long-worker-0: started erpnext-web:erpnext-frappe-web: started erpnext-web:erpnext-node-socketio: started

and

erpnext-workers:erpnext-frappe-schedule: stopped erpnext-redis:erpnext-redis-cache: stopped erpnext-redis:erpnext-redis-queue: stopped erpnext-redis:erpnext-redis-socketio: stopped erpnext-web:erpnext-node-socketio: stopped erpnext-workers:erpnext-frappe-default-worker-0: stopped erpnext-workers:erpnext-frappe-short-worker-0: stopped erpnext-workers:erpnext-frappe-long-worker-0: stopped erpnext-web:erpnext-frappe-web: stopped erpnext-redis:erpnext-redis-cache: started erpnext-redis:erpnext-redis-queue: started erpnext-redis:erpnext-redis-socketio: started erpnext-web:erpnext-frappe-web: started erpnext-web:erpnext-node-socketio: started erpnext-workers:erpnext-frappe-schedule: started erpnext-workers:erpnext-frappe-default-worker-0: started erpnext-workers:erpnext-frappe-short-worker-0: started erpnext-workers:erpnext-frappe-long-worker-0: started

and ERPNext successfully working on localhost

why I have to run sudo bench setup production myuser two times to do the job very strange.

@bahaou

and when I have executed setup bench production myuser first time I have received the following response, can you please hint why this issue could be occuring

`Setting Up supervisor…
/etc/supervisor/supervisord.conf will be updated with the following values:

Updated supervisord.conf: ‘chmod’ changed from ‘0700 ; sockef file mode (default 0700)’ to ‘0760’
Updated supervisord.conf: ‘chown’ changed from ‘’ to ‘myuser:myuser’
Do you want to continue? [y/N]: y
$ sudo systemctl reload supervisor
Setting Up NGINX…
Port configuration list:

Site example.site.com assigned port: 80
Setting Up symlinks and reloading services…
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx
`

and after that if I do sudo supervisorctl restart all it just don’t give any response

and on bench restart it gives error I have shared above.

@abubakar so is everything okay now ?

Goal achieved,

but I didn’t find the answer that why I have to execute setup production command two times to do my job!