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

Cannot connect to Database #252

Closed
Gandalf-the-Blue opened this issue Aug 10, 2023 · 8 comments
Closed

Cannot connect to Database #252

Gandalf-the-Blue opened this issue Aug 10, 2023 · 8 comments

Comments

@Gandalf-the-Blue
Copy link

Hi,
This is the docker compose I am using =

version: "3.9"

services:
  postgres:
    container_name: ryot_postgres
    image: postgres:15-alpine
    restart: unless-stopped
    volumes:
      - postgres_storage:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: ryot
      POSTGRES_USER: ryot
      POSTGRES_DB: ryot
    networks:
     - ryot

  ryot:
    image: "ghcr.io/ignisda/ryot:latest"
    environment:
      - SERVER_INSECURE_COOKIE=true
      - DATABASE_URL=postgres://ryot:ryot@postgres:5432/ryot?sslmode=disable
    ports:
      - "8000:8000"
    volumes:
      - /srv/dev-disk-by-uuid-6bcdc785-ff84-4338-824f-ac76e5d9695c/docker/ryot/ryot-data:/data
    pull_policy: always
    container_name: ryot
    networks:
     - ryot

volumes:
  postgres_storage:

networks:
  ryot:
    external: true

The postgres container works fine as the logs say.
The ryot container has the following issue -

2023-08-10T15:37:29.097362Z  INFO ryot: Running version 2.3.0

thread 'main' panicked at 'Database connection failed: Conn(SqlxError(Database(PgDatabaseError { severity: Fatal, code: "28P01", message: "password authentication failed for user \"ryot\"", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("auth.c"), line: Some(326), routine: Some("auth_failed") })))', apps/backend/src/main.rs:128:10

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I do have other postgres databases also running - joplin, invidious & wallabag.

What is the issue here?

@IgnisDa
Copy link
Owner

IgnisDa commented Aug 10, 2023

Try the docker compose given in the installation docs. I think it does not have the networks property.

@Gandalf-the-Blue
Copy link
Author

OKay, just tried the given compose, only modifying this line -
"/srv/dev-disk-by-uuid-6bcdc785-ff84-4338-824f-ac76e5d9695c/docker/ryot/ryot-data:/data"

Still same error. Something else seems to be the problem.

@IgnisDa
Copy link
Owner

IgnisDa commented Aug 10, 2023

Can you try deleting the docker volume and again? Your database maybe corrupted.

@Gandalf-the-Blue
Copy link
Author

Deleted the ryot folder, created it again and did the chmod thing and redeployed the docker container.
Same result.
I think it might be due to multiple postgres instances running

@IgnisDa
Copy link
Owner

IgnisDa commented Aug 10, 2023

Yes I think so too. I think the correct database instance is not available to Ryot.

@Gandalf-the-Blue
Copy link
Author

Any ideas on how to resolve this?

@IgnisDa
Copy link
Owner

IgnisDa commented Aug 10, 2023

Cant say without debugging your docker networking configuration. I dont think it will be possible for me to solve, unless I get direct ssh access to your server.

@Gandalf-the-Blue
Copy link
Author

I guess I just solved it with some tweaking.
Posting for the next person who may have the same issue -

version: "3.9"

services:
  ryot_db:
    image: postgres:15-alpine
    restart: unless-stopped
    container_name: ryot_db
    volumes:
      - /srv/dev-disk-by-uuid-6bcdc785-ff84-4338-824f-ac76e5d9695c/docker/ryot/postgres_storage:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: <pass>
      POSTGRES_USER: <user>
      POSTGRES_DB: ryot

  ryot:
    image: "ghcr.io/ignisda/ryot:latest"
    environment:
      - SERVER_INSECURE_COOKIE=true
      - DATABASE_URL=postgres://<user>:<pass>@ryot_db:5432/ryot
    ports:
      - "8000:8000"
    volumes:
      - /srv/dev-disk-by-uuid-6bcdc785-ff84-4338-824f-ac76e5d9695c/docker/ryot/ryot-data:/data
    pull_policy: always
    container_name: ryot

volumes:
  postgres_storage:

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

2 participants