matrix-docker-ansible-deploy icon indicating copy to clipboard operation
matrix-docker-ansible-deploy copied to clipboard

setup-all fails during TASK [matrix-postgres : Execute Postgres additional database initialization SQL file for synapse]

Open matebitte opened this issue 3 years ago • 5 comments

do you know why this is happending?

the task [matrix-postgres : Execute Postgres additional database initialization SQL file for synapse] failed with:

fatal: [matrix.sachsen.lol]: FAILED! => {"changed": true, "cmd": ["/usr/bin/env", "docker", "run", 
"--rm", 
"--user=997:1001", 
"--cap-drop=ALL", 
"--env-file=/matrix/postgres/env-postgres-psql",
"--network", "matrix", 
"--mount", "type=bind,src=/tmp/matrix-postgres-init-additional-db-user-and-role.sql,dst=/matrix-postgres-init-additional-db-user-and-role.sql,ro",
"--entrypoint=/bin/sh", "docker.io/postgres:13.2-alpine", 
"-c", "psql -h matrix-postgres --file=/matrix-postgres-init-additional-db-user-and-role.sql"], 
"delta": "0:00:00.034341", "end": "2021-04-22 18:33:07.886693", 
"msg": "non-zero return code",
"rc": 125, 
"start": "2021-04-22 18:33:07.852352", 
"stderr": "docker: Error response from daemon: invalid mount config for type \"bind\": bind source path does not exist: /tmp/matrix-postgres-init-additional-db-user-and-role.sql.\nSee 'docker run --help'.", 
"stderr_lines": ["docker: Error response from daemon: invalid mount config for type \"bind\": bind source path does not exist: /tmp/matrix-postgres-init-additional-db-user-and-role.sql.", "See 'docker run --help'."], 
"stdout": "", 
"stdout_lines": []}
matrix folder
root@anna:/matrix# ls -all
total 28
drwxr-x---  5 matrix matrix 4096 Apr 22 18:24 .
drwxr-xr-x 21 root   root   4096 Apr 22 18:24 ..
drwxr-x---  2 matrix matrix 4096 Apr 22 18:24 mailer
drwx------  3 matrix matrix 4096 Apr 22 18:25 postgres
drwxr-xr-x  3 matrix matrix 4096 Apr 22 18:24 static-files
-rw-rw----  1 matrix matrix 4168 Apr 22 18:24 vars.yml
docker ps / _ images ls / _ network ls

root@anna:/matrix# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

root@anna:/matrix# docker images ls
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

root@anna:/matrix# docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
38bfa3b7fad8   bridge    bridge    local
8c485be048f0   host      host      local
4f312e85302e   matrix    bridge    local
1d7c137528b4   none      null      local

root@anna:/matrix# docker network inspect matrix
[
    {
        "Name": "matrix",
        "Id": "4f312e85302e201ea350b17fd2e078d6a6cb937923d43407cd47b8258a88ea9d",
        "Created": "2021-04-22T18:24:31.413267944Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.21.0.0/16",
                    "Gateway": "172.21.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]

best regards, leo ^^

matebitte avatar Apr 22 '21 18:04 matebitte

I ran into a similar issue. You should try running --tags=setup-all first and then run --tags=start.

It says to do --tags=setup-all,start in the docs but I run into problems

hanthor avatar Apr 22 '21 23:04 hanthor

well, I failed to mention it, but funny enough I did run setup-all and this is the error I get when I do it.

To my understanding there should be at least some container images, but there are none

matebitte avatar Apr 23 '21 10:04 matebitte

That part of the setup is trying to apply a particular SQL file (/tmp/matrix-postgres-init-additional-db-user-and-role.sql) to your database, but the file doesn’t exist. However, the step immediately before that one in the playbook creates the file. The first thing I’d do is make sure there’s nothing weird going on with your /tmp folder (no permission issues, it exists, etc). I’m not well-versed on ansible debugging but maybe @spantaleev knows other things you could check.

thedanbob avatar Apr 23 '21 11:04 thedanbob

The same issue if you install docker through snap. Remove it completely and let the playbook to install it properly

aine-etke avatar Apr 11 '22 18:04 aine-etke

Hey there,

I ran into a little different error with the same error message:

`TASK [matrix-postgres : Execute Postgres additional database initialization SQL file for synapse] fatal: [matrix.koncha.de]: FAILED! => changed=true cmd:

  • /usr/bin/env
  • docker
  • run
  • --rm
  • --user=998:1001
  • --cap-drop=ALL
  • --env-file=/matrix/postgres/env-postgres-psql
  • --network
  • matrix
  • --mount
  • type=bind,src=/tmp/matrix-postgres-init-additional-db-user-and-role.sql,dst=/matrix-postgres-init-additional-db-user-and-role.sql,ro
  • --entrypoint=/bin/sh
  • docker.io/postgres:14.2-alpine
  • -c
  • psql -h matrix-postgres --file=/matrix-postgres-init-additional-db-user-and-role.sql delta: '0:02:10.246520' end: '2022-05-11 17:31:44.515777' msg: non-zero return code rc: 2 start: '2022-05-11 17:29:34.269257' stderr: |- psql: error: connection to server at "matrix-postgres" (172.18.0.2), port 5432 failed: Operation timed out Is the server running on that host and accepting TCP/IP connections? stderr_lines: stdout: '' stdout_lines: `

The docker container is running:

docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f5cfba1dacab postgres:14.2-alpine "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 5432/tcp matrix-postgres

Why can't the database connection established? It is a new installation of Matrix on a new Debian 11 VPS. Firewall is disabled just in case.

Thx for any hints on that, Mike

UPDATE

Solved: it was a problem with nftables. The rules were not implemented. after rebooting th vps everyting went fine.

virse avatar May 11 '22 15:05 virse