tinode / chat

Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
GNU General Public License v3.0
12.06k stars 1.88k forks source link

Container stops after some seconds with latest pre-release 0.15.11-rc3 #198

Closed pwFoo closed 5 years ago

pwFoo commented 5 years ago

Maybe known bug / problem because it's a pre-release.

Updated my docker container from 0.15.10 (stable release) to latest 0.15.11-rc3, but container stops after some seconds.

$ docker logs -f tinode
2018/12/26 08:40:17 Database exists, DB version is correct. All done. mysql

Restarted container and it stops again after some seconds.

So I downgraded to the earlier pre-release 0.15.11-rc2 and it looks better. After update to the new pre-releases the DB is emtpy as logged during first start with the pre-release container.

Wrong DB version, dropping and recreating the database. Invalid database version 105. Expected 106

That is no problem because it's just a test server

or-else commented 5 years ago

I just tested again both MySQL 0.15.10 -> 0.15.11-rc3 and RethinkDB 0.15.10 -> 0.15.11-rc3 and both worked as expected. Both correctly dropped and recreated the databases and then correctly launched the server.

If you are still seeing this issue please describe steps to reproduce.

pwFoo commented 5 years ago

Same problem update rc2 to rc4. Container stops after startet.

$ docker logs tinode
2018/12/30 17:40:27 Database exists, DB version is correct. All done. mysql
2018/12/30 17:40:49 Database exists, DB version is correct. All done. mysql

Looks like a bug with rc3 / rc4...

or-else commented 5 years ago

Please give me exact steps to reproduce.

pwFoo commented 5 years ago
  1. rc2 is running.
  2. delete tinode rc2 container
  3. deploy with same docker run command, but with rc3 or rc4 instead of rc2
  4. container stops after start with one line container log

It stops after ~ 6 seconds

or-else commented 5 years ago

Please list the entire setup: database name and version, steps you used to start the containers.

I tried to reproduce from 0.15.10 to 0.15.11-rc3 and it worked fine.

or-else commented 5 years ago

Thanks. You probably don't want to publish your password here. I removed it but it was still available in history. So I deleted the entire message. Here is your message without the password etc:


docker run --name tinode-mysql --env MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:5.7
docker run -d --name tinode -e VIRTUAL_HOST=<DOMAIN -e VIRTUAL_PORT=18080 -e CADDY_PROXY_OPTS=websocket --link tinode-mysql:mysql -e SMTP_SERVER=<SERVER> -e SMTP_PORT=25 -e SMTP_SENDER=<ADDY> -e SMTP_PASSWORD=<PW> --env FCM_CRED_FILE=/fcm/<FILE> -v tinode-fcm:/fcm --env FCM_SENDER_ID=<ID> -v tinode-logs:/var/log/tinode -v tinode-botdata:/botdata tinode/tinode-mysql:0.15.11-rc2

Reproduce:

docker rm -f tinode && docker run -d --name tinode -e VIRTUAL_HOST=<HOST> -e VIRTUAL_PORT=18080 -e CADDY_PROXY_OPTS=websocket --link tinode-mysql:mysql -e SMTP_SERVER=<SMTP_SERVER> -e SMTP_PORT=25 -e SMTP_SENDER=<SENDER> -e SMTP_PASSWORD=<REMOVED> --env FCM_CRED_FILE=/fcm/tinode-1586b-firebase-adminsdk-vima7-373057298f.json -v tinode-fcm:/fcm --env FCM_SENDER_ID=<REMOVED> -v tinode-logs:/var/log/tinode -v tinode-botdata:/botdata tinode/tinode-mysql:0.15.11-rc4

No info in logs. It fails from 0.15.10 or 0.15.11.rc2 to rc3 / rc4

or-else commented 5 years ago

I still cannot reproduce:

genes-mbp:chat gene$ docker run --name tinode-mysql --env MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:5.7
223f340b8c78d62d8a4410e01b45c52811f1567e7964caa8b4ed2023c8f9064c

genes-mbp:chat gene$ docker run -d --name tinode --link tinode-mysql:mysql -v tinode-logs:/var/log/tinode -v tinode-botdata:/botdata tinode/tinode-mysql:0.15.10
cc59eb019b09daa7361e5eb490bc4d437dca1c876cf6027a04bf354c8c24f174

genes-mbp:chat gene$ docker rm -f tinode 
tinode

genes-mbp:chat gene$ docker run -d --name tinode -e VIRTUAL_PORT=18080 -e CADDY_PROXY_OPTS=websocket --link tinode-mysql:mysql -v tinode-logs:/var/log/tinode -v tinode-botdata:/botdata tinode/tinode-mysql:0.15.11-rc4
bb321a5e68ca0fe4cbf93d77c32052edb2c6b6f18e04a802150e9936908aefe5

genes-mbp:chat gene$ docker ps
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS              PORTS                  NAMES
bb321a5e68ca        tinode/tinode-mysql:0.15.11-rc4   "/bin/sh -c ./entryp…"   3 minutes ago       Up 3 minutes        16061/tcp, 18080/tcp   tinode
223f340b8c78        mysql:5.7                         "docker-entrypoint.s…"   4 minutes ago      Up 4 minutes       3306/tcp, 33060/tcp    tinode-mysql

You are using the following variables:

-e VIRTUAL_HOST=<DOMAIN> -e VIRTUAL_PORT=18080 -e CADDY_PROXY_OPTS=websocket

Which means you are running a modified docker container. Is it possible that something is off in your docker?

pwFoo commented 5 years ago

That is just a reverse proxy in front of the container to configure the automatic reverse proxy. So image isn't modified. You removed the FCM part. Could you test it with FCM?

I missed to remove the password... have to change it now. Thanks!

pwFoo commented 5 years ago

It's SMTP related! Any changes with SMTP / email? Works with <= rc2, stops with rc3/rc4

or-else commented 5 years ago

Yes, there is a change related to SMTP: domains whitelist: https://github.com/tinode/chat/blob/devel/docker/tinode/config.template#L85

or-else commented 5 years ago

Now that you mentioned it I think I know why it's failing.

or-else commented 5 years ago

Fix released as https://github.com/tinode/chat/releases/tag/v0.15.11-rc5

pwFoo commented 5 years ago

Container ist running now. SMTP related Problem is fixes.

Because of upgrade / downgrade and DB schema incompatibility I need to register a new user.

Register fails with

auth secret is not unique policy 

Docker Image related?

or-else commented 5 years ago

That error means you are trying to register a user with a duplicate login. It looks like the database has not been reset. Can you check if the database has been updated?

pwFoo commented 5 years ago

deleted and recreated container with RESET_DB=1

2019/01/03 13:03:23 Database reset requested
2019/01/03 13:03:25 Generating users...
2019/01/03 13:03:26 Generating group topics...
2019/01/03 13:03:27 Generating P2P subscriptions...
2019/01/03 13:03:27 Generating group subscriptions...
2019/01/03 13:03:27 Inserting messages...
2019/01/03 13:03:30 Inserting forms as  tino fsw1rVhWfXM
2019/01/03 13:03:30 All done.

Same error if I try to register a new user

Error: policy violation (422)

auth DB uname

mysql> select uname from auth; 
+-------------+
| uname       |
+-------------+
| basic:alice |
| basic:bob   |
| basic:carol |
| basic:dave  |
| basic:eve   |
| basic:frank |
| basic:tino  |
| basic:xena  |
+-------------+
or-else commented 5 years ago

What's the login/password of the user you are trying to register?

Two restrictions were added to basic auth: min_login_length and min_password_length: https://github.com/tinode/chat/blob/devel/docker/tinode/config.template#L45

Maybe you are trying to use a login/password which is too short.

pwFoo commented 5 years ago

Ok... I use a 3 characters short username :( Tried other passwords, but not changed the username...

or-else commented 5 years ago

I suppose I can change it to 3.

pwFoo commented 5 years ago

Yeah, would be nice :) 👍

or-else commented 5 years ago

Changed to 3 in devel. I'll release it in the 0.15.11 in a couple of days.