The command bench update fails due to "redis_cache service is not running"

For some reason couldn’t get the files restored but the bench restore worked for the site itself.

bench --site site1.local --force restore sites/site1.local/private/backups/20221010_182909-site1_local-database.sql.gz
MySQL root password: 
*** Scheduler is enabled ***
Site site1.local has been restored

Just not to make anything wrong, what is the best next step to try to look if the website would start running? (Of course it won’t have the files/images now)
Should be we make “bench update” first or just “bench restart”?

So you may need to do several things (from inside the bench folder)-

  1. sudo bench setup production {username} - you need to run this to prepare the bench for production use. Replace {username} with your linux user
  2. bench use site1.localhost - this will set that site as the default site
  3. sudo supervisorctl reread - This will reread the configuration files for supervisor
  4. sudo supervisorctl reload - this will reload supervisor itself
  5. bench setup nginx - this will generate the nginx configuration
  6. sudo service nginx reload - this will reload nginx so that the new configuration can be used

After all these commands your website should ideally work.

1 Like

Done now.

  1. Complained that supervisor config exists already

Continued until
6) reloading nginx

sudo service nginx reload
Job for nginx.service failed.
See "systemctl status nginx.service" and "journalctl -xe" for details.

Looked “systemctl status nginx.service” that says nginx is active and running and then this in the final lines (other lines look fine):

Oct 12 12:05:06 localhost systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Oct 12 12:05:06 localhost systemd[1]: Reload failed for A high performance web server and a reverse proxy server.

“journalctl -xe” lists different successes, nothing alerting there.

Removed lines of “chown” from the supervisor config and got the command "sudo bench production [username] slightly further. Error came in this part:

$ sudo systemctl reload supervisor
Setting Up NGINX...
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site site1.local assigned port: 80
Setting Up symlinks and reloading services...
$ sudo /usr/sbin/nginx -t
nginx: [emerg] duplicate upstream "frappe-bench-frappe" in /etc/nginx/conf.d/frappe.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
ERROR: 
Traceback (most recent call last):

Nginx Status Error Solve with below steps:-

1) frappe@frappe-Inspiron-3593:~/frappe-bench$ sudo systemctl stop nginx

2) frappe@frappe-Inspiron-3593:~/frappe-bench$ sudo bench setup production frappe

3) frappe@frappe-Inspiron-3593:~/frappe-bench$ sudo nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

4) frappe@frappe-Inspiron-3593:~/frappe-bench$ sudo systemctl reload nginx

nginx.service is not active, cannot reload.

5)frappe@frappe-Inspiron-3593:~/frappe-bench$ sudo systemctl start nginx

The command “sudo bench setup production [frappeuser]” fails:

- - 
Site site1.local assigned port: 80
Setting Up symlinks and reloading services...
$ /usr/bin/supervisorctl reread
frappe-bench-redis: available
frappe-bench-web: available
frappe-bench-workers: available
$ /usr/bin/supervisorctl update
frappe-bench-redis: added process group
frappe-bench-web: added process group
frappe-bench-workers: added process group
$ sudo /usr/sbin/nginx -t
nginx: [emerg] duplicate upstream "frappe-bench-frappe" in /etc/nginx/conf.d/frappe.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
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 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/setup.py", line 72, in setup_production
    setup_production(user=user, yes=yes)
  File "/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py", line 74, in setup_production
    reload_nginx()
  File "/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py", line 184, in reload_nginx
    exec_cmd(f"sudo {which('nginx')} -t")
  File "/usr/local/lib/python3.8/dist-packages/bench/utils/__init__.py", line 153, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

Go with step by step. It’s works in my local.

I did but no point to go forward if it fails. Need to figure out how to get this “sudo bench setup production” working…

sudo bench setup production your_username

Yes, used the username but it makes the above fail message.

Send me full screenshot

Unfortunately this took months (huge loss in visibility and Google value) but now had a chance to look this matter again. We have installed frappe bench and erpnext as an app again. We put the files and database backups back. After that the website was still not visible.

Now we are very close!
With the command “sudo bench setup production our_bench-username” we got the website back! It is still visible only in IP address. We do have our domain in the site config. What else we need to do in order to show it from the domain name instead of only IP address?

It seems we got the website working with the domain now too.

After the above “sudo bench setup production our_bench-username”, we made these following things:

bench setup add-domain www.ourdomain.com

Followed by “bench setup nginx”.
=> this actually didn’t work since site_config.json was owned by root

chown bench-user:bench-user site_config.json
=> after this adding our own domain worked (asked “Site”: site1.local)

but not yet visible, then:
bench setup nginx
bench restart (stops and starts)

Check the configurations:
nano /etc/nginx/conf.d/frappe-bench.conf
nano sites/site1.local/site_config.json


How can we make this work with Lets Encrypt? Run it from the frappe-bench folder.

bench config dns_multitenant on

sudo -H bench setup lets-encrypt site1.local - -custom-domain www.ourdomain.com

(successful, after this the last line says “Setting Up cron job to Renew lets-encrypt every month”)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.