Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install fails #38

Closed
gellenburg opened this issue May 6, 2022 · 10 comments
Closed

Fresh install fails #38

gellenburg opened this issue May 6, 2022 · 10 comments

Comments

@gellenburg
Copy link

Hi guys! Trying to get Lemmy installed on a fresh VPS (Debian 11) and receiving the following error when attempting to go to the site:

404: FetchError: request to http://lemmy:8536/api/v3/site? failed, reason: connect ECONNREFUSED 172.18.0.2:8536

Here's the results of the ansible playbook:

gme@DESKTOP-R7ILMJV:~/lemmy-ansible$ ansible-playbook -i inventory/hosts lemmy.yml

PLAY [all] *************************************************************************************************************

TASK [check lemmy_base_dir] ********************************************************************************************
skipping: [root@liewrap05.bofhllc.net]

TASK [install python for Ansible] **************************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [setup] ***********************************************************************************************************
ok: [root@liewrap05.bofhllc.net]

TASK [install dependencies] ********************************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [request initial letsencrypt certificate] *************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [create lemmy folder] *********************************************************************************************
changed: [root@liewrap05.bofhllc.net] => (item={'path': '/opt/lemmy/federated.community/', 'owner': 'root'})
changed: [root@liewrap05.bofhllc.net] => (item={'path': '/opt/lemmy/federated.community/volumes/', 'owner': 'root'})
changed: [root@liewrap05.bofhllc.net] => (item={'path': '/opt/lemmy/federated.community/volumes/pictrs/', 'owner': '991'})

TASK [set_fact] ********************************************************************************************************
ok: [root@liewrap05.bofhllc.net]

TASK [add template files] **********************************************************************************************
changed: [root@liewrap05.bofhllc.net] => (item={'src': 'templates/docker-compose.yml', 'dest': '/opt/lemmy/federated.community/docker-compose.yml', 'mode': '0600'})
changed: [root@liewrap05.bofhllc.net] => (item={'src': 'templates/nginx.conf', 'dest': '/etc/nginx/sites-available/federated.community.conf', 'mode': '0644'})

TASK [gather stats on site enabled config] *****************************************************************************
ok: [root@liewrap05.bofhllc.net]

TASK [remove if regular file (legacy) instead of symlink] **************************************************************
skipping: [root@liewrap05.bofhllc.net]

TASK [enable nginx site] ***********************************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [add the config.hjson] ********************************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [enable and start docker service] *********************************************************************************
ok: [root@liewrap05.bofhllc.net]

TASK [start docker-compose] ********************************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [reload nginx with new config] ************************************************************************************
changed: [root@liewrap05.bofhllc.net]

TASK [certbot renewal cronjob] *****************************************************************************************
changed: [root@liewrap05.bofhllc.net]

PLAY RECAP *************************************************************************************************************
root@liewrap05.bofhllc.net : ok=14   changed=10   unreachable=0    failed=0    skipped=2    rescued=0    ignored=0

gme@DESKTOP-R7ILMJV:~/lemmy-ansible$

Here's the contents of config.hjson:

{
  # for more info about the config, check out the documentation
  # https://join-lemmy.org/docs/en/administration/configuration.html

  database: {
    host: postgres
    password: "REDACTED"
  }
  hostname: "federated.community"
  pictrs_url: "http://pictrs:8080"
  federation: {
    enabled: true
  }
  email: {
    smtp_server: "REDACTED"
    smtp_from_address: "noreply@{{ domain }}"
    tls_type: "starttls"
 smtp_login: "REDACTED"
smtp_password: "REDACTED"
  }
}

Any ideas?

@dessalines
Copy link
Member

dessalines commented May 6, 2022

Show us the output for sudo docker-compose logs lemmy

Are you sure your hostname is correct? You should not have changed what's in curly braces, IE db_password or hostname, those get auto-filled. You might have to uninstall and start from scratch.

We might have to add an instruction to not change what's in the curly braces, if that's not clear.

@gellenburg
Copy link
Author

Show us the output for sudo docker-compose logs lemmy
Lots and lots of lines of:

root@localhost:/opt/lemmy/federated.community# sudo docker-compose logs lemmy | more
Attaching to federatedcommunity_lemmy_1
lemmy_1     | 2022-05-06T00:19:28.606079Z ERROR r2d2: could not connect to server: Connection refused
lemmy_1     |   Is the server running on host "postgres" (172.18.0.2) and accepting
lemmy_1     |   TCP/IP connections on port 5432?

Followed by:

lemmy_1     |     
lemmy_1     | 2022-05-06T00:19:29.811472Z ERROR r2d2: could not connect to server: Connection refused
lemmy_1     |   Is the server running on host "postgres" (172.18.0.2) and accepting
lemmy_1     |   TCP/IP connections on port 5432?
lemmy_1     |     
lemmy_1     | 2022-05-06T00:19:31.414627Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T00:19:31.416436Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T00:19:31.417937Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     

Repeated over and over again.

Are you sure your hostname is correct?

The hostname for the box? I never can get that to stick.

The box's physical hostname is liewrap05.bofhllc.net, but the instance name/ fqdn will be federated.community.

You should not have changed what's in curly braces, IE db_password or hostname, those get auto-filled.

In what file? I followed the instructions here: https://github.com/LemmyNet/lemmy-ansible

The instructions clearly state to edit config.hjson and hosts to my liking. :-(

image

@Nutomic
Copy link
Member

Nutomic commented May 6, 2022

Your database password is wrong. Make sure its identical in lemmy.hjson and docker-compose.yml, then run docker-compose up -d and docker-compose restart to apply changes.

@gellenburg
Copy link
Author

Ok, I did that. (The passwords were mismatched, I sync'd them). Still no luck:

root@localhost:/opt/lemmy# find . -iname lemmy.hjson
./federated.community/lemmy.hjson
root@localhost:/opt/lemmy# nano ./federated.community/lemmy.hjson
root@localhost:/opt/lemmy# find . -iname docker-compose.yml
./federated.community/docker-compose.yml
root@localhost:/opt/lemmy# nano ./federated.community/docker-compose.yml
root@localhost:/opt/lemmy# cd federated.community/
root@localhost:/opt/lemmy/federated.community# docker-compose up -d
Recreating federatedcommunity_postgres_1 ... 
federatedcommunity_postfix_1 is up-to-date
Recreating federatedcommunity_postgres_1 ... done
federatedcommunity_lemmy_1 is up-to-date
federatedcommunity_lemmy-ui_1 is up-to-date
root@localhost:/opt/lemmy/federated.community# docker-compose restart
Restarting federatedcommunity_postgres_1 ... done
Restarting federatedcommunity_lemmy-ui_1 ... done
Restarting federatedcommunity_lemmy_1    ... done
Restarting federatedcommunity_pictrs_1   ... done
Restarting federatedcommunity_postfix_1  ... done
root@localhost:/opt/lemmy/federated.community# 

This is what the app returns:

404: FetchError: request to http://lemmy:8536/api/v3/site? failed, reason: connect ECONNREFUSED 172.18.0.2:8536

@Nutomic
Copy link
Member

Nutomic commented May 6, 2022

You need to look at sudo docker-compose logs lemmy again. And i believe postgres only uses the password param on first start, so if they were different, you have to change the one in lemmy.hjson, not in docker-compose.yml.

@gellenburg
Copy link
Author

Same thing:

lemmy_1     | 2022-05-06T12:07:01.210718Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | thread 'main' panicked at 'Error connecting to postgres://lemmy:liewrap05@postgres:5432/lemmy', src/main.rs:66:25
lemmy_1     | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
lemmy_1     | 2022-05-06T12:07:06.538407Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T12:07:06.540477Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T12:07:06.549920Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T12:07:06.551272Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T12:07:06.551469Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T12:07:06.942295Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     
lemmy_1     | 2022-05-06T12:07:06.944246Z ERROR r2d2: FATAL:  password authentication failed for user "lemmy"
lemmy_1     |     

@gellenburg
Copy link
Author

docker-compose.yml;:

root@localhost:/opt/lemmy/federated.community# cat docker-compose.yml 
version: '2'

services:
  lemmy:
    image: dessalines/lemmy:0.16.3
    ports:
      - "127.0.0.1:22441:8536"
    restart: always
    environment:
      - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
    volumes:
      - ./lemmy.hjson:/config/config.hjson
    depends_on:
      - postgres
      - pictrs

  lemmy-ui:
    image: dessalines/lemmy-ui:0.16.3
    ports:
      - "127.0.0.1:6472:1234"
    restart: always
    environment:
      - LEMMY_INTERNAL_HOST=lemmy:8536
      - LEMMY_EXTERNAL_HOST=federated.community
      - LEMMY_HTTPS=true
    volumes:
      - ./volumes/lemmy-ui/extra_themes:/app/extra_themes
    depends_on: 
      - lemmy

  postgres:
    image: postgres:12-alpine
    environment:
      - POSTGRES_USER=lemmy
      - POSTGRES_PASSWORD=liewrap05
      - POSTGRES_DB=lemmy
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data
    restart: always

  pictrs:
    image: asonix/pictrs:0.3.1
    user: 991:991
    ports:
      - "127.0.0.1:29790:8080"
    volumes:
      - ./volumes/pictrs:/mnt
    restart: always
    mem_limit: 200m

  postfix:
    image: mwader/postfix-relay
    environment:
      - POSTFIX_myhostname=federated.community
    restart: "always"
root@localhost:/opt/lemmy/federated.community# 

lemmy.hjson:

root@localhost:/opt/lemmy/federated.community# cat lemmy.hjson 
{
  # for more info about the config, check out the documentation
  # https://join-lemmy.org/docs/en/administration/configuration.html

  database: {
    host: postgres
    password: "liewrap05"
  }
  hostname: "federated.community"
  pictrs_url: "http://pictrs:8080"
  federation: {
    enabled: true
  }
  email: {
    smtp_server: "REDACTED:587"
    smtp_from_address: "noreply@federated.community"
    tls_type: "starttls"
 smtp_login: "REDACTED"
smtp_password: "REDACTED"
  }
}

@gellenburg
Copy link
Author

I do have a dedicated Postgres server on another box. Is there a way to point Lemmy to my other Postgres server instead of relying on one running in Docker?

@dessalines
Copy link
Member

Uninstall (check the readme here for how to do that ) and start from scratch, you changed your DB password after the initial install, so it messed up the installation.

And don't mess with what's in the curly braces.

dessalines added a commit that referenced this issue May 6, 2022
@gellenburg
Copy link
Author

Ok that worked. Yeah may not want to say "edit the config as you see fit" if there's some sections that you shouldn't touch. LOL! :-)

But now I've got another problem.

Email isn't working.

Nutomic pushed a commit that referenced this issue May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants