Weather station software WeeWX for Raspberry Pi
2.3K
Weather station software WeeWX
Please use the multi-arch image instantlinux/weewx for newer versions of this container. This is deprecated.
This includes WeeGreen skin; see the live site for an example. Two architectures are supported; look for amd64 (Intel/AMD) and armhf (Raspberry Pi) images on Docker Hub.
First create secrets as defined below, in /var/adm/admin/secrets. Ensure your weather station device (usually /dev/ttyUSB0) is read/writeable by user "weewx" (uid 2071) or by gid 20 (group "dialout") via udev rules--all other parameters can be set as below.
Then deploy this service with docker-compose; see the example docker-compose.yml. Available environment variables are below.
To create the external-facing web site, use the simple nginx.conf configuration provided here under docker swarm with the docker-compose-nginx.yml stack definition, or (even easier) under Kubernetes deploy the wx-nginx.yaml resource definition.
| Variable | Default value | Description |
|---|---|---|
| ALTITUDE | "100, foot" | elevation of station |
| LATITUDE | 50.00 | coordinates |
| LONGITUDE | -80.00 | coordinates |
| DB_BINDING_SUFFIX | mysql | suffix for db binding stanzas |
| DB_DRIVER | weedb.mysql | database driver |
| DB_HOST | db | hostname of db |
| DB_NAME | weewx_a | name of main archive database |
| DB_NAME_FORECAST | weewx_f | name of forecast database |
| DB_USER | weewx | username for db |
| DEVICE_PORT | /dev/ttyUSB0 | serial-port device |
| HTML_ROOT | /var/www/weewx | tmp directory for generating html/png images |
| LOCATION | "Anytown, USA" | location to display in banner |
| LOGGING_INTERVAL | 300 | sampling interval |
| RAIN_YEAR_START | 7 | month to start collecting annual rain data |
| RAPIDFIRE | True | enable Weather Underground realtime updates |
| RSYNC_DEST | /usr/share/nginx/html | rsync destination path |
| RSYNC_HOST | web01 | rsync destination host |
| RSYNC_PORT | 22 | rsync ssh port |
| RSYNC_USER | wx | rsync username |
| SKIN | Standard | skin to enable (Seasons, Standard, WeeGreen) |
| STATION_ID | unset | Weather Underground station ID |
| STATION_TYPE | Vantage | station type (see usersguide |
| SYSLOG_DEST | /var/log/messages | Syslog file or TCP dest (@@host:port) |
| TZ | US/Eastern | Local timezone |
| TZ_CODE | 10 | Davis VantagePro timezone code see index |
| WEEK_START | 6 | day of week to start weekly data (0 = Mon) |
| WX_USER | weewx | run-as username |
| XTIDE_LOCATION | unset | xtide setting, see index |
You can volume-mount a different skin to a subdirectory of /home/weewx/skins if you prefer one that isn't already included.
| Secret | Description |
|---|---|
| weewx-db-password | database password for MySQL |
| weewx-rsync-sshkey | private ssh key for rsync upload |
| weewx-wunderground-apikey | API key for Wunderground.com |
| weewx-wunderground-password | password for Wunderground.com |
This can't run in swarm because it needs to attach the weather stations as devices. Currently, docker-compose doesn't support "external" secrets outside a swarm so they have to be stored as plain-text files.
Tide info for US locations is generated by a library called xtide; there's no binary package for it in Alpine Linux so a somewhat complicated set of commands is included here to package it from source within Dockerfile.
Output logging from weewx is a bit of a mess: when running in foreground, a lot of verbose clutter appears on stdout; the real logs go to syslog and there's no configuration method to send these elsewhere (like stdout to conform to Docker's logging standard). So the SYSLOG_DEST environment variable provided here can provide a way to send proper logging (via the rsyslogd process included in this image) to a central syslog service.
docker pull instantlinux/weewx-armhf:latest