VOLTTRON / volttron-docker

Docker based images for different volttron instance types.
13 stars 21 forks source link

Volttron1 container is not reentrant #54

Closed jkempf42 closed 2 years ago

jkempf42 commented 2 years ago

The bootstart.sh script runs setup_platform.py regardless of whether the container has already been initialized. This causes the _create_certs() function to error out somewhere down the stack with the following message if it has:

configparser.DuplicateOptionError: While reading from '/home/volttron/.volttron/config' [line 10]: option 'web-ssl-cert' in section 'volttron' already exists

The attached modified bootstart.txt (Github won't let me upload a .sh file) checks first if the $VOLTTRON_HOME/config file exists before running setup_platform.py preventing the error.

If someone wants to change $VOLTTRON_HOME/config, they should delete the container and rebuild it

bootstart.txt .

bonicim commented 2 years ago

@jak42 Sorry for the late response. To confirm the use case and to help reproduce this issue, does this error occur when the user would create the container on the first try, then stop the container, and then restart the container?

In other words, what are the steps (i.e. docker-compose commands) to reproduce this problem?

jkempf42 commented 2 years ago

docker-compose up docker-compose stop docker-compose run or docker-compose start

 jak

On Wed, Jan 12, 2022, 11:18 AM Mark Bonicillo @.***> wrote:

@jak42 https://github.com/jak42 Sorry for the late response. To confirm the use case and to help reproduce this issue, does this error occur when the user would create the container on the first try, then stop the container, and then restart the container?

In other words, what are the steps (i.e. docker-compose commands) to reproduce this problem?

— Reply to this email directly, view it on GitHub https://github.com/VOLTTRON/volttron-docker/issues/54#issuecomment-1011372015, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADE62GQ5OBORUY2AKTPZPL3UVXHWXANCNFSM5KPFSHPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

bonicim commented 2 years ago

I reproduced the bug and verified that this container is not reentrant. Below are the steps and expected output.

docker-compose up

docker-compose stop

docker-compose start

# OUTPUT
Requirement already satisfied: pycparser in ./.local/lib/python3.7/site-packages (from cffi>=1.0.0->argon2-cffi==20.1.0) (2.21)
Traceback (most recent call last):
  File "/home/volttron/.local/bin/volttron", line 11, in <module>
    load_entry_point('volttron', 'console_scripts', 'volttron')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/code/volttron/volttron/platform/main.py", line 87, in <module>
    from .control import ControlService
  File "/code/volttron/volttron/platform/control.py", line 111, in <module>
    message_bus = utils.get_messagebus()
  File "/code/volttron/volttron/platform/agent/utils.py", line 233, in get_messagebus
    config = load_platform_config()
  File "/code/volttron/volttron/platform/agent/utils.py", line 177, in load_platform_config
    parser.read(path)
  File "/usr/lib/python3.7/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/usr/lib/python3.7/configparser.py", line 1091, in _read
    fpname, lineno)
configparser.DuplicateOptionError: While reading from '/home/volttron/.volttron/config' [line 10]: option 'web-ssl-cert' in section 'volttron' already exists

After running docker-compose start, the container eventually exits and is no longer running. To allow users to restart containers that we're already created, I will update the bootstart script based on @jak42 previous comments and submit a PR.

bonicim commented 2 years ago

@jak42 I created a PR #62 off of your bootstart.txt to fix this issue. FYI, if you want to update code on this repo, feel free to create a PR. Also, if you plan on contributing code to Volttron, please fill out this Eclipse user form (only need to be done once): https://www.eclipse.org/legal/ECA.php

jkempf42 commented 2 years ago

Hi Mark,

Thanx for the heads up. I'll take a look at the form. I have been working on some on Volttron, but it is more extensive and would probably need a repo fork in the end, like the volttron-docker repo.

         jak

On Wed, Jan 26, 2022 at 2:08 PM Mark Bonicillo @.***> wrote:

@jak42 https://github.com/jak42 I created a PR #62 https://github.com/VOLTTRON/volttron-docker/pull/62 off of your bootstart.txt to fix this issue. FYI, if you want to update code on this repo, feel free to create a PR. Also, if you plan on contributing code to Volttron, please fill out this Eclipse user form (only need to be done once): https://www.eclipse.org/legal/ECA.php

— Reply to this email directly, view it on GitHub https://github.com/VOLTTRON/volttron-docker/issues/54#issuecomment-1022648442, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADE62GWQNCY7PKWHJPAMZLTUYBWHPANCNFSM5KPFSHPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>