tigase / tigase-xmpp-server-docker

(M) Official Docker project for Tigase XMPP Server
https://tigase.net
22 stars 5 forks source link

Unable to login and connect #7

Open GabrieleCicconetti opened 1 year ago

GabrieleCicconetti commented 1 year ago

I'm trying to build a simple xmpp server just to learn. After the setup i'm not able to login in localhost:8080/admin. This is the config.tdsl

admins = [
    'admin@009ec9fa7e7b'
]
'config-type' = 'default'
debug = [ 'server' ]
'default-virtual-host' = '009ec9fa7e7b'
dataSource () {
    default () {
        uri = 'jdbc:derby:tigasedb;create=true'
    }
}
http () {
    setup () {
        'admin-password' = 'admin'
        'admin-user' = 'admin'
    }
}
pubsub () {
    trusted = [ 'http@{clusterNode}' ]
}

I set all the username and passwords to admin:admin but i cannot login. This is the docker-compose i used to start the server

version: '3.3'
services:
  xmpp:
    image: tigase/tigase-xmpp-server:nightly-8.3-2022-10-26
    ports:
      - "5222:5222"
      - "5280:5280"
      - "5290:5290"
      - "8080:8080"
    environment:
      DB_ROOT_USER: root
      DB_ROOT_PASS: root-password
      ADMIN_JID: admin
      ADMIN_PASSWORD: admin
    volumes:
      - ./etc/:/home/tigase/tigase-server/etc/
      - ./certs/:/home/tigase/tigase-server/certs/
      - ./data/:/home/tigase/tigase-server/data/
      - ./logs/:/home/tigase/tigase-server/logs/

The second problem is that i'm trying to use this server with angular and ngx-chat but i don't understand which is the url to connect to the webSocket. For localhost i'm using ws://localhost:5290 but it doesn't work.

How can i find the correct socket url?

Thank you in advance for the help.

woj-tek commented 1 year ago

Hi,

I set all the username and passwords to admin:admin but i cannot login.

What error do you get? Could you access web service (i.e. http://localhost:8080)?

Is there service up and running? Are there any errors in logs (docker logs for the service)?

For the webSocket it should be ws://localhost:5290.

Please share more information, especially logs and erros that you get.

You could also try latest stable version (8.2.1)

GabrieleCicconetti commented 1 year ago

Hi,

I set all the username and passwords to admin:admin but i cannot login.

What error do you get? Could you access web service (i.e. http://localhost:8080)?

I'm not getting any error because i'm trying to login from the alert (screen attached) Schermata 2022-11-04 alle 12 33 11

i don't know if http://localhost:8080/setup/ has the same credentials, anyway i can login in /setup with admin:admin

Is there service up and running? Are there any errors in logs (docker logs for the service)? Yes it is. I don't see any errors

Schermata 2022-11-04 alle 12 34 47

For the webSocket it should be ws://localhost:5290. Thank you, i will keep fighting :)

Please share more information, especially logs and erros that you get.

You could also try latest stable version (8.2.1)

This is the log i don't if can be usefull tigase.txt

GabrieleCicconetti commented 1 year ago

I forgot that for the 8.2.1 i get Cannot create bean config 'push', type=tigase.push.PushNotificationsComponent. Bean requires unknown class/tigase/licence/LicenceCheckerUpdateCallback I red somewhere that this issue will be fixed in the 8.3. That's why i choosed that server version

woj-tek commented 1 year ago

I'm not getting any error because i'm trying to login from the alert (screen attached)

For the main Web UI you should use admin credentials that you created during setup, ie. admin@009ec9fa7e7b and it's password. The same goes for logging in using client.

I checked the logs and it see that you are establishing the connection on WebSocket, but you are using incorrect hostname and you get the error <host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/> (which should be displayed in the client as well):

[2022-11-04 09:18:04:229] [FINEST  ] [  ConnectionOpenThread ] ConnectionManager$ConnectionListenerImpl.accept(): Accept called for service: null@null, port_props: {remote-host=localhost, port-no=5290, new-connections-throttling=200, ifc=[Ljava.lang.String;@39d7b917, socket=plain, type=accept}
[2022-11-04 09:18:04:277] [FINE    ] [  ConnectionOpenThread ] ConnectionManager.serviceStarted(): [[ws2s]] Connection started: jid: null, WebSocketXMPPIOService, UniqueId: 172.30.0.2_5290_172.30.0.1_63266, type: <- incoming (accept), SocketIO, ID: null, connected Socket[addr=/172.30.0.1,port=63266,localport=5290]
[2022-11-04 09:18:04:308] [INFO    ] [  ConnectionOpenThread ] SocketThread.<clinit>()          : 21 socketReadThreads started.
[2022-11-04 09:18:04:344] [INFO    ] [  ConnectionOpenThread ] SocketThread.<clinit>()          : 21 socketWriteThreads started.
[2022-11-04 09:18:04:358] [FINEST  ] [      pool-36-thread-1 ] WebSocketXMPPIOService.parseHttpHeaders(): parsing request =
GET / HTTP/1.1
Host: localhost:5290
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Upgrade: websocket
Origin: http://localhost:8080
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate, br
Accept-Language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7,la;q=0.6,fr;q=0.5
Cookie: ajs_anonymous_id=7fd67350-c55f-4370-8116-6230c035b596; hubspotutk=f45540ff0ef2176315918815f964d367; __hstc=181257784.f45540ff0ef2176315918815f964d367.1664211619523.1665044286169.1666787983644.7; __utmc=111872281; __utmz=111872281.1667507001.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=111872281.637780504.1667507001.1667511082.1667553479.3; __utmt=1; __utmb=111872281.1.10.1667553479
Sec-WebSocket-Key: f970hZg+ocXdSAux4ka3RA==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Protocol: xmpp, xmpp-framing

[2022-11-04 09:18:04:383] [FINER   ] [      pool-36-thread-2 ] ClientConnectionManager.xmppStreamOpened(): Stream opened: {to=localhost, xmlns=urn:ietf:params:xml:ns:xmpp-framing, from=admin@localhost, version=1.0}
[2022-11-04 09:18:04:394] [FINEST  ] [      pool-36-thread-2 ] WebSocketXMPPIOService.writeData(): sending data = <open xmlns='urn:ietf:params:xml:ns:xmpp-framing' from='localhost' id='tigase-error-tigase' version='1.0' xml:lang='en' />
[2022-11-04 09:18:04:400] [FINEST  ] [      pool-36-thread-2 ] WebSocketHybi.encodeFrameAndWrite(): Socket: jid: null, WebSocketXMPPIOService, UniqueId: 172.30.0.2_5290_172.30.0.1_63266, type: <- incoming (accept), SocketIO, ID: ws2s@cb31de83d51e/172.30.0.2_5290_172.30.0.1_63266, connected Socket[addr=/172.30.0.1,port=63266,localport=5290], sending encoded data size = 122
[2022-11-04 09:18:04:403] [FINEST  ] [      pool-36-thread-2 ] WebSocketXMPPIOService.writeData(): sending data = <stream:error xmlns:stream="http://etherx.jabber.org/streams"><host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
[2022-11-04 09:18:04:405] [FINEST  ] [      pool-36-thread-2 ] WebSocketHybi.encodeFrameAndWrite(): Socket: jid: null, WebSocketXMPPIOService, UniqueId: 172.30.0.2_5290_172.30.0.1_63266, type: <- incoming (accept), SocketIO, ID: ws2s@cb31de83d51e/172.30.0.2_5290_172.30.0.1_63266, connected Socket[addr=/172.30.0.1,port=63266,localport=5290], sending encoded data size = 136
[2022-11-04 09:18:04:408] [FINEST  ] [      pool-36-thread-2 ] WebSocketXMPPIOService.writeData(): sending data = <close xmlns='urn:ietf:params:xml:ns:xmpp-framing'/>

You configured Tigase to use 009ec9fa7e7b as you domain/hostname and you should use such domain when you open the connection to the server.


BTW. which environment / cpu architecture do you use/run Tigase on? Startup time is quite high (it should be at best couple of seconds).

GabrieleCicconetti commented 1 year ago

i tried admin@009ec9fa7e7b and admin as password but it didn't work, i will keep trying. Anyway now it's clear. Thank you very much for the help.

I'm on a macbook pro (the most expensive one)

Schermata 2022-11-04 alle 13 38 35
GabrieleCicconetti commented 1 year ago

I managed to solve my issue. I rebuilt the enviroment with an external mysql database and inspected the users table, the password was null Schermata 2022-11-04 alle 15 49 44

I changed the password in the database and now is working. I can login in /admin and i can connect from the frontend with ngx-chat

chatService.logIn({
      domain: '8662d6b4746d',
      service: 'ws://localhost:5290',
      username: 'admin@8662d6b4746d',
      password: 'admin',
    });
woj-tek commented 1 year ago

Hi, glad you managed to solve it. I wrongly assumed you've ran the web-setup to configure the server but rather you pre-configured it. It should have create the admin account though, could you try setting ADMIN_JID to JID, i.e.: admin@009ec9fa7e7b:

ADMIN_JID: admin@009ec9fa7e7b