[Update] Frappe version 6 has been merged into develop

@anand

Yes, redis-async-broker is running.

Basically I have a seperate nginx server that i use to proxy to the ERPNext server.

I use the following configuration (which is a copy from ERPNext’s standard nginx config)

location /socket.io {
proxy_pass http://[SERVERIPADDRESS]:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header X-Frappe-Site-Name erp_sitename;
proxy_set_header Origin $http_host;
proxy_set_header Host $host;
}

I can confirm that if I bypass this proxy the realtime works. But if I use this proxy then the realtime does not work.

I use SSL by the way. Not sure if this will affect it.

I know its a little off your existing architecture so no I can understand if you’re not able to assist. Thanks @anand

@anand

After some extensive troubleshooting, I can confirm that SSL is causing this issue.

I have also managed to solve this.

socket.io requires explicitly defining that the connection is secure if it is served over https. In order to get it working what I did was modify socket.js and replaced:

frappe.socket.socket = io.connect(frappe.socket.get_host());

with

if (window.location.protocol == "https:") {
   frappe.socket.socket = io.connect(frappe.socket.get_host(), {secure: true});
}
else if (window.location.protocol == "http:") {
	frappe.socket.socket = io.connect(frappe.socket.get_host());
}

Can this be included to serve those that use SSL?

Can you send a pull request? @pdvyas can you review it?

I tried to upgrade to v6 using commande sudo apt-get install nodejs npm then, sudo update --upgrade. but now I have this errors. Any ideas?

sudo bench setup socketio
npm http GET https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/redis
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/superagent
npm http GET https://registry.npmjs.org/cookie

npm ERR! Error: failed to fetch from registry: socket.io
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request. (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! http://bugs.debian.org/npm
npm ERR! or use
npm ERR! reportbug --attach /home/frappe/frappe-bench/npm-debug.log npm
npm ERR!
npm ERR! System Linux 2.6.32-042stab108.8
npm ERR! command “node” “/usr/bin/npm” “install” “socket.io” “redis” “express” “superagent” “cookie”
npm ERR! cwd /home/frappe/frappe-bench
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: socket.io
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/frappe/frappe-bench/npm-debug.log
npm not ok
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 60, in cli
bench()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 664, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 644, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 464, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/cli.py”, line 487, in _setup_socketio
setup_socketio()
File “/home/frappe/bench-repo/bench/utils.py”, line 112, in setup_socketio
exec_cmd(“npm install socket.io redis express superagent cookie”, cwd=bench)
File “/home/frappe/bench-repo/bench/utils.py”, line 104, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: npm install socket.io redis express superagent cookie

Looks like your internet is down as npm isn’t able to access download url.

But it’s not the case. I’m on a VPS and internet is working.

I’ll try again later. Thanks for the fast answer

Any clues from home/frappe/frappe-bench/npm-debug.log ?

verbose url resolved https://registry.npmjs.org/cookie
http GET https://registry.npmjs.org/cookie
ERR! Error: failed to fetch from registry: express
ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR! at Request. (/usr/lib/nodejs/request/main.js:212:58)
ERR! at Request.emit (events.js:88:20)
ERR! at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
ERR! at ClientRequest.emit (events.js:67:17)
ERR! at HTTPParser.onIncoming (http.js:1261:11)
ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR! http://bugs.debian.org/npm
ERR! or use
ERR! reportbug --attach /home/frappe/frappe-bench/npm-debug.log npm
ERR!
ERR! System Linux 2.6.32-042stab108.8
ERR! command “node” “/usr/bin/npm” “install” “socket.io” “redis” “express” “superagent” “cookie”
ERR! cwd /home/frappe/frappe-bench
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: express

I did an other sudo bench update --upgrade and got no errors but redis cache server is not running and I get this

sudo supervisorctl status
frappe:frappe-web RUNNING pid 20188, uptime 0:00:03
frappe:frappe-worker RUNNING pid 20187, uptime 0:00:03
frappe:frappe-workerbeat RUNNING pid 20189, uptime 0:00:03
node-socketio BACKOFF Exited too quickly (process log may have details)
redis-async-broker RUNNING pid 20191, uptime 0:00:03
redis-cache BACKOFF Exited too quickly (process log may have details)

but if I run again sudo bench setup socketio, I still same kind of errors

http GET https://registry.npmjs.org/cookie
ERR! Error: failed to fetch from registry: socket.io
ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR! at Request. (/usr/lib/nodejs/request/main.js:212:58)
ERR! at Request.emit (events.js:88:20)
ERR! at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
ERR! at ClientRequest.emit (events.js:67:17)
ERR! at HTTPParser.onIncoming (http.js:1261:11)
ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR! http://bugs.debian.org/npm
ERR! or use
ERR! reportbug --attach /home/frappe/frappe-bench/npm-debug.log npm
ERR!
ERR! System Linux 2.6.32-042stab108.8
ERR! command “node” “/usr/bin/npm” “install” “socket.io” “redis” “express” “superagent” “cookie”
ERR! cwd /home/frappe/frappe-bench
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: socket.io

Sent pull request #1282

any suggestions about the redis-cache server not working, and my other problem with socketio. The redis-cache server is causing problems but I dont see any problems while using erpnext with the socketio problem.

What is the output of tail -n100 /var/log/supervisord/error.log

I dont have error.log file but I have the supervisord.log

2015-08-30 07:14:45,731 INFO stopped: frappe-web (exit status 0)
2015-08-30 07:14:47,057 INFO stopped: frappe-worker (exit status 0)
2015-08-30 07:14:48,069 INFO spawned: ‘frappe-worker’ with pid 20142
2015-08-30 07:14:48,072 INFO spawned: ‘frappe-web’ with pid 20143
2015-08-30 07:14:48,565 INFO spawned: ‘frappe-workerbeat’ with pid 20153
2015-08-30 07:14:49,594 INFO success: frappe-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:14:49,594 INFO success: frappe-web entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:14:49,594 INFO success: frappe-workerbeat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:19:17,672 INFO waiting for frappe-worker, frappe-web, frappe-workerbeat, redis-async-broker to die
2015-08-30 07:19:17,673 INFO stopped: redis-async-broker (terminated by SIGQUIT)
2015-08-30 07:19:17,681 INFO stopped: frappe-workerbeat (terminated by SIGQUIT)
2015-08-30 07:19:17,961 INFO stopped: frappe-web (exit status 0)
2015-08-30 07:19:19,248 INFO stopped: frappe-worker (exit status 0)
2015-08-30 07:19:19,275 CRIT Supervisor running as root (no user in config file)
2015-08-30 07:19:19,275 WARN Included extra file “/etc/supervisor/conf.d/frappe.conf” during parsing
2015-08-30 07:19:19,286 INFO RPC interface ‘supervisor’ initialized
2015-08-30 07:19:19,286 WARN cElementTree not installed, using slower XML parser for XML-RPC
2015-08-30 07:19:19,286 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking
2015-08-30 07:19:19,286 INFO supervisord started with pid 1069
2015-08-30 07:19:20,291 INFO spawned: ‘frappe-worker’ with pid 20187
2015-08-30 07:19:20,296 INFO spawned: ‘frappe-web’ with pid 20188
2015-08-30 07:19:20,308 INFO spawned: ‘frappe-workerbeat’ with pid 20189
2015-08-30 07:19:20,310 INFO spawned: ‘node-socketio’ with pid 20190
2015-08-30 07:19:20,327 INFO spawned: ‘redis-async-broker’ with pid 20191
2015-08-30 07:19:20,329 INFO spawned: ‘redis-cache’ with pid 20192
2015-08-30 07:19:20,404 INFO exited: redis-cache (exit status 1; not expected)
2015-08-30 07:19:20,653 INFO exited: node-socketio (exit status 1; not expected)
2015-08-30 07:19:22,064 INFO success: frappe-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:19:22,064 INFO success: frappe-web entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:19:22,064 INFO success: frappe-workerbeat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:19:22,066 INFO spawned: ‘node-socketio’ with pid 20220
2015-08-30 07:19:22,066 INFO success: redis-async-broker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-30 07:19:22,068 INFO spawned: ‘redis-cache’ with pid 20221
2015-08-30 07:19:22,102 INFO exited: redis-cache (exit status 1; not expected)
2015-08-30 07:19:22,279 INFO exited: node-socketio (exit status 1; not expected)
2015-08-30 07:19:24,326 INFO spawned: ‘node-socketio’ with pid 20226
2015-08-30 07:19:24,331 INFO spawned: ‘redis-cache’ with pid 20227
2015-08-30 07:19:24,354 INFO exited: redis-cache (exit status 1; not expected)
2015-08-30 07:19:24,427 INFO exited: node-socketio (exit status 1; not expected)
2015-08-30 07:19:27,413 INFO spawned: ‘redis-cache’ with pid 20229
2015-08-30 07:19:27,429 INFO spawned: ‘node-socketio’ with pid 20230
2015-08-30 07:19:27,431 INFO exited: redis-cache (exit status 1; not expected)
2015-08-30 07:19:27,513 INFO gave up: redis-cache entered FATAL state, too many start retries too quickly
2015-08-30 07:19:27,523 INFO exited: node-socketio (exit status 1; not expected)
2015-08-30 07:19:28,525 INFO gave up: node-socketio entered FATAL state, too many start retries too quickly
2015-08-31 08:06:20,495 INFO spawned: ‘redis-cache’ with pid 21431
2015-08-31 08:06:20,521 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:06:21,526 INFO spawned: ‘redis-cache’ with pid 21432
2015-08-31 08:06:21,553 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:06:23,905 INFO spawned: ‘redis-cache’ with pid 21433
2015-08-31 08:06:23,917 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:06:27,914 INFO spawned: ‘redis-cache’ with pid 21434
2015-08-31 08:06:27,925 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:06:28,926 INFO gave up: redis-cache entered FATAL state, too many start retries too quickly
2015-08-31 08:09:50,890 INFO spawned: ‘redis-cache’ with pid 21549
2015-08-31 08:09:50,902 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:09:51,908 INFO spawned: ‘redis-cache’ with pid 21550
2015-08-31 08:09:51,934 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:09:54,356 INFO spawned: ‘redis-cache’ with pid 21551
2015-08-31 08:09:54,370 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:09:58,367 INFO spawned: ‘redis-cache’ with pid 21552
2015-08-31 08:09:58,378 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:09:59,379 INFO gave up: redis-cache entered FATAL state, too many start retries too quickly
2015-08-31 08:17:29,030 INFO waiting for frappe-worker, frappe-web, frappe-workerbeat, redis-async-broker to die
2015-08-31 08:17:29,031 INFO stopped: redis-async-broker (terminated by SIGQUIT)
2015-08-31 08:17:29,045 INFO stopped: frappe-workerbeat (terminated by SIGQUIT)
2015-08-31 08:17:29,416 INFO stopped: frappe-web (exit status 0)
2015-08-31 08:17:30,661 INFO stopped: frappe-worker (exit status 0)
2015-08-31 08:17:30,675 CRIT Supervisor running as root (no user in config file)
2015-08-31 08:17:30,675 WARN Included extra file “/etc/supervisor/conf.d/frappe.conf” during parsing
2015-08-31 08:17:30,687 INFO RPC interface ‘supervisor’ initialized
2015-08-31 08:17:30,687 WARN cElementTree not installed, using slower XML parser for XML-RPC
2015-08-31 08:17:30,687 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking
2015-08-31 08:17:30,687 INFO supervisord started with pid 1069
2015-08-31 08:17:31,692 INFO spawned: ‘frappe-worker’ with pid 21650
2015-08-31 08:17:31,697 INFO spawned: ‘frappe-web’ with pid 21651
2015-08-31 08:17:31,702 INFO spawned: ‘frappe-workerbeat’ with pid 21652
2015-08-31 08:17:31,705 INFO spawned: ‘node-socketio’ with pid 21653
2015-08-31 08:17:31,731 INFO spawned: ‘redis-async-broker’ with pid 21654
2015-08-31 08:17:31,734 INFO spawned: ‘redis-cache’ with pid 21655
2015-08-31 08:17:31,781 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:17:32,297 INFO exited: node-socketio (exit status 1; not expected)
2015-08-31 08:17:32,766 INFO success: frappe-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-31 08:17:32,766 INFO success: frappe-web entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-31 08:17:32,766 INFO success: frappe-workerbeat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-31 08:17:32,766 INFO success: redis-async-broker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-31 08:17:33,769 INFO spawned: ‘node-socketio’ with pid 21683
2015-08-31 08:17:33,772 INFO spawned: ‘redis-cache’ with pid 21684
2015-08-31 08:17:33,808 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:17:33,948 INFO exited: node-socketio (exit status 1; not expected)
2015-08-31 08:17:36,168 INFO spawned: ‘node-socketio’ with pid 21689
2015-08-31 08:17:36,171 INFO spawned: ‘redis-cache’ with pid 21690
2015-08-31 08:17:36,209 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:17:36,273 INFO exited: node-socketio (exit status 1; not expected)
2015-08-31 08:17:39,807 INFO spawned: ‘node-socketio’ with pid 21692
2015-08-31 08:17:39,812 INFO spawned: ‘redis-cache’ with pid 21693
2015-08-31 08:17:39,834 INFO exited: redis-cache (exit status 1; not expected)
2015-08-31 08:17:39,893 INFO gave up: redis-cache entered FATAL state, too many start retries too quickly
2015-08-31 08:17:39,902 INFO exited: node-socketio (exit status 1; not expected)
2015-08-31 08:17:40,904 INFO gave up: node-socketio entered FATAL state, too many start retries too quickly