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

[BUG] Where is the data in PostgreSQL database? #222

Open
yaohaizhou opened this issue Feb 20, 2023 · 4 comments
Open

[BUG] Where is the data in PostgreSQL database? #222

yaohaizhou opened this issue Feb 20, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@yaohaizhou
Copy link

Describe the bug
I have deployed a Nostream relay on my server. I use Damus to post a node and it works fine. However, I cannot find any event in PostgreSQL database. How can I read the database?

To Reproduce
Steps to reproduce the behavior:

  1. docker container ls to find the container id for PostgreSQL
  2. docker exec -it id bash
  3. (inside the docker) psql -U nostr_ts_relay -W
  4. enter the passward nostr_ts_relay
  5. \d
    List of relations
    Schema | Name | Type | Owner
    --------+--------------------------------+----------+----------------
    public | events | table | nostr_ts_relay
    public | invoices | table | nostr_ts_relay
    public | knex_migrations | table | nostr_ts_relay
    public | knex_migrations_id_seq | sequence | nostr_ts_relay
    public | knex_migrations_lock | table | nostr_ts_relay
    public | knex_migrations_lock_index_seq | sequence | nostr_ts_relay
    public | users | table | nostr_ts_relay
    (7 rows)
  6. select * from events and nothing returns

PS: Also, I try to connect the database outside the docker (in Ubuntu physical machine shell), but I cannot log in.
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "nostr_ts_relay"

System (please complete the following information):

  • OS: Ubuntu 22.04.1 LTS
  • Platform: docker (./scripts/start)
  • Version:
    Docker version 23.0.1, build a5ee5b1
    node --version v12.22.9
    nostream version v1.22.3
@yaohaizhou yaohaizhou added the bug Something isn't working label Feb 20, 2023
@neilck
Copy link

neilck commented Mar 1, 2023

Nostream uses redis as a caching layer. New events do not immediately show up in nostr_ts_relay.Schemas.public.Tables.events, but will eventually. I don't know how long the delay is.

@cameri
Copy link
Owner

cameri commented Mar 1, 2023

There's no delay. Events should show automatically. Check the logs on your docker containers to see if there's an issue.

@dterhorst
Copy link

Did you forget the ; after select * from events?

select * from events;

@cameri
Copy link
Owner

cameri commented Sep 4, 2023

@zyhhhy the PostgreSQL database port is not exposed by default. You have to edit the docker-compose.yml file and edit the nostream-db section to add the ports. It's not recommended that you expose the database this way, if you do make sure the external port is not 5432 or that you have a firewall in place blocking access to this port from the outside world.

Nostream responds with an OK message with true if the event is accepted or false and a reason if the event is rejected. Use a Nostr client that lets you see this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants