dashpay / platform

L2 solution for seriously fast decentralized applications for the Dash network
https://dashplatform.readme.io/docs/introduction-what-is-dash-platform
MIT License
72 stars 39 forks source link

Containers do not accept new settings when restarted #98

Closed strophy closed 1 month ago

strophy commented 3 years ago

Any changes to config that affect the configuration of a container will not be applied until the container is destroyed and recreated.

Expected Behavior

Changing config and restarting containers should apply config changes

Current Behavior

Changing config and restarting containers keeps the old config

Possible Solution

It should be possible to force docker-compose to rebuild the containers with new settings from images when restarting

Steps to Reproduce (for bugs)

  1. Start node
  2. Change settings (e.g. log level)
  3. Restart node
  4. New settings are not applied

Context

Cannot reconfigure nodes

Your Environment

strophy commented 3 years ago

@shumkov can you give me instructions to reproduce this? When I run:

mn setup testnet
mn start
mn stop
mn config:set core.rpc.port 12345
mn start

The port is reconfigured in the template by mn-bootstrap as expected. The changed environment variable also causes docker-compose to rebuild all containers (example from my branch piping docker-compose stdout to process.stdout):

strophy@W540:~/Code/mn-bootstrap$ mn start
✔ Start testnet full node
  ✔ Check node is not started
  ✔ Start services 
Starting dash_masternode_testnet_drive_mongodb_1 ... done
Recreating dash_masternode_testnet_core_1        ... done
Recreating dash_masternode_testnet_drive_abci_1            ... done
Recreating dash_masternode_testnet_sentinel_1     ... done
Recreating dash_masternode_testnet_dapi_insight_1 ... done
Recreating dash_masternode_testnet_dapi_tx_filter_stream_1 ... done
Recreating dash_masternode_testnet_drive_tenderdash_1      ... done
Recreating dash_masternode_testnet_dapi_api_1              ... done
Recreating dash_masternode_testnet_dapi_envoy_1            ... done
Recreating dash_masternode_testnet_dapi_nginx_1            ... done

Which settings were not applied for you?

shumkov commented 3 years ago

You can try to change any options which are passed as envs to containers in docker-compose config. For example platform.drive.log.level.

strophy commented 3 years ago

core.rpc.port is passed as envs to containers, see here: https://github.com/dashevo/mn-bootstrap/blob/v0.18-dev/docker-compose.platform.yml#L26

Changing a config option that is passed as an env causes docker-compose to recreate the container next time it launches, because the envs have changed. The behaviour you are requesting seems to already be the case for me.

mn setup testnet
mn start
mn exec -it dash_masternode_testnet_drive_abci_1 /bin/sh
--> echo $LOGGING_LEVEL // output is "info"
--> exit
mn stop
mn config:set platform.drive.abci.logl.level debug
mn start // output is "Recreating dash_masternode_testnet_drive_abci_1            ... done"
mn exec -it dash_masternode_testnet_drive_abci_1 /bin/sh
--> echo $LOGGING_LEVEL // output is "debug"
--> exit
shumkov commented 3 years ago

Oh.. My bad. Sorry for the confusion.

shumkov commented 3 years ago

I think I got the problem. I've created .env file using mn config:envs -o .env and even if we run docker-compose from NodeJS it still reads this outdated .env file. Could you please check it, please?

If my idea is valid, maybe we should check on node start that .env is present and throw an error with a message something like "conflicting configuration detected in .env please remove it and use mn config to configure the node?

dashameter commented 3 years ago

@strophy can you confirm shumkovs notion of the issue and is it still current in v.20 master?

shumkov commented 1 month ago

Fixed