stacks-network / stacks-blockchain-docker

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

network option can have unexpected behavior when it's not really needed #77

Closed criadoperez closed 1 year ago

criadoperez commented 2 years ago

Currently, you always need to specify the network to do any command with ./manage.sh

From a user perspective, should this really be necessary for all commands?

For example: ./manage.sh -n testnet -a logs export or ./manage.sh -n testnet down

Isn't it cleaner for a user to run instead ./manage.sh -a logs export <-- Will export logs for current running network, whichever one it is ./manage.sh -a down <-- Will stop the services for current running network, whichever one it is

As well as cleaner for the user this can avoid some bugs. For example, I consider this a bug if you try to start testnet and then stop mainnet:

$ ./manage.sh -n testnet -a up
Starting all services for stacks-blockchain 
[+] Running 4/4
 ⠿ Network stacks                   Created                                                                     0.1s
 ⠿ Container postgres               Started                                                                     0.8s
 ⠿ Container stacks-blockchain-api  Started                                                                     1.2s
 ⠿ Container stacks-blockchain      Started                                                                     1.6s
[ Success ]      Brought up testnet
    Follow logs: ./manage.sh -n testnet -a logs 
$ ./manage.sh -n mainnet -a down
Stopping stacks-blockchain 
    Timeout is set for 1200 seconds 
[+] Running 1/1
 ⠿ Container stacks-blockchain  Stopped                                                                         1.1s
Stopping stacks-blockchain-api 
[+] Running 1/1
 ⠿ Container stacks-blockchain-api  Stopped                                                                     0.3s
Stopping postgres 
[+] Running 1/1
 ⠿ Container postgres  Stopped                                                                                  0.3s
Stopping all services for stacks-blockchain 
Stopping all services  
[+] Running 4/4
 ⠿ Container stacks-blockchain      Removed                                                                     0.0s
 ⠿ Container stacks-blockchain-api  Removed                                                                     1.9s
 ⠿ Container postgres               Removed                                                                     0.1s
 ⠿ Network stacks                   Removed                                                                     0.1s
[ Success ]      Brought down mainnet

Here its says Brought down mainnet when it actually brought down testnet.

To do this of course, the script will have to first figure out what network it is running.

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 1 year ago

This issue has been automatically closed. Please reopen if needed.