(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.worldOP
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 years ago

    docker exec -it lemmyname_postgres_1 /bin/bash returns the bash prompt as expected: 2ab8c789fdcd:/#

    psql -U lemmy -d lemmy successfully opens psql:

    psql (15.3)
    Type "help" for help.
    
    lemmy=# 
    

    ran select name from person; from the psql shell, it does look empty (haven’t created any users yet):

    
    ERROR:  relation "person" does not exist
    LINE 1: select name from person;
    
    • fuser@quex.cc
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      it should return an empty set. It looks like the database is running but the lemmy database tables were not installed. Can you get back to the sql prompt and try

      \dt

      if the database was installed correctly, you should see something like this:

      lemmy-# \dt

                    List of relations
      

      Schema | Name | Type | Owner

      --------±---------------------------±------±------

      public | __diesel_schema_migrations | table | lemmy

      public | activity | table | lemmy . .

      <more tables>

      . .

      public | person | table | lemmy

      . . .

      can you check that the tables are actually there? My guess is that the tables in the database weren’t created. assuming you don’t see any tables when you do this, again at the sql prompt, please try

      \c lemmy

      and see if it connects? if it does, it will say You are now connected to database “lemmy” as user “lemmy”.

      Let me know what the result of that is and we’ll try to figure out what’s gone wrong with the database setup because it looks like that’s your problem - the database was not populated when it was created.

      • aranym@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        2 years ago

        \c lemmy does return “You are now connected to database “lemmy” as user “lemmy””

        Running \dt after connecting returns “Did not find any relations”, so it looks like you were right and the database didn’t get populated.

        • fuser@quex.cc
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 years ago

          ok thanks - I’m not very familiar with the lemmy installation process so I will need to check if possibly the schema objects in the database aren’t created until the admin user is first set up, which is another possibility, but they definitely aren’t there right now - I’ll set up a fresh install to check in a few minutes.

          Switching gears a bit - when you say you can’t access the web UI, can you elaborate on that? The web server should be running. You are going to https://your.url, presumably and then what do you actually see in the browser? It should show an initial setup screen - do you not see anything or is there some kind of error message? When the ansible script runs to create the instance does it throw any errors at all or everything looks happy in the output, including creation of your ssl certs?

          • aranym@lemmy.worldOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 years ago

            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. I assume this is because the lemmy container keeps restarting (as I mentioned in my original post) because it can’t access the database.

            • fuser@quex.cc
              link
              fedilink
              English
              arrow-up
              1
              ·
              2 years ago

              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.worldOP
                link
                fedilink
                English
                arrow-up
                0
                ·
                2 years ago

                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, same error - did not find any relations.