evan-buss / openbooks

Search and Download eBooks
https://evan-buss.github.io/openbooks/
MIT License
1.77k stars 57 forks source link

Unable to connect to IRC server. #102

Open Ruthalas opened 1 year ago

Ruthalas commented 1 year ago

Hello! I am experiencing the following issue when attempting to use OpenBooks (via Docker). When the webUI is loaded, it gives the error: "Unable to connect to IRC server."

Here is a chunk of the log, starting from a restart of the container:

2022/09/12 10:27:40 SERVER: Base Path: /
2022/09/12 10:27:40 SERVER: OpenBooks is listening on port 80
2022/09/12 10:27:40 SERVER: Download Directory: /books
2022/09/12 10:27:40 SERVER: Open http://localhost:80/ in your browser.
2022/09/12 10:27:40 SERVER: Base Path: /
2022/09/12 10:27:40 SERVER: OpenBooks is listening on port 80
2022/09/12 10:27:40 SERVER: Download Directory: /books
2022/09/12 10:27:40 SERVER: Open http://localhost:80/ in your browser.
2022/09/12 10:27:49 SERVER: Client connected from XXX.XXX.XXX.XXX:XXXX
2022/09/12 10:27:49 CLIENT (straight_contracst_1): New client created.
2022/09/12 10:27:49 CLIENT (straight_contracts_1): CONNECT Message Received
2022/09/12 10:27:50 CLIENT (straight_contracts_1): EOF
2022/09/12 10:27:50 CLIENT (straight_contracts_1): EOF

In my docker configuration I am pulling evanbuss/openbooks:latest, so I believe I am up to date. (I don't see a version number in the webUI anywhere.) I have tried setting the name flag, but it did not change the outcome.

Any assistance would be appreciated. If there is any other information I can provide, please let me know!

Thank you for this tool!

unai-ndz commented 1 year ago

~Are you using a reverse proxy? This happens to me using one but not if I connect directly.~ Nevermind it happens anyways. It just takes longer to complain without the proxy.

AlexMuresan commented 1 year ago

Having the same issue as well. I'm guessing there's a problem with the IRC.

wisewtf commented 1 year ago

Same thing over here. Comes and goes infrequently.

I only get EOF when it fails to connect.

evan-buss commented 1 year ago

I am unable to reproduce this issue on my end. To anyone experiencing this issue, please run OpenBooks with the --log flag so that IRC logs are saved to a file for each client connection.

Docker Compose:

command: --persist --log
Ruthalas commented 1 year ago

I opened the application to test this after enabling logging and had no issue connecting. I removed the logging and still had no issue connecting.

Possibly a temporary issue on the IRC side? Regardless, appreciate the effort. I will leave logging enabled, and report back if I encounter the issue again.

Edit: Issues persist intermittently. Perhaps it's a matter of leaving the initial session open when stopping/starting the container(?). Initially it works, but after stopping the container and starting it again I get the failed to connect.

The attached log shows the initial connection, a book search, and the stop/start/fail to reconnect happens at the end. As far as I can tell, there are no entries in the log starting with the stopping of the docker container.

ruthalas_1--2022-11-01--17-40-35.log

ncryptedV1 commented 1 year ago

Issue exists when keeping TLS authentication enabled, as IRCHighway certs seem to be self-signed. With their root CA added to the cert store or with --tls=false the connection works. Despite that, no commands seem to reach the server. User and messages also can't manually be found in the users list/chat log of the channel when connecting with a common IRC client.

evan-buss commented 1 year ago

Issue exists when keeping TLS authentication enabled, as IRCHighway certs seem to be self-signed. With their root CA added to the cert store or with --tls=false the connection works.

TLS connections don't validate the issuer so this shouldn't be the issue.

https://github.com/evan-buss/openbooks/blob/91bb21ac7d8d2b09e1117d1a573184b000feadb0/irc/irc.go#LL32C2-L32C2

ncryptedV1 commented 1 year ago

TLS connections don't validate the issuer so this shouldn't be the issue.

https://github.com/evan-buss/openbooks/blob/91bb21ac7d8d2b09e1117d1a573184b000feadb0/irc/irc.go#LL32C2-L32C2

Agreed, turned out to be a network configuration problem. Works flawlessly now.

pjannink commented 1 year ago

HI, I also have same issue. How did you resolve the network issue? I use local port 8081 / container port 80 and forwarded port 8081 in my router to my synology NAS where I am running Docker and the Openbooks-container. So a bit clueless why it says "not connected".....

MMilosz commented 1 year ago

Running docker run -d -p 8080:80 -v ~/Downloads:/books evanbuss/openbooks --persist also gave me this kind of error but having changed 8080:80 to 80:80 I can finally establish connection. No idea if this workaround works for everyone

pjannink commented 1 year ago

Does not work for me. See my setup stated above. Openbooks should create a default user according evan-buss but no signs of a userid in the low left corner of the Openbooks-webpage: it states "Not connected" there.

takov751 commented 1 year ago

I have solved it with simply adding one bit next to presist

-s "irc.irchighway.net:9999" with this I am able to connect to irchightway.net without issue. so basically i just changed default irc port

pjannink commented 1 year ago

Sadly not here. I'm working with Docker GUI on Synology and Portainer, but with Docker's export/import function I could edit the cmd line in the json file and recreated the container. Edited line in the JSON:

"cmd" : "./openbooks server --dir /books --port 80 --persist -s irc.irchighway.net:9999",

According Portainer the settings are now:

CMD | ./openbooks server --dir /books --port 80 --persist -s irc.irchighway.net:9999 ENTRYPOINT | ./openbooks server --dir /books --port 80

But...still not working...Now idea how I could edit the Entrypoint... Hope someone can help me out..

zenjubbers commented 1 year ago

For those of you using nginx proxy manager, make sure you enable "websocket support" for openbooks. I was seeing an unable to connect error and the lower left of the page would show disconnected until I enabled websocket support.

ljo123 commented 1 year ago

For those of you using nginx proxy manager, make sure you enable "websocket support" for openbooks. I was seeing an unable to connect error and the lower left of the page would show disconnected until I enabled websocket support.

How are you using openbooks with NPM? Both need to listen on docker internal port 80.

zenjubbers commented 1 year ago

How are you using openbooks with NPM? Both need to listen on docker internal port 80.

Just map to an unused port on your docker then in NPM, You'd forward traffic to the docker server on said port.

For example, I use port 8023 on the docker server for the openbook container. ports:

Then in my NPM, I simply have it forward traffic to http://{IP of docker server}:8023

ljo123 commented 1 year ago

How are you using openbooks with NPM? Both need to listen on docker internal port 80.

Just map to an unused port on your docker then in NPM, You'd forward traffic to the docker server on said port.

For example, I use port 8023 on the docker server for the openbook container. ports: - 8023:80

Then in my NPM, I simply have it forward traffic to http://{IP of docker server}:8023

Nice thanks. I was confused and thought that you could only use the internal port once like you do with external. Docker is smarter than I thought!

IMBeniamin commented 1 year ago

-tls=false got me a connection, but commands are not forwarded, so I was able to reproduce

Issue exists when keeping TLS authentication enabled, as IRCHighway certs seem to be self-signed. With their root CA added to the cert store or with --tls=false the connection works. Despite that, no commands seem to reach the server. User and messages also can't manually be found in the users list/chat log of the channel when connecting with a common IRC client.

I have also tried using

I have solved it with simply adding one bit next to presist

-s "irc.irchighway.net:9999" with this I am able to connect to irchightway.net without issue. so basically i just changed default irc port

but had no success

I tried a non tls port (6660) with --tls=false and after sending a search got a search submitted message, but no results

2023/02/15 22:33:42 SERVER: OpenBooks is listening on port 80 2023/02/15 22:33:42 SERVER: Download Directory: /books 2023/02/15 22:33:42 SERVER: Open http://localhost:80/ in your browser. 2023/02/15 22:33:50 SERVER: Client connected from client_ip:client_port 2023/02/15 22:33:50 CLIENT (): New client created. 2023/02/15 22:33:50 CLIENT (): CONNECT Message Received 2023/02/15 22:34:00 CLIENT (): SEARCH Message Received

**after trying another search it did work with the settings above

peseotni commented 1 year ago

in my case it has to do with nginx proxy manager. If I put in the ip address, it works, it connects, searches, and downloads, but it doesn't work through the proxy

conortimmsy commented 12 months ago

For those of you using nginx proxy manager, make sure you enable "websocket support" for openbooks. I was seeing an unable to connect error and the lower left of the page would show disconnected until I enabled websocket support.

Thanks, man. Just what I was missing!!

ShadowsDieThrice commented 9 months ago

Issue still persists. Not using nginx proxy manager, but the connection still drops out sporadically. Have tried running both dockerised and directly from the exe with similar results.

roadkingvrod commented 6 months ago

I needed to add -s irc.irchighway.net:9999 to my "command" options in docker compose. seems irchighway changed their port.

99linesofcode commented 4 months ago

Without sharing your docker-compose.yaml suggestions are just a shot in the dark. I experience the same issue but could be for entirely different reasons.

Make sure you are using the right port to connect through SSL: The ports we support are 6660 to 6669 and 7000. For connections through SSL use port 6697 or 9999.

AlphaCraft9658 commented 3 months ago

Using TLS and a correct TLS port does not work consistently. Sometimes it connects and executes all commands properly and in the next second it cannot connect.

tfig-dev commented 3 weeks ago

still an issue, right? I've tried so many ways and just worked once. this is my docker.compose.yml

` openbooks: container_name: openbooks command: --persist --name my_user_name -s irc.irchighway.net:6697 image: evanbuss/openbooks:latest volumes: