# \[DB\] Migration failed, connection timed out

**URL:** <https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890>\
**Category:** Support\
**Created:** [8 October 2022 03:00 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890 "2022-10-08T03:00:53Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [8 October 2022 03:00 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/1 "2022-10-08T03:00:53Z")

</div>

Hi everybody,

I have been trying to setup Vikunja on my Synology for some time now but I can’t get it to work.  
I followed this tutorial:

> **[Full docker example | Vikunja](https://vikunja.io/docs/full-docker-example/#setup-on-a-synology-nas)**

In Portainer, I can see that the API container can’t communicate with the DB.  
It shows the error:

```auto
2022/10/08 02:48:01 No config file found, using default or config from environment variables.
2022-10-08T02:50:09.236049398Z: CRITICAL	▶ migration/Migrate 002 Migration failed: dial tcp X.X.X.X:3306: connect: connection timed out
usermod: no changes

```

I can open the Vikunja page and create an account but when I click the “create account” button, I get the error:

```auto
Request failed with status code 405

```

2 things I should note:

1. I am not using port 443 but 5554 in my setup
2. I already have a different mariadb Docker container running in my Synology. But that shouldn’t be a problem in my experience.

My docker-compose file looks like this:

```auto
version: '3'

services:
  db_vikunja:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: supersecret
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: secret
      MYSQL_DATABASE: vikunja
    volumes:
      - /volume1/docker/vikunja_db:/var/lib/mysql
    restart: unless-stopped
  api:
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: db_vikunja
      VIKUNJA_DATABASE_PASSWORD: secret
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: a4obw47EhNpv5p9EX4T2aJ8VX
      VIKUNJA_SERVICE_FRONTENDURL: https://192.168.1.100:4321/
      PUID: 1029
      PGID: 100
    ports:
      - 3456:3456
    volumes:
      - /volume1/docker/vikunja:/app/vikunja/files
    depends_on:
      - db_vikunja
    restart: unless-stopped
  frontend:
    image: vikunja/frontend
    ports:
      - 4321:80
    environment:
      VIKUNJA_API_URL: http://192.168.1.100:3456/api/v1
    restart: unless-stopped

```

Any help is much appreciated!

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [8 October 2022 06:29 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/2 "2022-10-08T06:29:24Z")

</div>

Are there any logs from the db container?

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [9 October 2022 00:03 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/3 "2022-10-09T00:03:12Z")

</div>

There are logs but they don’t show anything related to the connection with the API container:

```auto
2022-10-08 02:55:32+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
2022-10-08 02:55:35+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-10-08 02:55:36+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
2022-10-08 02:55:36+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
2022-10-08 2:55:36 0 [Note] mariadbd (server 10.9.3-MariaDB-1:10.9.3+maria~ubu2204) starting as process 1 ...
2022-10-08 2:55:36 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-10-08 2:55:36 0 [Note] InnoDB: Number of transaction pools: 1
2022-10-08 2:55:36 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-10-08 2:55:36 0 [Warning] mariadbd: io_uring_queue_init() failed with ENOSYS: check seccomp filters, and the kernel version (newer than 5.1 required)
2022-10-08 2:55:36 0 [Warning] InnoDB: liburing disabled: falling back to innodb_use_native_aio=OFF
2022-10-08 2:55:36 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2022-10-08 2:55:36 0 [Note] InnoDB: Completed initialization of buffer pool
2022-10-08 2:55:36 0 [Note] InnoDB: Buffered log writes (block size=512 bytes)
2022-10-08 2:55:36 0 [Note] InnoDB: 128 rollback segments are active.
2022-10-08 2:55:36 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2022-10-08 2:55:36 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2022-10-08 2:55:36 0 [Note] InnoDB: log sequence number 55759; transaction id 41
2022-10-08 2:55:36 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-10-08 2:55:36 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-10-08 2:55:36 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-10-08 2:55:36 0 [Note] Server socket created on IP: '0.0.0.0'.
2022-10-08 2:55:36 0 [Note] Server socket created on IP: '::'.
2022-10-08 2:55:36 0 [Note] InnoDB: Buffer pool(s) load completed at 221008 2:55:36
2022-10-08 2:55:36 0 [Note] mariadbd: ready for connections.
Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution

```

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [9 October 2022 08:07 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/4 "2022-10-09T08:07:23Z")

</div>

Does it work if you give it some time? Sometimes the mariadb container ist not ready right away.

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [9 October 2022 10:49 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/5 "2022-10-09T10:49:26Z")

</div>

I have kept it running for ~3 days but nothing changed.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [9 October 2022 11:06 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/6 "2022-10-09T11:06:31Z")

</div>

Can you open a shell into the api container and see if you can reach the db container from there?

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [10 October 2022 02:49 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/7 "2022-10-10T02:49:21Z")

</div>

It seems that it can’t communicate with the db container.  
I did `docker exec -it [Docker container id of api container] sh` and then tried `ping [container id of db]`. But it timed out.  
I also defined a network for those 3 containers but it didn’t change anything.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [10 October 2022 09:55 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/8 "2022-10-10T09:55:31Z")

</div>

Did you put them all in the same network? Usually docker compose will do that automatically if you don’t specify any networks yourself.

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [10 October 2022 14:21 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/9 "2022-10-10T14:21:34Z")

</div>

Yes, they are all in the same network.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [11 October 2022 08:02 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/10 "2022-10-11T08:02:12Z")

</div>

Can you docker inspect the DB container to check if the hostname was set correctly?

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [11 October 2022 08:12 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/11 "2022-10-11T08:12:29Z")

</div>

I noticed that the container didn’t have the name `vikunja_db` as I specified in the docker-compose file but actually `vikunja-vikunja_db-1`.  
I set `vikunja-vikunja_db-1` as `VIKUNJA_DATABASE_HOST` in the vikunja-api container but it didn’t change anything.  
I could see that even with `vikunja_db` as `VIKUNJA_DATABASE_HOST`, the container knew that the database was at the correct internal IP address

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [11 October 2022 14:22 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/12 "2022-10-11T14:22:10Z")

</div>

I was able to use your docker-compose setup as posted in your first comment without issues. Can you check how it behaves on a separate host? This does not look like a Vikunja-specific issue.

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [12 October 2022 00:29 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/13 "2022-10-12T00:29:33Z")

</div>

wow, okay, that is weird. Thank you for checking. I will see if I need to change anything in the Synology setup.

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [12 October 2022 01:45 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/14 "2022-10-12T01:45:45Z")

</div>

Okay, I give up.  
I tried to create the containers via SSH and docker-compose instead of Portainer. I tried it with different docker networks and by adding `link` in the docker-compose file. I know that the containers are in the same Docker network but the api container can’t ping the db container (or frontend for that matter)

I have the feeling that the problem is the other mariaDB container already running in my environment. I can’t see why this would be a problem and I also changed the port to 3307 but it still didn’t work.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [12 October 2022 06:22 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/15 "2022-10-12T06:22:32Z")

</div>

The other container probably has another name?

Even if, wouldn’t that only error out on the credentials and not right on ping?

---

<div class="post-metadata">

**Author:** ![Okamikun](https://community.vikunja.io/letter_avatar_proxy/v4/letter/o/5daacb/32.png) [@Okamikun](https://community.vikunja.io/u/Okamikun)\
**Post date:** [12 October 2022 06:39 UTC](https://community.vikunja.io/t/db-migration-failed-connection-timed-out/890/16 "2022-10-12T06:39:35Z")

</div>

Yes, it has a different name. And yeah, that’s why this is so frustrating. I don’t understand why the ping is not working at all.
