btcpayserver / btcpayserver-docker

Docker resources for hosting BTCPayServer easily
MIT License
583 stars 358 forks source link

Help needed : Error 502 Bad Gateway when accessing RTL #346

Closed Nisaba closed 4 years ago

Nisaba commented 4 years ago

Hello,

When I want to got to RTL : Server settings / Services / Ride the Lightning server / See information / Browser connection

-> I get a 502 Bad Gateway error on the browser.

Thank you for your help

Eskyee commented 4 years ago

What version number. is your BTCPay node running & your deployment method ?? also please check this issue, from a few days ago, I had mentioned it to @NicolasDorier & the RTL team https://github.com/Ride-The-Lightning/RTL/issues/391

Eskyee commented 4 years ago

I just tested on a lunanode BTCPayServer v1.0.5.4 and Server settings / Services / Ride the Lightning server link working ok. for me.

but I did spot this error on a Azure build...and bad gateway.. on my Azure server. was told this fix after by RTL team. RTL config path should be set to ‘/data/’ only, NOT ‘/data/RTL.conf/‘.
but still not had time to test yet.

Nisaba can you check your RTL container logs ?? I spotted this error. from v1.0.5.3

Nisaba commented 4 years ago

OK, Thanks for the information. I've the v1.0.5.3 version.

I will ask to my admin and keep you informed

saubyk commented 4 years ago

I just tested on a lunanode BTCPayServer v1.0.5.4 and Server settings / Services / Ride the Lightning server link working ok. for me.

but I did spot this error on a Azure build...and bad gateway.. on my Azure server. was told this fix after by RTL team. RTL config path should be set to ‘/data/’ only, NOT ‘/data/RTL.conf/‘. but still not had time to test yet.

Nisaba can you check your RTL container logs ?? I spotted this error. from v1.0.5.3

Hey @Eskyee please note a correct the config path should be /data

NicolasDorier commented 4 years ago

@Nisaba are you fully synched?

NicolasDorier commented 4 years ago

@Nisaba also have you updated to latest version with btcpay-update.sh?

mankwes commented 4 years ago

Hi all, i m on the same team with @Nisaba, we did the update with btcpay-update.sh and the docker is updated to v1.0.5.4. We check also on the config path is /data.

those are the log

docker logs --tail 100 generated_lnd_bitcoin_rtl_1
Error: No such container: generated_lnd_bitcoin_rtl_1
docker logs --tail 10 btcpayserver_lnd_bitcoin
2020-08-06 09:26:56.361 [INF] CRTR: Processed channels=0 updates=31 nodes=1 in last 59.999876734s
2020-08-06 09:27:42.753 [INF] DISC: Broadcasting 140 new announcements in 14 sub batches

But still get the 502 Bad Gateway.

ShahanaFarooqui commented 4 years ago

@mankwes, @NicolasDorier, @Eskyee

Are you running it on localhost or remote? localhost is the default value for HOST setting but if you are running it remotely then you need to provide HOST environment value.

https://github.com/Ride-The-Lightning/RTL/issues/391#issuecomment-666374818

mankwes commented 4 years ago

@ShahanaFarooqui i'm running it on remote domain name.

Eskyee commented 4 years ago

I'm running on remote

NicolasDorier commented 4 years ago

@mankwes wrong command, should be

docker logs generated_bitcoin_rtl_1

mankwes commented 4 years ago

Sorry here are the log

 docker logs generated_bitcoin_rtl_1
Server is up and running, please open the UI at http://localhost:3000
rockstardev commented 4 years ago

I can confirm problem on another instance. Nothing useful in logs. On nginx getting:

[error] 22#22: *14866 connect() failed (111: Connection refused) while connecting to upstream, client: [my ip] ... upstream: "http://172.18.0.9:3000/rtl/api/authenticate/cookie?access-key=38b46ac12d5xxxxx..."

saubyk commented 4 years ago

I can confirm problem on another instance. Nothing useful in logs. On nginx getting:

[error] 22#22: *14866 connect() failed (111: Connection refused) while connecting to upstream, client: [my ip] ... upstream: "http://172.18.0.9:3000/rtl/api/authenticate/cookie?access-key=38b46ac12d5xxxxx..."

Hi @rockstardev has there any change been made recently for the Nginx setting? Ideally, Nginx need not query rtl with the IP address in the url, since Nginx and RTL are on the same host.

There should be two possible ways to resolve this:

rockstardev commented 4 years ago

There hasn't been any change in Nginx setting. The change seems to have come from adding this new config setting.

@saubyk deleting new setting "host": "localhost" from RTL-Config.json resolves the issue.

And Nginx and RTL are on the same host, but they are in different containers. So when ngxin container is hitting RTL container, of course it'll be different IP in the docker's internal network.

If you set nginx container to query http://localhost:3000 it's going to query itself.

All BTCPayServer instances that are launched since this config change was introduced are impacted and RTL won't work for them. Operators can manually fix this problem by:

cd /var/lib/docker/volumes/generated_lnd_bitcoin_rtl_datadir/_data
vim RTL-Config.json
delete "host":"localhost" line (or set it to container's IP for connection not to be refused)
remove container, start a new one that'll pick up volume and restart service

Alternative is that we tweak nginx somehow... @NicolasDorier let me know if you have any idea.

saubyk commented 4 years ago

@rockstardev missed the container nuance (docker noob still) :-) Deleting the localhost setting for RTL-Config.json, results in host(container) IP address being chosen as the default I guess, which is how it should be serving.

rockstardev commented 4 years ago

@saubyk yeah... I'm not sure we can fix it some other way. You do expose 3000 but you are not binding port to outside Docker network (with ports setting). So we would need some proxy process within your container in order to be able to hit it with localhost:3000.

I'm not sure if @NicolasDorier has some nginx trick up his sleeve... where we could set host... but it's question how your process would return response to outside if host is "localhost".

saubyk commented 4 years ago

@rockstardev I don't think RTL should serve on the localhost in this case. We can ensure that the default RTL-Config.json which is generated by RTL, does not contain the host config. That should address the problem.

rockstardev commented 4 years ago

That would be great. If you publish the update on your Docker image let us know so we can bump version asap to stop people from deploying instances that'll need to be manually fixed.

saubyk commented 4 years ago

@rockstardev Docker images tagged with v0.8.4: https://hub.docker.com/r/shahanafarooqui/rtl/tags

rockstardev commented 4 years ago

GJ... @NicolasDorier merged with Emperor speed.

NicolasDorier commented 4 years ago

ugh thanks @rockstardev I think we should mention that on the doc? Or maybe let people know about the workaround so if noobs get stucks we can help.

NicolasDorier commented 4 years ago

ping @Kukks @pavlenex if noobs on channel see problems

https://github.com/btcpayserver/btcpayserver-docker/issues/346#issuecomment-670230046

The command line though is not good, as somebody not knowing how to use vim will not be able to fix the sissue.

pavlenex commented 4 years ago

From what I understood this only happened to newly deployed instanced on v1.0.5.3 so probably a small number of people are affected. I haven't seen many people complaining tbh. But they can easily re-deploy if cli is problem, this only affects those who want to use RTL.