Giter VIP home page Giter VIP logo

weewx-wdc-interceptor-docker's Introduction

Test & Lint

weewx-wdc-interceptor-docker

A simple Dockerfile to run weewx with the interceptor driver. The weewx-forecast extension is also installed along with weewx-wdc, weewx-xcumulative, weewx-xaggs, weewx-GTS, and weewx-cmon.

There are branches available with weewx-DWD, weewx-mqtt and both extensions together.

WeeWX is installed via the pip installation method.

Usage

  • Make changes to the Dockerfiles install command and src/skin.conf
  • Build docker build . -t "weewx"
    • Default build args:
      • ARG WEEWX_VERSION="5.0.2"
      • ARG WDC_VERSION="v3.5.0"
  • Run docker run -d --restart unless-stopped -p 9877:9877 --name weewx weewx
  • Step into with docker exec -it weewx /bin/bash

Logs are in /var/log/syslog.

Working with named volumes

docker volume create weewx-db
docker volume create weewx-html
docker run -d --restart unless-stopped -p 9877:9877 --name weewx -v weewx-db:/home/weewx-data/archive -v weewx-html:/home/weewx-data/public_html weewx

Run nginx with weewx generated files: docker run -it --rm -d -p 8080:80 --name web -v weewx-html:/usr/share/nginx/html nginx

docker compose

A simple docker-compose.yml is included which starts a nginx server on localhost:8080.

docker compose up -d

Weather Data Center Skin or any other skin

Comment the lines 32 and 48 in the Dockerfile to deactivate the weewx-wdc skin. Or replace the download and file name with your own skin you want to install.

Admin scripts

backup.sh

Saves a backup of a named volume to the desired location. This can be run via cron to backup the SQLite DB. The backup file has a date suffix. Optionally, you can add a S3 Bucket and path as a third parameter to copy the backup to S3. The local backup gets removed in this case.

Usage: ./admin_scripts/backup.sh <VOLUME> <OUTPUT_DIRECTORY> <OPTIONAL S3 BUCKET AND PATH>

Example: "./admin_scripts/backup.sh weewx-db ./exports weewx-backup-bucket s3-bucket-name/path"

sync-s3.sh

Sync the generated HTML reports to a S3 bucket for web hosting. This needs the aws cli installed and configured. The volume path for a named volume should normally be something like /var/lib/docker/volumes/weewx-html/_data. Optionally you can add a third parameter with the Cloudfront Distribution ID to trigger an Invalidation for index.html.

For more information about AWS S3 static website hosting, see here https://docs.aws.amazon.com/AmazonS3/latest/userguide/website-hosting-custom-domain-walkthrough.html#root-domain-walkthrough-create-buckets

Usage: ./admin_scripts/sync-s3.sh <LOCAL FILE PATH> <S3 BUCKET AND PATH> <OPTIONAL CF DISTRIBUTION ID>

Example: "./admin_scripts/sync-s3.sh /var/lib/docker/volumes/weewx-html/_data weewx_web/"

I am using these two scripts as cronjobs on my PI installation:

# m h  dom mon dow   command
*/10 * * * * PATH=/usr/bin:/usr/local/bin && /home/pi/weewx-interceptor-docker/admin_scripts/sync-s3.sh /var/lib/docker/volumes/weewx-html/_data www.weewx-hbt.de/ XXXXXXXXXXXXXX
0 8 * * * PATH=/usr/bin:/usr/local/bin && /home/pi/weewx-interceptor-docker/admin_scripts/backup.sh weewx-db /tmp weewx-backup-sdb

Test

The Dockerfile is tested using dgoss:

dgoss run -p 9877:9877 weewx

Credits and further reading

https://www.dl1nux.de/erfahrungen-mit-dnt-wetterstation-weatherscreen-pro-und-weewx/

weewx-wdc-interceptor-docker's People

Contributors

daveiano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

weewx-wdc-interceptor-docker's Issues

Error when weewx-wdc skin is enabled

Thanks for creating this docker, it was exactly what I was looking for. I managed to get it all working apart from the public_html reports. After a bit of experimenting I noticed that if I disable weewx_wdc skin in the weewx.conf I got the reports.

Running wee_reports with the weewx_wdc skin enabled I get the following error:

Traceback (most recent call last):
  File "/home/weewx/bin/weewx/reportengine.py", line 197, in run
    obj.start()
  File "/home/weewx/bin/weewx/reportengine.py", line 385, in start
    self.run()
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 166, in run
    self.init_extensions(gen_dict[section_name])
  File "/home/weewx/bin/weewx/cheetahgenerator.py", line 197, in init_extensions
    klass = weeutil.weeutil.get_object(x)
  File "/home/weewx/bin/weeutil/weeutil.py", line 1150, in get_object
    mod = __import__(module)
ModuleNotFoundError: No module named 'user.forecast_util'

I'd love to get your skin working as it's by far the best looking one I've seen. Any ideas what the cause may be?

Looking to modify the requirements.txt file but I can't find it.

Hello,

I have cloned this project to customize the build but I am having issues with connecting to a remote MySQL 8 DB. It seems to come down to pip downloading and installing mysqlclient-2.2.3.tar.gz which isn't compatible with the newest MySQL. I see that the pip downloads a list of requirements from the following block of code, but for the life of me I can't find the requirements.txt file.

WORKDIR /tmp/weewx-4.10.2 RUN pip install --no-cache-dir -r ./requirements.txt && python ./setup.py build && python ./setup.py install < /tmp/install-input.txt

Since the work directory is the extracted Weewx install I have looked for requirements.txt there as well as in the src directory in the project but to no avail.

I am sure I am missing something simple, but any help would be appreciated.

Thanks,
Chris

Option to configure unit_system

Hi,

It looks like by default all data is getting stored in the US format, regardless of how it is shown in the UI. Since I'm starting from scratch, I'd like to store everything in the METRIC unit_system without having to modify the weewx.conf manually.

Would it consider adding this option?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.