Can't connect to server on 'db'
Closed this issue · 17 comments
Hi,
first of all, thank you for the solution you have provided
I know that it should be straightforward, but after following the steps, this is what I can see in the rtabby_web_api log
[2023-12-05T09:30:00Z ERROR rtabby_web_api] Encountered error on database connection: Can't connect to server on 'db' (115)
Error: MysqlConnection(BadConnection("Can't connect to server on 'db' (115)"))
The only thing that I have changed in your docker-compose file is the volume for the DB, because I like to have everything in the same folder
I have this under the db
volumes:
- ./database:/var/lib/mysql
instead of
volumes:
- database:/var/lib/mysql
I also removed the volume definition at the end
volumes:
database:
Do you have an idea what could be wrong here?
Hey @mihha,
Sorry to hear that you have trouble with this.
I tried to update my compose file same as you and run into issue. To be sure that i'm experiencing the same problem, could you please send the log of the db container ?
docker logs rtabby-database
Hi,
sure. Here is the output of the log you have requested
2023-12-05 09:20:23+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.2.2+maria~ubu2204 started.
2023-12-05 09:20:23+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-12-05 09:20:23+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.2.2+maria~ubu2204 started.
2023-12-05 09:20:23+00:00 [Note] [Entrypoint]: Initializing database files
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following command:
'/usr/bin/mariadb-secure-installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at https://mariadb.com/kb
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
2023-12-05 09:20:29+00:00 [Note] [Entrypoint]: Database files initialized
2023-12-05 09:20:29+00:00 [Note] [Entrypoint]: Starting temporary server
2023-12-05 09:20:29+00:00 [Note] [Entrypoint]: Waiting for server startup
2023-12-05 9:20:29 0 [Note] Starting MariaDB 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 source revision 929532a9426d085111c24c63de9c23cc54382259 as process 113
2023-12-05 9:20:29 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-12-05 9:20:29 0 [Note] InnoDB: Number of transaction pools: 1
2023-12-05 9:20:29 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2023-12-05 9:20:29 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2023-12-05 9:20:29 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-05 9:20:29 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2023-12-05 9:20:29 0 [Note] InnoDB: End of log at LSN=47629
2023-12-05 9:20:29 0 [Note] InnoDB: Opened 3 undo tablespaces
2023-12-05 9:20:29 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2023-12-05 9:20:29 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2023-12-05 9:20:29 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2023-12-05 9:20:29 0 [Note] InnoDB: log sequence number 47629; transaction id 14
2023-12-05 9:20:29 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-12-05 9:20:29 0 [Note] Plugin 'wsrep-provider' is disabled.
2023-12-05 9:20:29 0 [Warning] 'user' entry 'root@e48c28584f2e' ignored in --skip-name-resolve mode.
2023-12-05 9:20:29 0 [Warning] 'proxies_priv' entry '@% root@e48c28584f2e' ignored in --skip-name-resolve mode.
2023-12-05 9:20:29 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2023-12-05 9:20:29 0 [Note] mariadbd: ready for connections.
Version: '11.2.2-MariaDB-1:11.2.2+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
2023-12-05 09:20:30+00:00 [Note] [Entrypoint]: Temporary server started.
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: GENERATED ROOT PASSWORD: ZZ<-"R@w9;W@zlA/GGHHjF:aGgmLoz<m
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: Creating database tabby
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: Creating user tabby
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: Giving user tabby access to schema tabby
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation)
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: Stopping temporary server
2023-12-05 9:20:33 0 [Note] mariadbd (initiated by: unknown): Normal shutdown
2023-12-05 9:20:33 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-05 9:20:33 0 [Note] InnoDB: Starting shutdown...
2023-12-05 9:20:33 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2023-12-05 9:20:33 0 [Note] InnoDB: Buffer pool(s) dump completed at 231205 9:20:33
2023-12-05 9:20:33 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2023-12-05 9:20:33 0 [Note] InnoDB: Shutdown completed; log sequence number 47629; transaction id 15
2023-12-05 9:20:33 0 [Note] mariadbd: Shutdown complete
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: Temporary server stopped
2023-12-05 09:20:33+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up.
2023-12-05 9:20:33 0 [Note] Starting MariaDB 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 source revision 929532a9426d085111c24c63de9c23cc54382259 as process 1
2023-12-05 9:20:33 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-12-05 9:20:33 0 [Note] InnoDB: Number of transaction pools: 1
2023-12-05 9:20:33 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2023-12-05 9:20:33 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2023-12-05 9:20:33 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-05 9:20:33 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2023-12-05 9:20:33 0 [Note] InnoDB: End of log at LSN=47629
2023-12-05 9:20:33 0 [Note] InnoDB: Opened 3 undo tablespaces
2023-12-05 9:20:33 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2023-12-05 9:20:33 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2023-12-05 9:20:33 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2023-12-05 9:20:33 0 [Note] InnoDB: log sequence number 47629; transaction id 14
2023-12-05 9:20:33 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-12-05 9:20:33 0 [Note] Plugin 'wsrep-provider' is disabled.
2023-12-05 9:20:33 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-05 9:20:33 0 [Note] InnoDB: Buffer pool(s) load completed at 231205 9:20:33
2023-12-05 9:20:33 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-12-05 9:20:33 0 [Note] Server socket created on IP: '::'.
2023-12-05 9:20:33 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2023-12-05 9:20:33 0 [Note] mariadbd: ready for connections.
Version: '11.2.2-MariaDB-1:11.2.2+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
2023-12-05 9:22:25 0 [Note] mariadbd (initiated by: unknown): Normal shutdown
2023-12-05 9:22:25 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-05 9:22:25 0 [Note] InnoDB: Starting shutdown...
2023-12-05 9:22:25 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2023-12-05 9:22:25 0 [Note] InnoDB: Buffer pool(s) dump completed at 231205 9:22:25
2023-12-05 9:22:25 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2023-12-05 9:22:25 0 [Note] InnoDB: Shutdown completed; log sequence number 47629; transaction id 15
2023-12-05 9:22:25 0 [Note] mariadbd: Shutdown complete
2023-12-05 09:26:01+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.2.2+maria~ubu2204 started.
2023-12-05 09:26:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-12-05 09:26:01+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.2.2+maria~ubu2204 started.
2023-12-05 09:26:02+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
2023-12-05 9:26:02 0 [Note] Starting MariaDB 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 source revision 929532a9426d085111c24c63de9c23cc54382259 as process 1
2023-12-05 9:26:02 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-12-05 9:26:02 0 [Note] InnoDB: Number of transaction pools: 1
2023-12-05 9:26:02 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2023-12-05 9:26:02 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2023-12-05 9:26:02 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-05 9:26:02 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2023-12-05 9:26:02 0 [Note] InnoDB: End of log at LSN=47629
2023-12-05 9:26:02 0 [Note] InnoDB: Opened 3 undo tablespaces
2023-12-05 9:26:02 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
2023-12-05 9:26:02 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2023-12-05 9:26:02 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2023-12-05 9:26:02 0 [Note] InnoDB: log sequence number 47629; transaction id 14
2023-12-05 9:26:02 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-12-05 9:26:02 0 [Note] Plugin 'wsrep-provider' is disabled.
2023-12-05 9:26:02 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-05 9:26:02 0 [Note] InnoDB: Buffer pool(s) load completed at 231205 9:26:02
2023-12-05 9:26:02 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-12-05 9:26:02 0 [Note] Server socket created on IP: '::'.
2023-12-05 9:26:02 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2023-12-05 9:26:02 0 [Note] mariadbd: ready for connections.
Version: '11.2.2-MariaDB-1:11.2.2+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
2023-12-05 9:38:17 0 [Note] mariadbd (initiated by: unknown): Normal shutdown
2023-12-05 9:38:17 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-05 9:38:17 0 [Note] InnoDB: Starting shutdown...
2023-12-05 9:38:17 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2023-12-05 9:38:17 0 [Note] InnoDB: Buffer pool(s) dump completed at 231205 9:38:17
2023-12-05 9:38:17 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2023-12-05 9:38:17 0 [Note] InnoDB: Shutdown completed; log sequence number 47629; transaction id 15
2023-12-05 9:38:17 0 [Note] mariadbd: Shutdown complete
Thank's, nothing to do with my problem then.
Mariadb seems to run just fine anyway. Have you done any change about networking in your docker daemon ?
There is not logical reason that explain why rtabby_web_api can't connect to db as there are directly connected through internal network.
I didn't do any changes in the networking
As I said, the only thing that was changed was "volume" part and I did that before I started docker compose for the first time
Hey @mihha
I just published a new version which run with one container only using sqlite.
As I don't really see what could cause your containers to not being able to talk with each other in your setup... You could try to use sqlite version as a workaround.
https://github.com/Clem-Fern/rtabby-web-api#getting-started-sqlite
Hi,
thank you for providing the SQlite option
I tried it, and it started the container correctly, as far as I can see
But, now what?
This is what I see from the container logs
[2023-12-08T09:28:26Z INFO rtabby_web_api] Running v0.3.0
[2023-12-08T09:28:26Z INFO rtabby_web_api] users.yml loaded => 2 users found
[2023-12-08T09:28:26Z INFO rtabby_web_api::storage] Running pending migrations.
[2023-12-08T09:28:26Z INFO rtabby_web_api] Binding HTTP Listener on 0.0.0.0:8080
[2023-12-08T09:28:26Z INFO rtabby_web_api] Starting HTTP Listener on 0.0.0.0:8080
[2023-12-08T09:28:26Z INFO actix_server::builder] starting 4 workers
[2023-12-08T09:28:26Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
[2023-12-08T09:35:04Z WARN rtabby_web_api::auth] Authentification failed for Some("172.23.0.1")
[2023-12-08T09:35:26Z WARN rtabby_web_api::auth] Authentification failed for Some("172.23.0.1")
It seems that I am missing something very obvious here, but can't figure out what
I have to tell you that for this installation, I am using Apache as a reverse proxy, which should forward all requests from my subdomain to the docker container port
This is what I have in Apache virtual host
ProxyPreserveHost On
ProxyPass / http://localhost:18080/
ProxyPassReverse / http://localhost:18080/
This kind of setup works for other docker containers I have on the server
It was pointed to me in another issue that this was not very clear from the docs.
You are not supposed to access the api through a browser. You have to add your service url and your token added in users.yml
directly in Tabby Config Sync tab.
Oh i see what your problem is then.
The token field was missing due to a bug in this version. It has been fixed in 1.0.205
``I apologize for not realizing that there is a new version. It never showed up in the Tabby interface and I did check
Getting closer, but still not there
When I enter my sync host and the token, I get only spinning icon in the token field
Docker logs shows the following
[2023-12-08T13:57:27Z INFO rtabby_web_api] Running v0.3.0
[2023-12-08T13:57:27Z INFO rtabby_web_api] users.yml loaded => 1 users found
[2023-12-08T13:57:27Z INFO rtabby_web_api] Binding HTTP Listener on 0.0.0.0:8080
[2023-12-08T13:57:27Z INFO rtabby_web_api] Starting HTTP Listener on 0.0.0.0:8080
[2023-12-08T13:57:27Z INFO actix_server::builder] starting 4 workers
[2023-12-08T13:57:27Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
[2023-12-08T13:59:04Z INFO rtabby-web-api] 172.25.0.1 "GET /api/1/configs/14101 HTTP/1.1" 401 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) tabby/1.0.205 Chrome/118.0.5993.144 Electron/27.1.0 Safari/537.36" 0.001130
Something is still missing.
Apache reverse proxy logs shows that the connection request reached the server, but then it just throws Error 401
Looks like an tabby issue this time.
Were you using the official tabby web instance before it shut down ?
Could you try to edit your config through Settings > Config file
and delete configSync
section ?
This section should contains value like configID
and auto
.
Thank you for your efforts
I tried to do that and it didn't work
I even tried to clear the config completely and start fresh. No go as well
Although I thought that my reverse proxy is working correctly, now I start to wonder if that is the case
Do you have this behind the proxy? What proxy are you using? What is the config for the proxy if you are using it?
GUESS WHAT?
It was reverse proxy. I forgot to redirect all the HTTP requests to the HTTPS in the virtual host configuration
It seems like the config was uploaded now, but in tabby interface I get something funny
It says that the sync configuration is wrong, but after that, that the config was uploaded correctly
Well great, glad to know that you sorted this out :)
Weird for this error, do you have a sync plugin installed ?
Yes, I have a sync plugin installed, but it is not configured
I have disabled it with the same sync error message
When I completely uninstalled it, the sync was working without any error messages
Thank you again for your effort in resolving the problem
I have learned a lot during the debugging of this. Specifically, not to trust something I believed was working correctly from my side (reverse proxy configuration
I apologize for spending so much of your time on something that wasn't your fault
No problem, it is not like this project has been tested and used by a lot of people, so really, no worry.
Again, I'm glad that you sorted this out !
I will try to add vhost configuration template for apache and nginx. It could always be usefull to someone.