I am trying to set up staging and production on the same server, but in two fully distinct ‘bench’ instances.
supervisor.conf
and nginx.conf
both show that the first one defined uses port 8000 and the second one defined uses port 8001…
upstream frappe-bench-PYPW-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}
upstream frappe-bench-DYPW-frappe {
server 127.0.0.1:8001 fail_timeout=0;
}
I cannot get the port 8001 site to work — but that isn’t my immediate question.
Trying to track down the reason, I attempted to connect to port 8001 directly. It refused the connection.
I then attempted to connect to port 8000. It also refused the connection.
I don’t understand!
How can a port be available and useable as an NGinx upstream, but not be useable when called directly. What else do I have to do?
hasan@Toshy:~$ curl -sL 'https://erp.yourpublic.work/api/resource/User/Administrator' \
--header 'Authorization: token 4174f2bf6ecode1:afa005a3c2dead7' | jq -r .
{
"data": {
"name": "Administrator",
"owner": "Administrator",
: : :
With firewall disabled and NGinx stopped:
hasan@Toshy:~$ curl -sL 'http://193.x.x.43:8000/api/resource/User/Administrator' /
--header 'Authorization: token 4174f2bf6ecode1:afa005a3c2dead7'
curl: (7) Failed to connect to 193.182.16.43 port 8000: Connection refused
Directly on the server:
erpdev@erpserver:~$ curl 'http://127.0.0.1:8000/api/resource/User/Administrator' /
--header 'Authorization: token 4174f2bf6ecode1:afa005a3c2dead7';
curl: (52) Empty reply from server
erpdev@erpserver:~$ curl 'http://127.0.0.1:8000/api/resource/User' /
--header 'Authorization: token 4174f2bf6ecode1:afa005a3c2dead7';
curl: (52) Empty reply from server
erpdev@erpserver:~$ curl 'http://127.0.0.1:8000/api/resource/User';
curl: (52) Empty reply from server
erpdev@erpserver:~$ curl 'http://127.0.0.1:8000'; # api/resource/User';
curl: (52) Empty reply from server
erpdev@erpserver:~$ curl 'http://Administrator:NoBigSecret@127.0.0.1:8000';
curl: (52) Empty reply from server
Oh, yeah. Environment:
erpdev@erpserver:~/frappe-bench-PYPW$ bench --version
5.1.0
erpdev@erpserver:~/frappe-bench-PYPW$ bench version
erpnext 13.0.0-beta.3
frappe 13.0.0-beta.3
erpdev@erpserver:~/frappe-bench-PYPW$ lsb_release -d
Description: Ubuntu 20.04.1 LTS
erpdev@erpserver:~/frappe-bench-PYPW$
And, finally, in case anyone has any suggestions, here’s my NGinx log when attempting to connect to the second (8001) site, and receiving the " Don’t panic. It’s not you, it’s us." message:
erpdev@erpserver:/etc/nginx/sites-available$ sudo -A tail -fn 3 /var/log/nginx/error.log
2020/07/25 15:32:12 [notice] 6306#6306: signal process started
2020/07/25 15:32:26 [error] 6309#6309: *145 upstream prematurely closed connection while reading response header from upstream, client: 67.193.35.107, server: dev.yourpublic.work, request: "GET /desk HTTP/1.1", upstream: "http://127.0.0.1:8001/desk", host: "dev.yourpublic.work"
2020/07/25 15:32:26 [error] 6309#6309: *145 upstream prematurely closed connection while reading response header from upstream, client: 67.193.35.107, server: dev.yourpublic.work, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8001/favicon.ico", host: "dev.yourpublic.work", referrer: "https://dev.yourpublic.work/desk"