ncarlier / readflow

readflow is a news-reading (or read-it-later) solution focused on versatility and simplicity.
https://about.readflow.app
GNU Affero General Public License v3.0
402 stars 33 forks source link

Fresh Install: Unable to get user information #79

Open AsixJin opened 1 month ago

AsixJin commented 1 month ago

I'm trying to install readflow on my server (Docker) but I just can't seem to get this working. I get a page that says it can't get user information. It seems to be an issue with the database, but I can't figure out what's going on. Below is my current docker compose:

version: "3"

services:
  ########################################
  # PostgreSQL
  ########################################
  db:
    image: postgres:14
    container_name: db_postgres
    restart: always
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=${POSTGRES_DB:-readflow}
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secert}
    volumes:
      - db-data:/var/lib/postgresql/data

  ########################################
  # readflow
  ########################################
  readflow:
    image: "ncarlier/readflow:edge"
    restart: always
    depends_on:
      - db
    ports:
      - "${PORT:-92}:8080"
    environment:
      - READFLOW_DATABASE_URI=postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-secert}@db_postgres:5432/${POSTGRES_DB:-readflow}?sslmode=disable
      - READFLOW_AUTHN_METHOD=basic
      - READFLOW_AUTHN_BASIC_HTPASSWD_FILE=file:///var/local/demo.htpasswd # "demo" as username and password
    volumes:
      - path/to/var/demo.htpasswd:/var/local/demo.htpasswd

networks:
  default:

volumes:
  db-data:

readflow container log

2024/08/06 11:52AM fatal error during command execution | error=unable to configure the database: could not validate PostgreSQL connection: dial tcp 172.22.0.2:5432: connect: connection refused command=serve
2024/08/06 11:52AM fatal error during command execution | error=unable to configure the database: could not validate PostgreSQL connection: dial tcp 172.22.0.2:5432: connect: connection refused command=serve
2024/08/06 11:52AM fatal error during command execution | error=unable to configure the database: could not validate PostgreSQL connection: dial tcp 172.22.0.2:5432: connect: connection refused command=serve
2024/08/06 11:52AM WRN Migrating Database... | version=1
2024/08/06 11:52AM WRN Migrating Database... | version=2
2024/08/06 11:52AM WRN Migrating Database... | version=3
2024/08/06 11:52AM WRN Migrating Database... | version=4
2024/08/06 11:52AM WRN Migrating Database... | version=5
2024/08/06 11:52AM WRN Migrating Database... | version=6
2024/08/06 11:52AM WRN Migrating Database... | version=7
2024/08/06 11:52AM WRN Migrating Database... | version=8
2024/08/06 11:52AM WRN Migrating Database... | version=9
2024/08/06 11:52AM WRN Migrating Database... | version=10
2024/08/06 11:52AM WRN Migrating Database... | version=11
2024/08/06 11:52AM WRN Migrating Database... | version=12
2024/08/06 11:52AM WRN Migrating Database... | version=13
2024/08/06 11:52AM WRN Migrating Database... | version=14
2024/08/06 11:52AM WRN Migrating Database... | version=15
2024/08/06 11:52AM INF using PostgreSQL database | component=database uri=postgres://postgres:xxxxx@db_postgres:5432/readflow?sslmode=disable
2024/08/06 11:52AM INF using BoltDB cache | component=cache uri=boltdb:///tmp/readflow-downloads.cache?maxSize=256,maxEntries=5000,maxEntrySize=1
2024/08/06 11:52AM INF properties loaded | component=service rev=1
2024/08/06 11:52AM INF using Basic Authentification | component=auth htpasswd=file:///var/local/demo.htpasswd
2024/08/06 11:52AM INF using Avatar provider | component=api provider=https://robohash.org/{seed}?set=set4&size=48x48
2024/08/06 11:52AM INF starting the server... | component=http addr=:8080
ncarlier commented 1 month ago

Server logs are correct. The server waits for the database to become available. As soon as Postgre is available, the database migration runs. Can you use your Browser's developer console (F12) to check the real issue (detail section of the GraphQL error response) ?

AsixJin commented 1 month ago

It seems its trying to connect to localhost:8080 when it should be my.url:92 (not the actual url but how I'm representing it here). Is there a setting I forgot to change?

createHttpLink.ts:164 

       POST http://localhost:8080/graphql net::ERR_CONNECTION_REFUSED
(anonymous) @ createHttpLink.ts:164
e @ module.js:190
t.subscribe @ module.js:264
(anonymous) @ index.ts:22
Promise.then (async)
(anonymous) @ index.ts:19
e @ module.js:190
t.subscribe @ module.js:264
(anonymous) @ index.ts:35
e @ module.js:190
t.subscribe @ module.js:264
complete @ Concast.ts:211
t.start @ Concast.ts:104
t @ Concast.ts:84
e.getObservableFromLink @ QueryManager.ts:990
e.getResultsFromLink @ QueryManager.ts:1061
g @ QueryManager.ts:1439
e.fetchQueryByPolicy @ QueryManager.ts:1471
v @ QueryManager.ts:1166
e.fetchQueryObservable @ QueryManager.ts:1207
t.fetch @ ObservableQuery.ts:692
t.reobserve @ ObservableQuery.ts:831
(anonymous) @ ObservableQuery.ts:140
e @ module.js:190
t.subscribe @ module.js:264
(anonymous) @ useQuery.ts:199
Mo @ react-dom.production.min.js:174
rl @ react-dom.production.min.js:244
yc @ react-dom.production.min.js:286
(anonymous) @ react-dom.production.min.js:282
y @ scheduler.production.min.js:13
w @ scheduler.production.min.js:14
Show 31 more frames
Show less
GraphQLContext.tsx:36 {operation: {…}, networkError: TypeError: Failed to fetch
    at http://my.url:92/static/js/main.1983908c.js:2:…, graphQLErrors: undefined, forward: ƒ}forward: ƒ (e)graphQLErrors: undefinednetworkError: TypeError: Failed to fetch
    at http://my.url:92/static/js/main.1983908c.js:2:1934175
    at new e (http://my.url:92/static/js/main.1983908c.js:2:1913826)
    at t.subscribe (http://my.url:92/static/js/main.1983908c.js:2:1914765)
    at http://my.url:92/static/js/main.1983908c.js:2:2033268operation: {variables: {…}, extensions: {…}, operationName: undefined, query: {…}, setContext: ƒ, …}[[Prototype]]: Object
(anonymous) @ GraphQLContext.tsx:36
error @ index.ts:57
Gp @ module.js:137
Yp @ module.js:176
t.error @ module.js:229
Gp @ module.js:137
Yp @ module.js:176
t.error @ module.js:229
I_ @ parseAndCheckHttpResponse.ts:172
(anonymous) @ createHttpLink.ts:177
Promise.catch (async)
(anonymous) @ createHttpLink.ts:177
e @ module.js:190
t.subscribe @ module.js:264
(anonymous) @ index.ts:22
Promise.then (async)
(anonymous) @ index.ts:19
e @ module.js:190
t.subscribe @ module.js:264
(anonymous) @ index.ts:35
e @ module.js:190
t.subscribe @ module.js:264
complete @ Concast.ts:211
t.start @ Concast.ts:104
t @ Concast.ts:84
e.getObservableFromLink @ QueryManager.ts:990
e.getResultsFromLink @ QueryManager.ts:1061
g @ QueryManager.ts:1439
e.fetchQueryByPolicy @ QueryManager.ts:1471
v @ QueryManager.ts:1166
e.fetchQueryObservable @ QueryManager.ts:1207
t.fetch @ ObservableQuery.ts:692
t.reobserve @ ObservableQuery.ts:831
(anonymous) @ ObservableQuery.ts:140
e @ module.js:190
t.subscribe @ module.js:264
(anonymous) @ useQuery.ts:199
Mo @ react-dom.production.min.js:174
rl @ react-dom.production.min.js:244
yc @ react-dom.production.min.js:286
(anonymous) @ react-dom.production.min.js:282
y @ scheduler.production.min.js:13
w @ scheduler.production.min.js:14
Show 40 more frames
Show less
Vivaldi: Link transitioned from draggable to text-selection mode.
See: https://help.vivaldi.com/?p=104354:
Vivaldi: Link transitioned from draggable to text-selection mode.
See: https://help.vivaldi.com/?p=104354:
ncarlier commented 1 month ago

Yes, you're missing this configuration: https://github.com/ncarlier/readflow/blob/master/internal/config/defaults.toml#L33

AsixJin commented 1 month ago

Still getting the error after adding the config file. Here's my new docker compose:

version: "3"

services:
  ########################################
  # PostgreSQL
  ########################################
  db:
    image: postgres:14
    container_name: db_postgres
    restart: always
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=${POSTGRES_DB:-readflow}
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secert}
    volumes:
      - db-data:/var/lib/postgresql/data

  ########################################
  # readflow
  ########################################
  readflow:
    image: "ncarlier/readflow:edge"
    restart: always
    depends_on:
      - db
    ports:
      - "${PORT:-92}:8080"
    environment:
      - READFLOW_DATABASE_URI=postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-secert}@db_postgres:5432/${POSTGRES_DB:-readflow}?sslmode=disable
      - READFLOW_AUTHN_METHOD=basic
      - READFLOW_AUTHN_BASIC_HTPASSWD_FILE=file:///var/local/demo.htpasswd # "demo" as username and password
      - READFLOW_CONFIG=/var/config.toml
    volumes:
      - /path/to/demo.htpasswd:/var/local/demo.htpasswd
      - /path/to/config.toml:/var/config.toml

networks:
  default:

volumes:
  db-data:

I copied the default config settings into my config.toml, and I'm still getting the following errors in the browser:

localhost:8080/graphql:1 

       Failed to load resource: net::ERR_CONNECTION_REFUSED
GraphQLContext.tsx:36 Objectforward: ƒ (e)graphQLErrors: undefinednetworkError: TypeError: Failed to fetch
    at http://my.url:92/static/js/main.1983908c.js:2:1934175
    at new e (http://my.url:92/static/js/main.1983908c.js:2:1913826)
    at t.subscribe (http://my.url:92/static/js/main.1983908c.js:2:1914765)
    at http://my.url:92/static/js/main.1983908c.js:2:2033268message: "Failed to fetch"stack: "TypeError: Failed to fetch\n    at http://my.url:92/static/js/main.1983908c.js:2:1934175\n    at new e (http://my.url:92/static/js/main.1983908c.js:2:1913826)\n    at t.subscribe (http://my.url:92/static/js/main.1983908c.js:2:1914765)\n    at http://my.url:92/static/js/main.1983908c.js:2:2033268"[[Prototype]]: Erroroperation: {variables: {…}, extensions: {…}, operationName: undefined, query: {…}, setContext: ƒ, …}[[Prototype]]: Object
(anonymous) @ GraphQLContext.tsx:36

I figure I must be missing or forgetting to do something, but this must be the first step in the right direction because I am getting fewer errors. Thanks again for your help.

ncarlier commented 1 month ago

Sorry, I didn't clearly state this. You don't need to copy the default configuration file, just set the corresponding configuration variable: READFLOW_HTTP_PUBLIC_URL

In your case, set READFLOW_HTTP_PUBLIC_URL=http://my.url:92

Regarding your Docker Compose:

version: "3"

services:
  ########################################
  # PostgreSQL
  ########################################
  db:
    image: postgres:14
    container_name: db_postgres
    restart: always
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=${POSTGRES_DB:-readflow}
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secert}
    volumes:
      - db-data:/var/lib/postgresql/data

  ########################################
  # readflow
  ########################################
  readflow:
    image: "ncarlier/readflow:edge"
    restart: always
    depends_on:
      - db
    ports:
      - "${PORT:-92}:8080"
    environment:
      - READFLOW_DATABASE_URI=postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-secert}@db_postgres:5432/${POSTGRES_DB:-readflow}?sslmode=disable
      - READFLOW_AUTHN_METHOD=basic
      - READFLOW_AUTHN_BASIC_HTPASSWD_FILE=file:///var/local/demo.htpasswd # "demo" as username and password
      - READFLOW_HTTP_PUBLIC_URL=http://my.url:92
    volumes:
      - path/to/var/demo.htpasswd:/var/local/demo.htpasswd

networks:
  default:

volumes:
  db-data: