nostream
                                
                                 nostream copied to clipboard
                                
                                    nostream copied to clipboard
                            
                            
                            
                        [BUG] Where is the data in PostgreSQL database?
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:
- docker container lsto find the container id for PostgreSQL
- docker exec -it id bash
- (inside the docker) psql -U nostr_ts_relay -W
- enter the passward nostr_ts_relay
- \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)
- select * from eventsand 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
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.
There's no delay. Events should show automatically. Check the logs on your docker containers to see if there's an issue.
Did you forget the ; after select * from events?
select * from events;
@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.