(Using https://github.com/LemmyNet/lemmy-ansible)

The ansible-playbook command itself connected to the VPS and completed without any errors or warnings. This is on a completely fresh VPS with Ubuntu Server 22.04.

I created all directories needed in the guide, and the only file I modified was the inventory/hosts file - filling in the username/domain for SSH, domain name, contact email and adding the location of the private key for SSH.

The guide didn’t note any changes to config.hjson I needed to make, so I copied that file as requested but left it with the default content. I’m thinking if I missed something it’s most likely there.

I couldn’t access the web UI and with some investigation I found the dessalines/lemmy:0.17.4 (backend) container is continually restarting, apparently because it can’t reach the database - sudo docker container logs <id> returns the following:

thread 'main' panicked at 'Error connecting to postgres://lemmy:PasswordRedacted@postgres:5432/lemmy', crates/db_schema/src/utils.rs:161:56

I’m not sure what to do at this point, so I would be very appreciative of any help with this issue.

@aranym@lemmy.world
creator
link
fedilink
English
0
edit-2
1Y

No errors of any kind in the ansible script. nginx is running, and it’s at https://lemmy.name - I get some gateway timeout errors once in a while, but that’s all. When I do get error pages, they are served via https at least, so I don’t think there’s anything wrong with that part.

I assume this is because the lemmy backend container is continually restarting (as I detailed more in my original post and other replies here) due to database connection errors

@fuser@quex.cc
link
fedilink
English
01Y

Ok so I ran a clean install and confirmed that the database objects exist. So that’s definitely the problem. Your database is munted. An interesting thing happened when I re-ran the playbook - I noticed it didn’t rebuild the postgres container. Very suspicious! Let’s try blowing it away completely and re-running your script:

docker stop lemmyname_postgres_1

docker rm lemmyname_postgres_1

now re run the ansible playbook and let’s see if that works.

@aranym@lemmy.world
creator
link
fedilink
English
0
edit-2
1Y

Ran those commands successfully, then the playbook again. Playbook has zero errors or warnings.

The postgres container was remade… with the same broken database. Went into it with psql like before, did \c lemmy, then \dt - same error - did not find any relations.

@fuser@quex.cc
link
fedilink
English
01Y

This alternative installer might be a way around this issue: https://github.com/ubergeek77/Lemmy-Easy-Deploy

@aranym@lemmy.world
creator
link
fedilink
English
0
edit-2
1Y

Wiped the VPS clean, new 22.04 server install.

Deployed using that installer.

Exact same issue. The lemmy container cannot reach the database and continually restarts. I’ll post some logs, but they’re practically identical to what I posted before:

lemmy container logs:

`thread 'main' panicked at 'Error connecting to postgres://lemmy:PasswordRedacted@postgres:5432/lemmy', crates/db_schema/src/utils.rs:161:56

sudo docker ps output:

CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS
 PORTS                                                                                         NAMES
9eaa62ea6f99   caddy:latest                 "caddy run --config …"   12 minutes ago   Up 12 minutes
 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 443/udp, 2019/tcp   lemmy-easy-deploy-proxy-1
a10009ed128d   dessalines/lemmy-ui:0.17.4   "docker-entrypoint.s…"   12 minutes ago   Up 12 minutes
                                                                                               lemmy-easy-deploy-lemmy-ui-1
a166b1486d51   dessalines/lemmy:0.17.4      "/app/lemmy"             12 minutes ago   Restarting (101) 41 seconds ago                                                                                                 lemmy-easy-deploy-lemmy-1
08329653260b   asonix/pictrs:0.3.1          "/sbin/tini -- /usr/…"   12 minutes ago   Up 12 minutes
 6669/tcp, 8080/tcp                                                                            lemmy-easy-deploy-pictrs-1
51af8f312511   postgres:15-alpine           "docker-entrypoint.s…"   12 minutes ago   Up 12 minutes
lemmy-easy-deploy-postgres-1
@fuser@quex.cc
link
fedilink
English
11Y

well, that rules out your local system and ansible, at least. It seems like there’s an inability for the docker containers to reach postgres definitely at the install and probably at runtime - can we check this?

first let’s make sure the postgres container is on the network and has an address:

sudo docker exec -it <yourinstance>_postgres_1 /bin/sh

once you’re on the container

ifconfig

which should return on the second line: inet addr:172.18.0.4 (or similar ipV4 address)

exit to return to the host and let’s test connecting from the host :

nc -zv 172.18.0.4 5432 (use IP from the DB container)

Ubuntu host should respond something like : Connection to 172.18.0.4 5432 port [tcp/postgresql] succeeded!

now let’s try the containers

sudo docker exec -it <yourinstance>_lemmy-ui_1 /bin/sh

now from that container test connectivity to postgres:

nc -zv 172.18.0.4 5432 (use IP from the DB container)

now the other

sudo docker exec -it <yourinstance>_lemmy_1 /bin/sh

on the docker containers the nc command should return something like

172.18.0.4 (172.18.0.4:5432) open

is that working?

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 279 users / day
  • 589 users / week
  • 1.34K users / month
  • 4.55K users / 6 months
  • 1 subscriber
  • 3.5K Posts
  • 70K Comments
  • Modlog