stacks-network / stacks-blockchain-docker

Stacks-blockchain with API using docker compose
GNU General Public License v3.0
28 stars 38 forks source link

Event replay issue #83

Closed Macxim closed 5 months ago

Macxim commented 2 years ago

When trying to start mocknet I get this

~/code/stacks-blockchain-docker master*
❯ ./manage.sh -n mocknet -a start                    

[ Warn ]         stacks-blockchain-api contains a breaking schema change ( Version: 4.0.3 )
[ Warn ]             Required to perform a stacks-blockchain-api event-replay:
[ Warn ]                 https://github.com/hirosystems/stacks-blockchain-api#event-replay 
Run event-replay now? [y/n]: y

Stacks Blockchain services are not running 

But then I do this:


~/code/stacks-blockchain-docker master* 9s
❯ ./manage.sh -n mocknet -a export                   
[ Error ]        Missing event-replay file: /Users/macxim/code/stacks-blockchain-docker/persistent-data/mainnet/event-replay/stacks-node-events.tsv
export Checking for an active event-replay import 
export Checking for a completed event-replay import 
export Checking for an active event-replay export 
export Checking for a completed event-replay export 
Starting all services for event-replay 
#STACKS_EXPORT_EVENTS_FILE=/tmp/event-replay/stacks-node-events.tsv
Creating postgres ... done
Creating stacks-blockchain-api ... done
STACKS_EXPORT_EVENTS_FILE=/tmp/event-replay/stacks-node-events.tsv
[ Success ]      Brought up mocknet
    Follow logs: ./manage.sh -n mocknet -a logs 

This operation can take a long while 
Check logs for completion: ./manage.sh -n mocknet -a logs 
    - Look for a export log entry: "Export successful." 
Once the operation is complete, restart the service with: ./manage.sh -n mocknet -a restart 

When checking logs, it seems to exit:


~/code/stacks-blockchain-docker master* 7s
❯ ./manage.sh -n mocknet -a logs 
Attaching to stacks-blockchain-api, postgres
stacks-blockchain-api    | BusyBox v1.35.0 (2022-05-09 17:27:12 UTC) multi-call binary.
stacks-blockchain-api    | 
stacks-blockchain-api    | Usage: rm [-irf] FILE...
stacks-blockchain-api    | 
stacks-blockchain-api    | Remove (unlink) FILEs
stacks-blockchain-api    | 
stacks-blockchain-api    |  -i  Always prompt before removing
stacks-blockchain-api    |  -f  Never prompt
stacks-blockchain-api    |  -R,-r   Recurse
postgres                 | The files belonging to this database system will be owned by user "postgres".
postgres                 | This user must also own the server process.
postgres                 | 
postgres                 | The database cluster will be initialized with locale "en_US.utf8".
postgres                 | The default database encoding has accordingly been set to "UTF8".
postgres                 | The default text search configuration will be set to "english".
postgres                 | 
postgres                 | Data page checksums are disabled.
postgres                 | 
postgres                 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres                 | creating subdirectories ... ok
postgres                 | selecting dynamic shared memory implementation ... posix
postgres                 | selecting default max_connections ... 100
postgres                 | selecting default shared_buffers ... 128MB
postgres                 | selecting default time zone ... UTC
postgres                 | creating configuration files ... ok
postgres                 | running bootstrap script ... ok
postgres                 | sh: locale: not found
postgres                 | 2022-07-26 05:16:19.363 UTC [30] WARNING:  no usable system locales were found
postgres                 | performing post-bootstrap initialization ... ok
postgres                 | syncing data to disk ... ok
postgres                 | 
postgres                 | 
postgres                 | Success. You can now start the database server using:
postgres                 | 
postgres                 |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres                 | 
postgres                 | initdb: warning: enabling "trust" authentication for local connections
postgres                 | You can change this by editing pg_hba.conf or using the option -A, or
postgres                 | --auth-local and --auth-host, the next time you run initdb.
postgres                 | waiting for server to start....2022-07-26 05:16:20.912 UTC [36] LOG:  starting PostgreSQL 14.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit
postgres                 | 2022-07-26 05:16:20.913 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres                 | 2022-07-26 05:16:20.921 UTC [37] LOG:  database system was shut down at 2022-07-26 05:16:20 UTC
postgres                 | 2022-07-26 05:16:20.926 UTC [36] LOG:  database system is ready to accept connections
postgres                 |  done
postgres                 | server started
postgres                 | 
postgres                 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres                 | 
postgres                 | 2022-07-26 05:16:21.027 UTC [36] LOG:  received fast shutdown request
postgres                 | waiting for server to shut down....2022-07-26 05:16:21.029 UTC [36] LOG:  aborting any active transactions
postgres                 | 2022-07-26 05:16:21.032 UTC [36] LOG:  background worker "logical replication launcher" (PID 43) exited with exit code 1
postgres                 | 2022-07-26 05:16:21.032 UTC [38] LOG:  shutting down
postgres                 | 2022-07-26 05:16:21.055 UTC [36] LOG:  database system is shut down
postgres                 |  done
postgres                 | server stopped
postgres                 | 
postgres                 | PostgreSQL init process complete; ready for start up.
postgres                 | 
postgres                 | 2022-07-26 05:16:21.171 UTC [1] LOG:  starting PostgreSQL 14.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit
postgres                 | 2022-07-26 05:16:21.171 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres                 | 2022-07-26 05:16:21.171 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres                 | 2022-07-26 05:16:21.176 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres                 | 2022-07-26 05:16:21.183 UTC [48] LOG:  database system was shut down at 2022-07-26 05:16:21 UTC
postgres                 | 2022-07-26 05:16:21.189 UTC [1] LOG:  database system is ready to accept connections
stacks-blockchain-api exited with code 1

See Docker

Screen Shot 2022-07-26 at 6 17 58 AM

What's the workaround here? What am I doing wrong?

wileyj commented 2 years ago

seems like a logic bug in the script because the event replay isn't necessary for mocknet).

i won't be able to address this for a while but if you want to send a pr it'd be welcome.

i have no way of checking this at the moment but you can try deleting all mocknet data, then restarting and not running the replay.

wileyj commented 2 years ago

the line causing the problem is https://github.com/stacks-network/stacks-blockchain-docker/blob/a62825d4ad8a76c1097526e0d07c4b5fca6f617a/manage.sh#L603

if you add in a conditional like '&& "NETWORK" != "mocknet"' it should work. typing in transit so i can't test syntax but the fix will look like what i wrote.

wileyj commented 1 year ago

seems like a logic bug in the script because the event replay isn't necessary for mocknet).

i won't be able to address this for a while but if you want to send a pr it'd be welcome.

i have no way of checking this at the moment but you can try deleting all mocknet data, then restarting and not running the replay.

On Tue, Jul 26, 2022 at 07:18 Maxime Laforet @.***> wrote:

When trying to start mocknet I get this

~/code/stacks-blockchain-docker master*

❯ ./manage.sh -n mocknet -a start

[ Warn ] stacks-blockchain-api contains a breaking schema change ( Version: 4.0.3 ) [ Warn ] Required to perform a stacks-blockchain-api event-replay: [ Warn ] https://github.com/hirosystems/stacks-blockchain-api#event-replay Run event-replay now? [y/n]: y

Stacks Blockchain services are not running

But then I do this:

~/code/stacks-blockchain-docker master* 9s

❯ ./manage.sh -n mocknet -a export [ Error ] Missing event-replay file: /Users/macxim/code/stacks-blockchain-docker/persistent-data/mainnet/event-replay/stacks-node-events.tsv export Checking for an active event-replay import export Checking for a completed event-replay import export Checking for an active event-replay export export Checking for a completed event-replay export Starting all services for event-replay

STACKS_EXPORT_EVENTS_FILE=/tmp/event-replay/stacks-node-events.tsv

Creating postgres ... done Creating stacks-blockchain-api ... done STACKS_EXPORT_EVENTS_FILE=/tmp/event-replay/stacks-node-events.tsv [ Success ] Brought up mocknet Follow logs: ./manage.sh -n mocknet -a logs

This operation can take a long while Check logs for completion: ./manage.sh -n mocknet -a logs

  • Look for a export log entry: "Export successful." Once the operation is complete, restart the service with: ./manage.sh -n mocknet -a restart

When checking logs, it seems to exit:

~/code/stacks-blockchain-docker master* 7s

❯ ./manage.sh -n mocknet -a logs Attaching to stacks-blockchain-api, postgres stacks-blockchain-api | BusyBox v1.35.0 (2022-05-09 17:27:12 UTC) multi-call binary. stacks-blockchain-api | stacks-blockchain-api | Usage: rm [-irf] FILE... stacks-blockchain-api | stacks-blockchain-api | Remove (unlink) FILEs stacks-blockchain-api | stacks-blockchain-api | -i Always prompt before removing stacks-blockchain-api | -f Never prompt stacks-blockchain-api | -R,-r Recurse postgres | The files belonging to this database system will be owned by user "postgres". postgres | This user must also own the server process. postgres | postgres | The database cluster will be initialized with locale "en_US.utf8". postgres | The default database encoding has accordingly been set to "UTF8". postgres | The default text search configuration will be set to "english". postgres | postgres | Data page checksums are disabled. postgres | postgres | fixing permissions on existing directory /var/lib/postgresql/data ... ok postgres | creating subdirectories ... ok postgres | selecting dynamic shared memory implementation ... posix postgres | selecting default max_connections ... 100 postgres | selecting default shared_buffers ... 128MB postgres | selecting default time zone ... UTC postgres | creating configuration files ... ok postgres | running bootstrap script ... ok postgres | sh: locale: not found postgres | 2022-07-26 05:16:19.363 UTC [30] WARNING: no usable system locales were found postgres | performing post-bootstrap initialization ... ok postgres | syncing data to disk ... ok postgres | postgres | postgres | Success. You can now start the database server using: postgres | postgres | pg_ctl -D /var/lib/postgresql/data -l logfile start postgres | postgres | initdb: warning: enabling "trust" authentication for local connections postgres | You can change this by editing pg_hba.conf or using the option -A, or postgres | --auth-local and --auth-host, the next time you run initdb. postgres | waiting for server to start....2022-07-26 05:16:20.912 UTC [36] LOG: starting PostgreSQL 14.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit postgres | 2022-07-26 05:16:20.913 UTC [36] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres | 2022-07-26 05:16:20.921 UTC [37] LOG: database system was shut down at 2022-07-26 05:16:20 UTC postgres | 2022-07-26 05:16:20.926 UTC [36] LOG: database system is ready to accept connections postgres | done postgres | server started postgres | postgres | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* postgres | postgres | 2022-07-26 05:16:21.027 UTC [36] LOG: received fast shutdown request postgres | waiting for server to shut down....2022-07-26 05:16:21.029 UTC [36] LOG: aborting any active transactions postgres | 2022-07-26 05:16:21.032 UTC [36] LOG: background worker "logical replication launcher" (PID 43) exited with exit code 1 postgres | 2022-07-26 05:16:21.032 UTC [38] LOG: shutting down postgres | 2022-07-26 05:16:21.055 UTC [36] LOG: database system is shut down postgres | done postgres | server stopped postgres | postgres | PostgreSQL init process complete; ready for start up. postgres | postgres | 2022-07-26 05:16:21.171 UTC [1] LOG: starting PostgreSQL 14.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, 64-bit postgres | 2022-07-26 05:16:21.171 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres | 2022-07-26 05:16:21.171 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres | 2022-07-26 05:16:21.176 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres | 2022-07-26 05:16:21.183 UTC [48] LOG: database system was shut down at 2022-07-26 05:16:21 UTC postgres | 2022-07-26 05:16:21.189 UTC [1] LOG: database system is ready to accept connections stacks-blockchain-api exited with code 1

See Docker

[image: Screen Shot 2022-07-26 at 6 17 58 AM] https://user-images.githubusercontent.com/1909957/180928971-7c69fd6b-9374-4be9-a80e-0c8f40d068e6.png

What's the workaround here? What am I doing wrong?

— Reply to this email directly, view it on GitHub https://github.com/stacks-network/stacks-blockchain-docker/issues/83, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVXIHFYEHABR2FWHLEE5ELVV5YL5ANCNFSM54URVRMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.