sameersbn / docker-redmine

Docker Image for Redmine
http://www.damagehead.com/docker-redmine/
MIT License
1.28k stars 497 forks source link

Synology DSM Problems with database connection after backup #465

Closed maneuss closed 2 years ago

maneuss commented 3 years ago

Hi a few days ago i deinstalled my old synology redmine package (featuring sameersbn-redmine:3.4.13) and upgraded to the original sameersbn-redmine_latest. It took some time but now redmine runs in an actual version without major problems.

there is one issue remaining which i´m not able to solve by myself: i´m using the synology mariadb10 database. the docker container connects to it by a mapped mysqld.sock file (-> symlink to synology´s /var/run/mysqld10.sock). nothing problemativ with that. but every time my ds920 performs a backup task (by hyperbackup, synology´s backup solution) the database is stopped, the connection to the docker container is broken and afterwards an internal error is shown as the database is not connected anymore. i´ve circumvented the problem by stopping and restarting the container (in fact the whole docker service) after the backup task has finished. that´s rather clumsy and ineffective and leads to downtimes of Redmine of about 30 Minutes.

Is there any way (e.g. by setting env-variables) so that redmine tries to reconnect after a connection is broken so that downtimes are minimised? is there any other way to prevent this from happening? i´ve tried to connect to the database by using the ds´ip and port but that didn´t work at all.

with best regards

Martin

PS: last docker config file (without credentials) sameersbn-redmine Vorlage.json.txt

jcormier commented 3 years ago

mysqld.sock file (-> symlink to synology´s /var/run/mysqld10.sock

My guess is that when docker bind mounts /var/run/mysqld10.sock, its grabbing the current file handle. When mariadb10 is stopped it must delete this sock file and creates a new one when it starts back up. However, docker is still holding onto the file handle for the deleted sock file.

From my brief googling, there is no way to get docker to refresh a bind mounted volume short of rebooting the container.

However, a workaround might be to mount the folder (assuming it doesn't get deleted) instead of the file.

        "host_volume_file" : "/docker/mysqld/",
        "mount_point" : "/var/run/mysqld/",
maneuss commented 3 years ago

Hi, thank you for your fast response. I´ll try it. It will take some time to get the results as performing the backup will take about 30-40 minutes. I´ll report back.

MArtin

maneuss commented 3 years ago

Hi, without the correct mapping it did not connect at all to the database. In the protocol the process stopped after "Configuring Redmine". mapping only the folder did not work. i´ve tried using the ip of my ds and the correct port (192.168.178.12:3306) instead but to no avail. Martin

jcormier commented 3 years ago

Thats too bad. Any idea if the sock file shows up inside the docker container?

i´ve tried using the ip of my ds and the correct port ( 192.168.178.12:3306) instead but to no avail. Is Synology's MariaDB setup to listen on a port or just the sock file? You should be able to look to see if the port is open using "netstat -tulp" or similar

On Tue, May 18, 2021 at 4:43 PM Martin Neuß @.***> wrote:

Hi, without the correct mapping it did not connect at all to the database. In the protocol the process stopped after "Configuring Redmine". mapping only the folder did not work. i´ve tried using the ip of my ds and the correct port (192.168.178.12:3306) instead but to no avail. Martin

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/sameersbn/docker-redmine/issues/465#issuecomment-843546699, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK2RGJZGFQ5ICNOUJVGZIDTOLGO7ANCNFSM45DHCYMA .

-- Jonathan Cormier Software Engineer

Voice: 315.425.4045 x222

http://www.CriticalLink.com http://www.criticallink.com/ 6712 Brooklawn Parkway, Syracuse, NY 13211

https://www.linkedin.com/company/critical-link-llc https://twitter.com/Critical_Link

maneuss commented 3 years ago

It shows up inside docker. when i have time i ´ll look what happens when backup just has finished. in synology dsm i ´ve opened a port on 3306 and access from other instances seems to work. i ´ll have a closer look.

martin

maneuss commented 3 years ago

these are the results of ss in the container.

root@sameersbn-redmine:/bin# ss -tulpe                                                       
Netid    State     Recv-Q    Send-Q       Local Address:Port            Peer Address:Port    
Process                                                                                      
tcp      LISTEN    0         128              127.0.0.1:http-alt             0.0.0.0:*       
 uid:1000 ino:21983842 sk:1 <->                                                              
tcp      LISTEN    0         128                0.0.0.0:http                 0.0.0.0:*       
 users:(("nginx",pid=268,fd=9)) ino:21982752 sk:2 <->                                        
tcp      LISTEN    0         128                   [::]:http                    [::]:*       
 users:(("nginx",pid=268,fd=10)) ino:21982753 sk:3 v6only:1 <->                              
root@sameersbn-redmine:

from my employer the firewall blocks direct access via ssh so these results will com later.

maneuss commented 3 years ago

hi íve done some other checks: the mariadb10 is perfectly accessible from my laptop and other computers so this is not a problem. the network connection is configured as a „bridge“: the local ip of the docker container is 172.17.0.0, the gateway is 172.17.0.1. in resolve.conf the gateway is (my router´s) 192.168.178.1. so to my understanding there might be a problem if the container tries to access a gateway (192….) which just isn ´t in it´s address range? but how can i access my nas´ mariadb10 on 192.168.178:3307 if ím not able to get to it at all?

my understanding of linux just is distressingly inadequate.

martin

jcormier commented 3 years ago

Sorry I've been busy, just catching up

the network connection is configured as a „bridge“: the local ip of the docker container is 172.17.0.0, the gateway is 172.17.0.1. in resolve.conf the gateway is (my router´s) 192.168.178.1. so to my understanding there might be a problem if the container tries to access a gateway (192….) which just isn ´t in it´s address range? but how can i access my nas´ mariadb10 on 192.168.178:3307 if ím not able to get to it at all?

Can you ping your nas IP address from within the redmine container? That will determine if there is a valid route. I believe ordinarily docker images are supposed to be able to access the host machines ports. Unless Synology has done something.

And you can test connectivity by running mysqladmin -h ${DB_HOST} -P ${DB_PORT} -u ${DB_USER}

192.168.178:3307 I assume this is a typo, as its missing the .1

Based on this stack overflow, I'd try to connect using either 192.168.178.1 or 172.17.0.1 to see if either work. https://stackoverflow.com/a/31328031/780194

the mariadb10 is perfectly accessible from my laptop and other computers so this is not a problem.

Good

CSCSxx commented 2 years ago

Hi there, we also use this on different synology nas and it works fine! Under Environment we have assigned the following variables for the database:

DB_ADAPTER mysql2 DB_HOST xxx.xxx.xxx.xxx (IP from NAS) DB_PORT 3307 DB_NAME xxx DB_USER xxxx DB_PASS xxxx DB_ENCODING utf8mb4

Unfortunately I can't contribute more to this topic...

frank-dspeed commented 2 years ago

Ok perfect i see that as solved feel free to reopen if not DNS and IP Configurations and Checking if services are even running is not possible.