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

Installing nostream #273

Open
mattsats opened this issue Mar 29, 2023 · 7 comments
Open

Installing nostream #273

mattsats opened this issue Mar 29, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@mattsats
Copy link

Hi yall, pleb here. I'm trying to spin up a nostream relay on a Ubuntu DigitalOcean VPS.

I installed Docker and cloned the repo. I run ./script/start and get the error

Attaching to nostream, nostream-cache, nostream-db, nostream-migrate
nostream-migrate  | 
nostream-migrate  | up to date in 692ms
nostream-migrate  | 
nostream-migrate  | 3 packages are looking for funding
nostream-migrate  |   run `npm fund` for details
nostream-db       | 2023-03-29 20:17:16.595 UTC [2293] FATAL:  database "nostr_ts_relay" does not exist
nostream-migrate  | database "nostr_ts_relay" does not exist
nostream-migrate  | error: database "nostr_ts_relay" does not exist
nostream-migrate  |     at Parser.parseErrorMessage (/code/node_modules/pg-protocol/dist/parser.js:287:98)
nostream-migrate  |     at Parser.handlePacket (/code/node_modules/pg-protocol/dist/parser.js:126:29)
nostream-migrate  |     at Parser.parse (/code/node_modules/pg-protocol/dist/parser.js:39:38)
nostream-migrate  |     at Socket.<anonymous> (/code/node_modules/pg-protocol/dist/index.js:11:42)
nostream-migrate  |     at Socket.emit (node:events:513:28)
nostream-migrate  |     at addChunk (node:internal/streams/readable:324:12)
nostream-migrate  |     at readableAddChunk (node:internal/streams/readable:297:9)
nostream-migrate  |     at Readable.push (node:internal/streams/readable:234:10)
nostream-migrate  |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
nostream-migrate exited with code 1
nostream-db       | 2023-03-29 20:17:16.977 UTC [2301] FATAL:  database "nostr_ts_relay" does not exist
service "nostream-migrate" didn't complete successfully: exit 1

What's going on? I thought docker would handle creating the database.

Thanks

@mattsats mattsats added the bug Something isn't working label Mar 29, 2023
@cameri
Copy link
Owner

cameri commented Mar 29, 2023

Hi! Yeah the command does handle that but it's possible the size of your VPS is too small. What are the specs on your server?

@mattsats
Copy link
Author

I'm running 1vcpu 3gb ram 60gb ssd VPS.

@cameri
Copy link
Owner

cameri commented Mar 29, 2023

Use https://pgtune.leopard.in.ua/ to tune your postgresql.conf file. With that amount of ram the postgres container fails and that's why the database is not created.

After tuning that file, make sure you delete your .nostr/data folder otherwise the postgres container won't attempt to create the database again.

@mattsats
Copy link
Author

Thanks, that fixed the db issue. Now I'm having issues with migrate, what is that?

nostream-migrate  | connect ECONNREFUSED 10.10.10.3:5432
nostream-migrate  | Error: connect ECONNREFUSED 10.10.10.3:5432
nostream-migrate  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
nostream-migrate exited with code 1
service "nostream-migrate" didn't complete successfully: exit 1

I deleted the .nostr and .nostr.local folders in the nostream main directory.

@cameri
Copy link
Owner

cameri commented Apr 4, 2023

@mattsats looks like the database isn't up.

Before starting, make sure you stop everything first:

./scripts/stop

then

./scripts/start

Make sure you run the scripts from the root of the project not from the scripts directory.

@mattsats
Copy link
Author

mattsats commented Apr 7, 2023

I think I had some issues with permissions of .nostr folder so I cloned a fresh copy and now running ./script/start I get this error:

[+] Building 81.1s (16/16) FINISHED                                                                                                
 => [internal] load build definition from Dockerfile                                                                          0.0s
 => => transferring dockerfile: 702B                                                                                          0.0s
 => [internal] load .dockerignore                                                                                             0.0s
 => => transferring context: 248B                                                                                             0.0s
 => [internal] load metadata for docker.io/library/node:18-alpine3.16                                                         0.0s
 => [internal] load build context                                                                                             0.2s
 => => transferring context: 2.87MB                                                                                           0.1s
 => [build 1/6] FROM docker.io/library/node:18-alpine3.16                                                                     0.0s
 => CACHED [stage-1 2/6] WORKDIR /app                                                                                         0.0s
 => CACHED [stage-1 3/6] RUN apk add --no-cache --update git                                                                  0.0s
 => [stage-1 4/6] ADD resources /app/resources                                                                                0.2s
 => CACHED [build 2/6] WORKDIR /build                                                                                         0.0s
 => CACHED [build 3/6] COPY [package.json, package-lock.json, ./]                                                             0.0s
 => CACHED [build 4/6] RUN npm install --quiet                                                                                0.0s
 => [build 5/6] COPY . .                                                                                                      0.2s
 => [build 6/6] RUN npm run build                                                                                            39.6s
 => [stage-1 5/6] COPY --from=build /build/dist .                                                                             0.2s 
 => [stage-1 6/6] RUN npm install --omit=dev --quiet                                                                         35.4s 
 => exporting to image                                                                                                        2.4s 
 => => exporting layers                                                                                                       2.4s 
 => => writing image sha256:b63e73eaf8afe8f89953ea12dc5a9595da8a307f595cd8033b389675af155683                                  0.0s 
 => => naming to docker.io/library/nostream-nostream                                                                          0.0s 
[+] Running 4/4                                                                                                                    
 ⠿ Container nostream-cache    Running                                                                                        0.0s 
 ⠿ Container nostream-db       Running                                                                                        0.0s
 ⠿ Container nostream-migrate  Created                                                                                        0.0s
 ⠿ Container nostream          Recreated                                                                                      0.1s
Attaching to nostream, nostream-cache, nostream-db, nostream-migrate
nostream-db       | 2023-04-07 18:07:56.760 GMT [687] FATAL:  could not open file "global/pg_filenode.map": Permission denied
nostream-db       | 2023-04-07 18:07:56.896 GMT [25] LOG:  checkpoint starting: time
nostream-db       | 2023-04-07 18:07:56.896 GMT [25] ERROR:  could not open directory "pg_logical/snapshots": Permission denied
nostream-db       | 2023-04-07 18:07:57.898 GMT [25] LOG:  checkpoint starting: time
nostream-db       | 2023-04-07 18:07:57.898 GMT [25] ERROR:  could not open directory "pg_logical/snapshots": Permission denied
nostream-db       | 2023-04-07 18:07:57.972 GMT [695] FATAL:  could not open file "global/pg_filenode.map": Permission denied
nostream-migrate  | 
nostream-migrate  | up to date in 454ms
nostream-migrate  | 
nostream-migrate  | 3 packages are looking for funding
nostream-migrate  |   run `npm fund` for details
nostream-db       | 2023-04-07 18:07:58.899 GMT [25] LOG:  checkpoint starting: time
nostream-db       | 2023-04-07 18:07:58.899 GMT [25] ERROR:  could not open directory "pg_logical/snapshots": Permission denied
nostream-db       | 2023-04-07 18:07:59.900 GMT [25] LOG:  checkpoint starting: time
nostream-db       | 2023-04-07 18:07:59.900 GMT [25] ERROR:  could not open directory "pg_logical/snapshots": Permission denied
nostream-migrate  | connect ECONNREFUSED 10.10.10.3:5432
nostream-migrate  | Error: connect ECONNREFUSED 10.10.10.3:5432
nostream-migrate  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
nostream-migrate exited with code 1
service "nostream-migrate" didn't complete successfully: exit 1

@tensor5g
Copy link

having same issue, ran start for the first time:

nostream-cache    | 1:C 19 May 2023 01:07:41.657 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
nostream-cache    | 1:C 19 May 2023 01:07:41.657 # Redis version=7.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
nostream-cache    | 1:C 19 May 2023 01:07:41.657 # Configuration loaded
nostream-cache    | 1:M 19 May 2023 01:07:41.658 # Server initialized
nostream-cache    | 1:M 19 May 2023 01:07:41.658 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
nostream-db       | The files belonging to this database system will be owned by user "postgres".
nostream-db       | This user must also own the server process.
nostream-db       |
nostream-db       | The database cluster will be initialized with locale "en_US.utf8".
nostream-db       | The default database encoding has accordingly been set to "UTF8".
nostream-db       | The default text search configuration will be set to "english".
nostream-db       |
nostream-db       | Data page checksums are disabled.
nostream-db       |
nostream-db       | fixing permissions on existing directory /var/lib/postgresql/data ... ok
nostream-db       | creating subdirectories ... ok
nostream-db       | selecting dynamic shared memory implementation ... posix
nostream-db       | selecting default max_connections ... 100
nostream-db       | selecting default shared_buffers ... 128MB
nostream-db       | selecting default time zone ... Etc/UTC
nostream-db       | creating configuration files ... ok
nostream-db       | running bootstrap script ... ok
nostream-db       | performing post-bootstrap initialization ... ok
nostream-db       | initdb: warning: enabling "trust" authentication for local connections
nostream-db       | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
nostream-db       | syncing data to disk ... ok
nostream-db       |
nostream-db       |
nostream-db       | Success. You can now start the database server using:
nostream-db       |
nostream-db       |     pg_ctl -D /var/lib/postgresql/data -l logfile start
nostream-db       |
nostream-db       | waiting for server to start....2023-05-19 01:08:12.228 UTC [90] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
nostream-db       | 2023-05-19 01:08:12.228 UTC [90] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
nostream-db       | 2023-05-19 01:08:12.341 UTC [93] LOG:  database system was shut down at 2023-05-19 01:08:11 UTC
nostream-db       | 2023-05-19 01:08:12.416 UTC [90] LOG:  database system is ready to accept connections
nostream-db       |  done
nostream-db       | server started
nostream-db       | 2023-05-19 01:08:17.096 UTC [109] FATAL:  database "nostr_ts_relay" does not exist
nostream-db       | CREATE DATABASE
nostream-db       |
nostream-db       |
nostream-db       | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
nostream-db       |
nostream-db       | 2023-05-19 01:08:19.048 UTC [90] LOG:  received fast shutdown request
nostream-db       | waiting for server to shut down....2023-05-19 01:08:19.082 UTC [90] LOG:  aborting any active transactions
nostream-db       | 2023-05-19 01:08:19.084 UTC [90] LOG:  background worker "logical replication launcher" (PID 96) exited with exit code 1
nostream-db       | 2023-05-19 01:08:19.084 UTC [91] LOG:  shutting down
nostream-db       | 2023-05-19 01:08:19.100 UTC [91] LOG:  checkpoint starting: shutdown immediate
nostream-migrate  |
nostream-migrate  | added 36 packages in 2s
nostream-migrate  |
nostream-migrate  | 3 packages are looking for funding
nostream-migrate  |   run `npm fund` for details
nostream-migrate  | npm notice
nostream-migrate  | npm notice New minor version of npm available! 9.5.1 -> 9.6.7
nostream-migrate  | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.7>
nostream-migrate  | npm notice Run `npm install -g npm@9.6.7` to update!
nostream-migrate  | npm notice
nostream-migrate  | connect ECONNREFUSED 10.10.10.3:5432
nostream-migrate  | Error: connect ECONNREFUSED 10.10.10.3:5432
nostream-migrate  |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
service "nostream-migrate" didn't complete successfully: exit 1```

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

3 participants