Trying to solve a problem with another install method

Hi

I have been spending hours now searching with no luck.

During the past few months I have spent a LOT of time “playing” with ERPNExt installations
to understand it with the aim of using it. I have an account with Digital Ocean so it is easy
to build a server , deploy ERPNExt and use it.

The procedure that I have been using is a manual procedure which is rather exhausting,
but it works. So during this last few months of getting to know ERPnext I have perhaps
doen about 20 installs , all with the same procedure and I was feeling that , when I finally
build my active system and start to use it officially, then I am comfortable with the
procedure. Just as I was ready to do this, I find an issue that seem to be caused by
the fact that I have added an SSL cert to run via HTTPS. I will list the post
just below but it comes down to the “Generate New Report” in “Stock Balance”
malfunctioning.

Post that I created…

And every install I do WITHOUT an SSL cert, does not have that issue.

So now I am searching for a script install for V12 on Ubuntu 18 so that I can try a different install method to check if this problem is not perhaps caused by my install method. But
all the links I find on the internet and on youtube, break at some point.

Is there really no script-install for V12 on Ubuntu out there that is solid ?

The manual method that I have been using is …

Or if someone can perhaps comment of the validity of my install method , ( link just above)

Thanks

Hi John,

The installation steps between a v12 and v13 should be nearly identical.

Here are the likely reasons I can think about, in terms of errors:

  • Node.js version incompatible with Node SASS version in package.json of Frappe App.
  • Frappe App and ERPNext App not using the correct branch version-12

If you want to post some of your errors, I can probably point you in the correct direction.

Hi @brian_pond

Thank you for taking the time.

This server is runing:
ERPNext: v12.24.0 (version-12)
Frappe Framework: v12.21.0 (version-12)
on Ubuntu 18.04 TLS on a 2CPu 4G-RAM VPS ( Digital Ocean)

I had a look around.

  1. In the “error log list” on the erpnext-interface there is nothing.
  2. /frappe_bench/logs/web.log I see “Site www.partstop.com does not exist” I assume it is the
    Paypal module doing that. Not sure why because I have not configured paypal. I need to
    investigate that
  3. I saw something in … worker.error.log.1. This file was last updated 4 Nov. That is when this
    all came to light.

NB Note … this server was destined to be my final server and although it was created a
month ago, I only updated its settings as I learned on my test-system. I only really started
using it on 4 Nov when I started entering transactions.

Here is what is in worker.error.log.1

Blockquote
20:21:18 default: Job OK (8d70e49f-b067-45c1-9c69-93e99a5b08ec)
20:21:18 Result is kept for 500 seconds
20:21:18 Cleaning registries for queue: default
20:23:32 default: frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name=‘<function run_background at 0x7f41e9671510>’, kwargs={‘prepared_report’: ‘REP00003’}, method=<function run_background at 0x7f41e9671510>, site=‘trinityerp.co.za’, user=‘Administrator’) (219fa858-a985-4366-b817-e4189d540bb3)
20:23:32 default: Job OK (219fa858-a985-4366-b817-e4189d540bb3)
20:23:32 Result is kept for 500 seconds
20:35:02 default: frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name=‘<function run_background at 0x7f41e95b0d90>’, kwargs={‘prepared_report’: ‘REP00004’}, method=<function run_background at 0x7f41e95b0d90>, site=‘trinityerp.co.za’, user=‘Administrator’) (8bffaec1-03d1-463f-a501-dec1ad08313c)
20:35:03 default: Job OK (8bffaec1-03d1-463f-a501-dec1ad08313c)
20:35:03 Result is kept for 500 seconds
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 177, in _read_from_socket
raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 668, in execute_command
return self.parse_response(connection, command_name, **options)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 680, in parse_response
response = connection.read_response()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 624, in read_response
response = self._parser.read_response()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 284, in read_response
response = self._buffer.readline()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 216, in readline
self._read_from_socket()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 191, in _read_from_socket
(e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: (‘Connection closed by server.’,)
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 484, in connect
sock = self._connect()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 541, in _connect
raise err
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/rq/worker.py”, line 486, in work
result = self.dequeue_job_and_maintain_ttl(timeout)
File “/home//frappe-bench/env/lib/python3.6/site-packages/rq/worker.py”, line 519, in dequeue_job_and_maintain_ttl
job_class=self.job_class)
File “/home//frappe-bench/env/lib/python3.6/site-packages/rq/queue.py”, line 460, in dequeue_any
result = cls.lpop(queue_keys, timeout, connection=connection)
File “/home//frappe-bench/env/lib/python3.6/site-packages/rq/queue.py”, line 410, in lpop
result = connection.blpop(queue_keys, timeout)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 1269, in blpop
return self.execute_command(‘BLPOP’, *keys)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 673, in execute_command
connection.send_command(*args)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 585, in send_packed_command
self.connect()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 484, in connect
sock = self._connect()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 541, in _connect
raise err
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 2879, in execute
return execute(conn, stack, raise_on_error)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 2749, in _execute_transaction
connection.send_packed_command(all_cmds)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 585, in send_packed_command
self.connect()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 484, in connect
sock = self._connect()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 541, in _connect
raise err
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
;
During handling of the above exception, another exception occurred:
;
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home//frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/home//frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home//frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home//frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home//frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home//frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home//frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home//frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home//frappe-bench/apps/frappe/frappe/commands/scheduler.py”, line 167, in start_worker
start_worker(queue, quiet = quiet)
File “/home//frappe-bench/apps/frappe/frappe/utils/background_jobs.py”, line 151, in start_worker
Worker(queues, name=get_worker_name(queue)).work(logging_level = logging_level)
File “/home//frappe-bench/env/lib/python3.6/site-packages/rq/worker.py”, line 502, in work
self.register_death()
File “/home//frappe-bench/env/lib/python3.6/site-packages/rq/worker.py”, line 300, in register_death
p.execute()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 2894, in execute
return execute(conn, stack, raise_on_error)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/client.py”, line 2749, in _execute_transaction
connection.send_packed_command(all_cmds)
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 585, in send_packed_command
self.connect()
File “/home//frappe-bench/env/lib/python3.6/site-packages/redis/connection.py”, line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.
@ubuntu-s-2vcpu-4gb-sfo2-01-prod-system:~/frappe-bench/logs$

You may see that at the start, there is reference to “Prepared_report” and the ID’s …
REP00003 and REP00004
Not sure if the error trace actually relates to REP00004 ?

Both these reports are indeed “Stock reports” that I executed and it is while executing a
“Stock Balance” report that I noticed the strange behaviour of the “Generate New Report”
button, but I completed another test ( as below)…

while I was running tail -f worker.error.log
I pressed the “Generate New Report” button and checked the output. No error.

Also, if you go to “Prepared Report List” and actually unzip the .gz files attached to these
reports, they actually contain valid information.

If you do have a suggestion I would appreciate it. My frustration level is high becasue after
months of testing/invetigating, I finaly decided to stay with V12 and start entering my data,
and then this becomes apparent.

Appreciate your time

Hi @brian_pond I noticed now … the file-path does not have a “user”.
I replaced my username with and I think the <> is taken out when
the “Blockquote” is rendered.

At a glance, the root cause appears to be this:

  • ERPNext is trying to connect to the Redis queue server on local port 11000.
  • But it cannot make the connection.

How are you starting ERPNext? Using bench start? Or via Supervisor?

Hi @brian_pond

Thank you again for your time.

The procedure that I follow actually dictates both.
At step (7), which covers the installation of ERPNext, I type bench start
and can then see if I can access the system , as a test, via port 8000

I then type CTRL-C
You then do a

  • sudo bench setup production sammy --yes

followed by

  • sudo supervisorctl stop all
  • sudo supervisorctl start all

You then proceed to access your system via the URL that is set up to access the system and
proceed with login in as Administrator and do the initial setup … country, language …etc

Link to setup doc…

I am only slowly getting to know all the components involved with ERPNext, so forgive if
I am talking nonsense … but the way I understand it is that REDIS is involved with
database queries? S

hI @brian_pond

Seems I posted my response before I was finished !

Just pondering some thoughts …
This error then seem to be related to database queries ?

Could it be that my observation about the “Generate New Report” button be
coincidental ? Could it be that I actually have 2 problems here?

The appearance was there that installing the SSL cert caused something to happen but surely
the SSL-cert installation interacts with NGINX which should not affect REDIS ?

Could it be usefull for me to install another V12 server and test it in 2 phases …
phase 1 : without SSL-cert
phase 2 : with SSL-cert ?

Correct, the TLS certificate only impacts Nginx. Regardless of whether Nginx is working correctly, you should be able to access ERPNext on port 8000.

Redis is actually performing 3 different roles for ERPNext:

  • Redis database #1 is a cache, so you can speedily read data, instead of calling SQL.
  • Redis database #2 is a Queue, which “workers” read from to perform background tasks.
  • Redis database #3 is for some Socket I/O features.

All 3 are accessed by ERPNext on startup. But your error log indicated they could not be.

Setting aside the Report issues for a moment. What remaining issues are you experiencing?

  • Are you able to access ERPNext v12 on the local 8000 port?
  • Are you able to access ERPNext v12 over HTTP 80/433?

Hi @brian_pond

Thanks for the info on REDIS function. I was aware of the first function, not the other 2.

Blockquote
Setting aside the Report issues for a moment. What remaining issues are you experiencing?

Appart from the Stock Report issue, I was actually under the impression my server is
functioning nominally. I can login, … started entering invoices…

I can see my G-Ledger…

Although I cannot view my stock, I can see it in my database …

Blockquote * Are you able to access ERPNext v12 over HTTP 80/433?

I can access my server via the URL that I have set up with the correct A-records
on the DNS server at my ISP. It indicates a secure connection.

I cannot access it via ports 80 and 8000 anymore. This must be because of the
redirects in the NGINX.CONF file which only has an open server listed on port 443.

I have started another server deployment. I need to see if I can replicate this again.

Until now, I have been focussing on the reports issue …

In summary, I therefor have …
Server 1: Stock report issue [yes] ; REDIS-issue [yes] ; server still exists [SSL=yes]
Server 2: Stock report issue [yes] ; REDIS issue [unknown] ; server doesnt exist anymore [SSL = yes]
Server 3: No stock report issue ; REDIS issue [no]; Server still exist [SSL = no]
Server 4: being built

Server 3 does have some Traceback entries in the worker.error.log, but those relate to
Email …“Please set up default Email account.” (Email domain/account not yet configured on
this server)

Update:

As I indicated in my previous post, I wanted to re-plicate this by building another server.

  1. Completed the server …
    ERPNext: v12.26.0 (version-12)
    Frappe Framework: v12.23.0 (version-12)
    on Ubuntu 18.04 TLS on a 2CPu 4G-RAM VPS ( Digital Ocean)
    redis 4.0.9
    python 3.6.9
    nginx 1.14.0

by following the same install procedure as always

  1. No SSL-cert installed yet. Completed initial setup. Completed additional high-level
    setup … COA, purchase-settings, item-groups, etc. Also loaded one supplier and 2 Items.
    Completed a Purchase. Can view Ledger and stock without a problem. No errors in
    “error log list” in erpnext. No Traceback entries in log-files in /frappe-bench/logs.

  2. Kept server running like this for a few hours. Did 4 stock reports. In “Stock Report”
    the “Generate New Report” button was functioning normally

  3. Added SSL-cert. “Generate New Report” button in “Stock Report” started malfunctioning
    No Exceptions thrown in logs in /frappe-bench/logs. Also, supervisorctl status reports all
    processes running.

  4. SSL-cert installed with this procedure
    Configuring HTTPS

  5. Tried various browsers and cleared cache/cookies on my browser to see if the browser
    is not playing a role. All browsers are exibiting the same behaviour.

I do see this entry in the redis-cache.log ( entered into log during installation process )

Blockquote
1579:M 07 Nov 14:25:53.699 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
1579:M 07 Nov 14:25:53.699 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1579:M 07 Nov 14:25:53.699 * Ready to accept connections

I am currently investigating the nginx-traffic in /var/log/nginx. To see if I can see anything.

Blockquote
I have a question:

Is there anywhere a block-diagram to show information-flow via Nginx between ERPNext
and the client-browser?