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

Support version 5.1.0 #345

Merged
merged 29 commits into from
Dec 28, 2024
Merged

Support version 5.1.0 #345

merged 29 commits into from
Dec 28, 2024

Conversation

felddy
Copy link
Owner

@felddy felddy commented May 25, 2024

🗣 Description

Support WeeWX v5.1.0

💭 Motivation and context

It seems people are interested, and I've finally found a few spare cycles to continue the work.
Also, I'd like to get it working with my Home Assistant setup. ;)

🧪 Testing

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced
    in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

✅ Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

✅ Post-merge checklist

  • Add a tag or create a release.

@felddy felddy self-assigned this May 25, 2024
Dockerfile Outdated Show resolved Hide resolved
@bourquep
Copy link

I'd love to see weewx-docker support weewx v5, is there anything I can do to help?

@ThomDietrich
Copy link

Hey @felddy, same question. Are you still dedicated to push this project? I think there are many interested users and willing contributors.

@mbwhite
Copy link

mbwhite commented Nov 23, 2024

Hello; I'm migrating weewx to a new machine and wanted to use docker.

Happy to help...

Just running a build myself on my own fork - I notice that the extensions have been removed.. wondering if any specific reason...

@felddy felddy force-pushed the release/5.0.2 branch 2 times, most recently from 4c1e8e2 to cbb7789 Compare November 25, 2024 21:25
@felddy felddy changed the title Release/5.0.2 Support version 5.1.0 Nov 25, 2024
@felddy
Copy link
Owner Author

felddy commented Nov 25, 2024

Hey everyone. I appreciate your interest and patience.

I've made a great deal of progress fighting the bit rot. I'm running through testing now, and making sure I've covered some of the common use cases I know about.

I hope to have a release out in the next few days. If you're either impatient or brave you can try pulling the images that are being generated by GitHub Actions for the PR at: felddy/weewx:release-5.0.2

Note

I'm targeting version 5.1.0 for this PR even though the branch is named 5.0.2. Renaming the branch would close the PR.

Stay tuned...

@mbwhite
Copy link

mbwhite commented Nov 26, 2024

Thanks @felddy I was running the PR over the weekend, most issues where related to me getting the SDR to work.
Generally though stable and working !

Thanks again:

Update confirmed that the reporting update is not connected to the docker image.

@mbwhite
Copy link

mbwhite commented Nov 30, 2024

@felddy all seems well with the image, with one exception. I've found that I needed to rebuild the base image supplying the uid I need weewx to run under. Just supplying this at runtime didn't work as there was no user of that id inside the image

@leaberry
Copy link

leaberry commented Dec 2, 2024

I have the same comment as @mbwhite, it's missing something that allows for user switching.

Dec  2 20:45:47 syslogd started: BusyBox v1.35.0
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Initializing weewxd version 5.1.0
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Command line: /opt/venv/bin/weewxd --config /data/weewx.conf
Dec  2 20:45:48 weewxd[20]: ERROR weeutil.startup: Cannot load user extensions: No module named 'user'
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Using Python: 3.13.0 (main, Nov 12 2024, 02:27:08) [GCC 12.2.0]
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Located at:   /opt/venv/bin/python
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Platform:     Linux-6.8.0-49-generic-x86_64-with-glibc2.36
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Locale:       'LC_CTYPE=C.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C'
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Entry path:   /opt/venv/bin/weewxd
Dec  2 20:45:48 weewxd[20]: INFO weewxd: WEEWX_ROOT:   /data
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Config file:  /data/weewx.conf
Dec  2 20:45:48 weewxd[20]: INFO weewxd: User module:  /data/bin/user
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Debug:        1
Dec  2 20:45:48 weewxd[20]: INFO weewxd: User unavailable: 'getpwuid(): uid not found: 2000'
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Groups unavailable: 'getgrgid(): gid not found: 2000'
Dec  2 20:45:48 weewxd[20]: DEBUG weewxd: loop_on_init: False
Dec  2 20:45:48 weewxd[20]: DEBUG weewxd: Initializing engine
Dec  2 20:45:48 weewxd[20]: INFO weewx.engine: Loading station type Interceptor (user.interceptor)
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd: Caught unrecoverable exception:
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  No module named 'user'
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  Traceback (most recent call last):
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****    File "/opt/venv/lib/python3.13/site-packages/weewxd.py", line 121, in main
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      engine = weewx.engine.StdEngine(config_dict)
Using configuration file /data/weewx.conf
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****    File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 80, in __init__
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      self.setupStation(config_dict)
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****    File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 104, in setupStation
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      __import__(driver)
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      ~~~~~~~~~~^^^^^^^^
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  ModuleNotFoundError: No module named 'user'
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  Exiting.
Traceback (most recent call last):
  File "/opt/venv/bin/weewxd", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/venv/lib/python3.13/site-packages/weewxd.py", line 121, in main
    engine = weewx.engine.StdEngine(config_dict)
  File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 80, in __init__
    self.setupStation(config_dict)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 104, in setupStation
    __import__(driver)
    ~~~~~~~~~~^^^^^^^^
ModuleNotFoundError: No module named 'user'
Switching uid:gid to 2000:2000```

@felddy
Copy link
Owner Author

felddy commented Dec 3, 2024

@felddy all seems well with the image, with one exception. I've found that I needed to rebuild the base image supplying the uid I need weewx to run under. Just supplying this at runtime didn't work as there was no user of that id inside the image

@mbwhite I'm looking into the uid/gid issue. As a workaround for now you can set the USERNAME environment variable in your docker-compose file. USERNAME: weewx is working for me.

@felddy
Copy link
Owner Author

felddy commented Dec 3, 2024

I have the same comment as @mbwhite, it's missing something that allows for user switching.

@leaberry I believe this is unrelated. You have missing extensions referenced in your configuration: user.interceptor

By properly configuring the logging options
of WeeWX to send to the console, we can
remove all the code that was required to
run as root and the drop to a different user.
@mbwhite
Copy link

mbwhite commented Dec 4, 2024

@felddy all seems well with the image, with one exception. I've found that I needed to rebuild the base image supplying the uid I need weewx to run under. Just supplying this at runtime didn't work as there was no user of that id inside the image

@mbwhite I'm looking into the uid/gid issue. As a workaround for now you can set the USERNAME environment variable in your docker-compose file. USERNAME: weewx is working for me.

It's the actual ID of the user that that I need to match. Thev data directory is mounted and if to avoid those been written out as a user I don't have on the host system.

I also need to add in extra libraries to get the SDR to work. See https://github.com/ampretia/womble-weewx

@mbwhite
Copy link

mbwhite commented Dec 4, 2024

I have the same comment as @mbwhite, it's missing something that allows for user switching.

Dec  2 20:45:47 syslogd started: BusyBox v1.35.0
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Initializing weewxd version 5.1.0
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Command line: /opt/venv/bin/weewxd --config /data/weewx.conf
Dec  2 20:45:48 weewxd[20]: ERROR weeutil.startup: Cannot load user extensions: No module named 'user'
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Using Python: 3.13.0 (main, Nov 12 2024, 02:27:08) [GCC 12.2.0]
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Located at:   /opt/venv/bin/python
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Platform:     Linux-6.8.0-49-generic-x86_64-with-glibc2.36
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Locale:       'LC_CTYPE=C.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C'
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Entry path:   /opt/venv/bin/weewxd
Dec  2 20:45:48 weewxd[20]: INFO weewxd: WEEWX_ROOT:   /data
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Config file:  /data/weewx.conf
Dec  2 20:45:48 weewxd[20]: INFO weewxd: User module:  /data/bin/user
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Debug:        1
Dec  2 20:45:48 weewxd[20]: INFO weewxd: User unavailable: 'getpwuid(): uid not found: 2000'
Dec  2 20:45:48 weewxd[20]: INFO weewxd: Groups unavailable: 'getgrgid(): gid not found: 2000'
Dec  2 20:45:48 weewxd[20]: DEBUG weewxd: loop_on_init: False
Dec  2 20:45:48 weewxd[20]: DEBUG weewxd: Initializing engine
Dec  2 20:45:48 weewxd[20]: INFO weewx.engine: Loading station type Interceptor (user.interceptor)
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd: Caught unrecoverable exception:
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  No module named 'user'
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  Traceback (most recent call last):
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****    File "/opt/venv/lib/python3.13/site-packages/weewxd.py", line 121, in main
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      engine = weewx.engine.StdEngine(config_dict)
Using configuration file /data/weewx.conf
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****    File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 80, in __init__
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      self.setupStation(config_dict)
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****    File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 104, in setupStation
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      __import__(driver)
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****      ~~~~~~~~~~^^^^^^^^
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  ModuleNotFoundError: No module named 'user'
Dec  2 20:45:48 weewxd[20]: CRITICAL weewxd:     ****  Exiting.
Traceback (most recent call last):
  File "/opt/venv/bin/weewxd", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/venv/lib/python3.13/site-packages/weewxd.py", line 121, in main
    engine = weewx.engine.StdEngine(config_dict)
  File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 80, in __init__
    self.setupStation(config_dict)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.13/site-packages/weewx/engine.py", line 104, in setupStation
    __import__(driver)
    ~~~~~~~~~~^^^^^^^^
ModuleNotFoundError: No module named 'user'
Switching uid:gid to 2000:2000```

I think there's something else going on there as well as the uid gid...

@felddy
Copy link
Owner Author

felddy commented Dec 4, 2024

It's the actual ID of the user that that I need to match. Thev data directory is mounted and if to avoid those been written out as a user I don't have on the host system.

I also need to add in extra libraries to get the SDR to work. See https://github.com/ampretia/womble-weewx

A new build was published by CI/CD that you should pull.

I've was able to simplify to the container's user management by removing the need for syslog and configuring WeeWX to use the console. Adding a user line to my docker-compose allowed me to get the correct user and group configured.

---
services:
  weewx:
    image: ghcr.io/felddy/weewx:release-5.0.2
    user: 1001:dialout
    volumes:
      - type: bind
        source: ./data
        target: /data
    devices:
      - /dev/ttyUSB0

You'll also need to configure the console logging with:

[Logging]
    [[root]]
        level = INFO
        handlers = console,

As for the SDR library. If it had been Python you can install it with:
docker compose run --rm --entrypoint pip weewx install <library-name>

And it would be saved on your data volumes Python path. Since you're bringing it in with apt-get, your approach is probably best.

Let me know if this works for you.

@felddy felddy marked this pull request as ready for review December 28, 2024 23:34
@felddy felddy merged commit ac858a6 into develop Dec 28, 2024
34 checks passed
@felddy felddy deleted the release/5.0.2 branch December 28, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants