LemmyNet / lemmy-ansible

A docker deploy for ansible
GNU Affero General Public License v3.0
248 stars 92 forks source link

Error connecting to postgres after fresh install (ubuntu, raspberry pi4) #218

Closed tifriis208 closed 8 months ago

tifriis208 commented 8 months ago

Hello,

I got an issue to install lemmy with a fresh install on a raspberry pi 4 with Ubuntu 22.04.3 LTS. Playbook runs without issue.

When I connect to my lemmy instance, I got this error:

Erreur !
Une erreur s'est produite sur le serveur. Essayez d'actualiser votre navigateur. Si cela ne fonctionne pas, revenez plus tard. Si le problème persiste, vous pouvez demander de l'aide à la [Communauté d'assistance Lemmy](https://lemmy.ml/c/lemmy_support) ou à la [Groupe Matrix Lemmy](https://lemmy.ml/c/lemmy_support).

When I check logs with docker-compose logs -f lemmy, I can see:

Attaching to MYINSTANCE_lemmy_1
lemmy_1     | Lemmy v0.19.2
lemmy_1     | thread 'main' panicked at crates/db_schema/src/utils.rs:281:56:
lemmy_1     | Error connecting to postgres://lemmy:PASSWORD@postgres:5432/lemmy: connection to server at "postgres" (172.18.0.2), port 5432 failed: Connection refused
lemmy_1     |   Is the server running on that host and accepting TCP/IP connections?

I have the standard customPostgresql.conf file (the same as in example)

Any idea ?

Thanks

codyro commented 8 months ago

Do you see the postgres container running when you run docker ps? Do you see it at all with docker ps -a? If so please provide the logs from that container.

Also, please make sure you're using the latest 1.3.1 release.

You'll also want to rotate that password before you go into production ;).

tifriis208 commented 8 months ago

HI @codyro, thanks for you answer. Here what I got:

docker ps returns:

CONTAINER ID   IMAGE                        COMMAND                  CREATED       STATUS                 PORTS                                               NAMES
74935edebdea   nginx                        "/docker-entrypoint.…"   3 hours ago   Up 3 hours             80/tcp, 0.0.0.0:6182->8536/tcp, :::6182->8536/tcp   INSTANCE_proxy_1
d0bb5765e7be   dessalines/lemmy-ui:0.19.2   "docker-entrypoint.s…"   3 hours ago   Up 3 hours (healthy)   1234/tcp                                            INSTANCE_lemmy-ui_1
4901f166146c   dessalines/lemmy:0.19.2      "lemmy_server"           3 hours ago   Up 3 hours             8536/tcp                                            INSTANCE_lemmy_1
321bae76765b   postgres:15-alpine           "docker-entrypoint.s…"   3 hours ago   Up 3 hours             5432/tcp                                            INSTANCE_postgres_1
8e64c93fef35   asonix/pictrs:0.4.7          "/sbin/tini -- /usr/…"   3 hours ago   Up 3 hours             6669/tcp, 8080/tcp                                  INSTANCE_pictrs_1
f284b7cca502   mwader/postfix-relay         "/root/run"              3 hours ago   Up 3 hours             25/tcp                                              INSTANCE_postfix_1

The postgre logs seems ok:

2024-01-17 21:03:45.937 GMT [1] LOG:  starting PostgreSQL 15.5 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
2024-01-17 21:03:45.938 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-01-17 21:03:45.938 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2024-01-17 21:03:45.982 GMT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-01-17 21:03:46.088 GMT [1] LOG:  database system is ready to accept connections

git describe --tags returns 0.19.2

Thanks for your alert on the password :)

dessalines commented 8 months ago

You likely changed the password after your first run. You'll need to either uninstall, or update that /postgres/password to match what it is on the server.

tifriis208 commented 8 months ago

thanks for your return. It's quite strange, I try again to remove/install and I always got the same issue. I try a new fresh install, same issue. Anybody made a fresh install recently ?