Skip to content

Commit

Permalink
Merge pull request #9 from tomdotorg/weewx-5
Browse files Browse the repository at this point in the history
weewx-5
  • Loading branch information
tomdotorg authored Oct 18, 2024
2 parents 7085654 + 3fd371d commit 94aefa5
Show file tree
Hide file tree
Showing 885 changed files with 236,042 additions and 57 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ docker-weewx.code-workspace
/.vscode/
/log.txt
/tmp/
/public_html/
/archive/
/public_html/
/dist/weewx-5.0.0/weewx.conf
/weewx.conf
/archive/weewx.sdb
/keys/
90 changes: 66 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,73 @@
FROM alpine:3.17.0
MAINTAINER Tom Mitchell "[email protected]"
FROM debian:bookworm-slim

MAINTAINER Tom Mitchell "[email protected]"
ENV VERSION=5.1.0
ENV TAG=v5.1.0
ENV WEEWX_ROOT=/home/weewx/weewx-data
ENV WEEWX_VERSION=4.10.0
ENV HOME=/home/weewx
ENV TZ=America/New_York
ENV PATH=/usr/bin:$PATH

# && apt-get install curl bash python3 python3-dev python3-pip python3-venv gcc libc-dev libffi-dev tzdata rsync openssh-client openssl git -y

RUN apt-get update \
&& apt-get install wget unzip python3 python3-dev python3-pip python3-venv tzdata rsync openssh-client openssl git libffi-dev python3-setuptools libjpeg-dev -y
#RUN python3 -m pip install pip --upgrade \
# && python3 -m pip install setuptools \
# && python3 -m pip install cryptography \
# && python3 -m pip install paho-mqtt

#wget http://www.weewx.com/downloads/released_versions/weewx-4.9.1.tar.gz -O /tmp/weewx.tgz \
# && cd /tmp && tar zxvf /tmp/weewx*.tgz \
# && cd weewx-* && python3 ./setup.py build && python3 ./setup.py install --no-prompt \
RUN addgroup weewx \
&& useradd -m -g weewx weewx \
&& chown -R weewx:weewx /home/weewx \
&& chmod -R 755 /home/weewx

ADD dist/weewx-$WEEWX_VERSION /tmp/weewx/
COPY conf-fragments/ /tmp/
RUN apk add --update --no-cache --virtual deps gcc zlib-dev jpeg-dev python3-dev build-base linux-headers freetype-dev py3-pip alpine-conf \
&& apk add --no-cache python3 py3-pyserial py3-usb py3-pymysql sqlite wget rsync openssh tzdata \
&& ln -sf python3 /usr/bin/python \
&& pip3 install --no-cache --upgrade Cheetah3 Pillow image pyephem setuptools requests dnspython paho-mqtt configobj \
&& cd /tmp/weewx \
&& python3 ./setup.py build \
&& python3 ./setup.py install --no-prompt \
&& mkdir -p /var/log/weewx /tmp/weewx /home/weewx/public_html \
&& rm -rf /tmp/weewx \
&& apk del deps \
&& cat /tmp/*.conf >> /home/weewx/weewx.conf \
&& rm -rf /tmp/*.conf \
&& sed -i -e s:unspecified:Simulator: /home/weewx/weewx.conf
CMD ["/home/weewx/bin/weewxd", "/home/weewx/weewx.conf"]
USER weewx
RUN python3 -m venv /home/weewx/weewx-venv \
&& chmod -R 755 /home/weewx \
&& . /home/weewx/weewx-venv/bin/activate \
&& python3 -m pip install Pillow \
&& python3 -m pip install CT3 \
&& python3 -m pip install configobj \
&& python3 -m pip install paho-mqtt \
# If your hardware uses a serial port
&& python3 -m pip install pyserial \
# If your hardware uses a USB port
&& python3 -m pip install pyusb \
# If you want extended celestial information:
&& python3 -m pip install ephem \
# If you use MySQL or Maria
&& python3 -m pip install PyMySQL \
# If you use sqlite
&& python3 -m pip install db-sqlite3

#wget http://www.weewx.com/downloads/released_versions/weewx-4.9.1.tar.gz -O /tmp/weewx.tgz \
# && cd /tmp && tar zxvf /tmp/weewx*.tgz \
# && cd weewx-* && python3 ./setup.py build && python3 ./setup.py install --no-prompt \
RUN git clone https://github.com/weewx/weewx ~/weewx \
&& cd ~/weewx \
&& git checkout $TAG \
&& . /home/weewx/weewx-venv/bin/activate \
&& python3 ~/weewx/src/weectl.py station create --no-prompt
COPY conf-fragments/* /home/weewx/tmp/conf-fragments/
RUN mkdir -p /home/weewx/tmp \
&& cat /home/weewx/tmp/conf-fragments/* >> /home/weewx/weewx-data/weewx.conf
## Belchertown extension
RUN cd /var/tmp \
&& . /home/weewx/weewx-venv/bin/activate \
&& wget https://github.com/poblabs/weewx-belchertown/releases/download/weewx-belchertown-1.3.1/weewx-belchertown-release.1.3.1.tar.gz \
&& tar zxvf weewx-belchertown-release.1.3.1.tar.gz \
&& cd weewx-belchertown-master \
&& python3 ~/weewx/src/weectl.py extension install -y . \
&& cd /var/tmp \
&& rm -rf weewx-belchertown-release.1.3.1.tar.gz weewx-belchertown-master \
## MQTT extension
&& wget -O weewx-mqtt.zip https://github.com/matthewwall/weewx-mqtt/archive/master.zip \
&& unzip weewx-mqtt.zip \
&& cd weewx-mqtt-master \
&& . /home/weewx/weewx-venv/bin/activate \
&& python3 ~/weewx/src/weectl.py extension install -y . \
&& cd /var/tmp \
&& rm -rf weewx-mqtt.zip weewx-mqtt-master
#
ADD ./bin/run.sh $WEEWX_ROOT/bin/run.sh
CMD $WEEWX_ROOT/bin/run.sh
WORKDIR $WEEWX_ROOT
15 changes: 0 additions & 15 deletions bin/run

This file was deleted.

17 changes: 17 additions & 0 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

HOME=/home/weewx
WEEWX_ROOT=$HOME/weewx-data
CONF_FILE=$WEEWX_ROOT/weewx.conf

echo "HOME=$HOME"
echo "using $CONF_FILE"
echo "weewx is in $WEEWX_ROOT"
echo "TZ=$TZ"
cd $WEEWX_ROOT

while true; do
. /home/weewx/weewx-venv/bin/activate
python3 $HOME/weewx/src/weewxd.py $CONF_FILE > /dev/stdout
sleep 60
done
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash
VERSION=4.10.0-1
REV=2
WEEWX_VERSION=5.1.0
IMAGE_VERSION=$WEEWX_VERSION-$REV
VERSION=5.1.0-2

#docker build --no-cache -t mitct02/weewx:$VERSION .
BUILDKIT_COLORS="run=123,20,245:error=yellow:cancel=blue:warning=white" docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -t mitct02/weewx:$VERSION .
BUILDKIT_COLORS="run=123,20,245:error=yellow:cancel=blue:warning=white" docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t mitct02/weewx:$IMAGE_VERSION .
#BUILDKIT_COLORS="run=123,20,245:error=yellow:cancel=blue:warning=white" docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t mitct02/weewx:$IMAGE_VERSION .
#docker pull mitct02/weewx:$IMAGE_VERSION
18 changes: 2 additions & 16 deletions conf-fragments/logging-stdout.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#-----------------------
# ref: https://github.com/weewx/weewx/wiki/WeeWX-v4-and-logging
#
# https://groups.google.com/g/weewx-user/c/rO01k9HYR8c/m/EGiwVTGVAQAJ
#-----------------------
[Logging]
version = 1
disable_existing_loggers = False
Expand All @@ -14,16 +10,6 @@
[[loggers]]

[[handlers]]

# 10MB maxBytes
[[[rotate]]]
level = DEBUG
formatter = standard
class = logging.handlers.RotatingFileHandler
filename = /var/log/weewx.log
maxBytes = 10000000
backupCount = 4

# Log to console
[[[console]]]
level = INFO
Expand All @@ -35,9 +21,9 @@
# How to format log messages
[[formatters]]
[[[simple]]]
format = "%(levelname)s %(message)s"
format = "%(asctime)s %(levelname)s %(message)s"
[[[standard]]]
format = "{process_name}[%(process)d] %(levelname)s %(name)s: %(message)s"
format = "%(asctime)s {process_name}[%(process)d] %(levelname)s %(name)s: %(message)s"
[[[verbose]]]
format = "%(asctime)s {process_name}[%(process)d] %(levelname)s %(name)s: %(message)s"
# Format to use for dates and times:
Expand Down
Loading

0 comments on commit 94aefa5

Please sign in to comment.