From 0437118da1bc1e835c1c486ab53b48f8f0e0a2e3 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Wed, 27 Jul 2022 16:28:39 +0200 Subject: [PATCH] Bundle some defaults --- Dockerfile | 5 +- defaults/nginx.conf | 40 +++++++++++ defaults/skin-wdc/skin.conf | 128 ++++++++++++++++++++++++++++++++++++ entrypoint.sh | 10 ++- 4 files changed, 177 insertions(+), 6 deletions(-) create mode 100644 defaults/nginx.conf create mode 100644 defaults/skin-wdc/skin.conf diff --git a/Dockerfile b/Dockerfile index 0d71bd9..0831460 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,9 +42,7 @@ RUN tar --extract --gunzip --directory ${WEEWX_HOME} --strip-components=1 --file # weewx setup RUN chown -R weewx:weewx ${WEEWX_HOME} WORKDIR ${WEEWX_HOME} -RUN mkdir ${WEEWX_HOME}/user &&\ - chown weewx:weewx ${WEEWX_HOME}/user &&\ - bin/wee_extension --install /tmp/weewx-MQTTSubscribe.zip &&\ +RUN bin/wee_extension --install /tmp/weewx-MQTTSubscribe.zip &&\ bin/wee_extension --install /tmp/weewx-forecast.zip &&\ bin/wee_extension --install /tmp/weewx-GTS.zip &&\ bin/wee_extension --install /tmp/weewx-wdc @@ -81,6 +79,7 @@ RUN apt-get update -qq -y &&\ WORKDIR ${WEEWX_HOME} COPY --from=install /opt/venv /opt/venv COPY --from=install ${WEEWX_HOME} ${WEEWX_HOME} +COPY --chown=weewx:weewx defaults/ /defaults RUN mkdir /data && \ cp weewx.conf /data diff --git a/defaults/nginx.conf b/defaults/nginx.conf new file mode 100644 index 0000000..085a246 --- /dev/null +++ b/defaults/nginx.conf @@ -0,0 +1,40 @@ +worker_processes auto; +error_log off; +user weewx; + +events { + worker_connections 1024; +} + +http { + server_tokens off; + access_log off; + + include /etc/nginx/mime.types; + + sendfile on; + tcp_nopush on; + + gzip on; + gzip_vary on; + gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml; + + server { + listen 8000; + + root /data/html; + index index.html; + + location = / { + return 307 /wdc; + } + + location ~* \.(html|json)$ { + expires modified 120s; + } + + location ~* \.(js|css|png)$ { + expires 3d; + } + } +} diff --git a/defaults/skin-wdc/skin.conf b/defaults/skin-wdc/skin.conf new file mode 100644 index 0000000..b2ba494 --- /dev/null +++ b/defaults/skin-wdc/skin.conf @@ -0,0 +1,128 @@ +# configuration file for the weewx-wdc skin +SKIN_NAME = Weather Data Center +SKIN_VERSION = 1.3.3 + +[Extras] + # Show a link to the GitHub respository of this skin. Set to False to hide. + github_link = True + + # This radar image would be available as $Extras.radar_img + radar_img = https://www.dwd.de/DWD/wetter/radar/radfilm_nrw_akt.gif + # This URL will be used as the image hyperlink: + radar_url = https://www.dwd.de/DE/leistungen/radarbild_film/radarbild_film.html + + [[forecast_table_settings]] + source = Aeris + num_periods = 72 + num_days = 4 + show_legend = 1 + show_hourly = 0 + show_day = 1 + show_date = 1 + show_outlook = 1 + show_temp = 1 + show_dewpoint = 0 + show_humidity = 0 + show_wind = 1 + show_tides = 0 + show_sun = 1 + show_moon = 0 + show_pop = 1 + show_precip = 1 + show_obvis = 0 + +[DisplayOptions] + climatological_days = rainDays, summerDays, hotDays, desertDays, tropicalNights, stormDays, iceDays, frostDays + # table_tile_observations = outTemp, outHumidity, barometer, windSpeed, windGust, windDir, rain, rainRate, snowDepth, dewpoint, windchill, heatindex, appTemp, UV, ET, radiation, cloudbase, extraTemp1, extraHumid1, extraTemp2, extraHumid2, extraTemp3, extraHumid3, extraTemp4, extraHumid4, extraTemp5, extraHumid5, extraTemp6, extraHumid6, extraTemp7, extraHumid7, extraTemp8, extraHumid8, soilMoist1 + stat_tile_observations = outTemp, outHumidity, barometer, windSpeed, windGust, windDir, rain, rainRate, snowDepth, dewpoint, windchill, heatindex, appTemp, UV, ET, luminosity, radiation, cloudbase, extraTemp1, extraHumid1, extraTemp2, extraHumid2, extraTemp3, extraHumid3, extraTemp4, extraHumid4, extraTemp5, extraHumid5, extraTemp6, extraHumid6, extraTemp7, extraHumid7, extraTemp8, extraHumid8, soilTemp1, soilMoist1, lightning_strike_count + diagram_tile_observations = tempdew, outHumidity, barometer, windchill_heatindex_apptemp, wind, windDir, rain, rainRate, snowDepth, UV, ET, luminosity, radiation, cloudbase, soilTemp1, soilMoist1 + [[diagram_tile_combined_obervations]] + [[[tempdew]]] + label = 'Außentemperatur / Taupunkt' + [[[[obs]]]] + [[[[[outTemp]]]]] + [[[[[dewpoint]]]]] + + [[[windchill_heatindex_apptemp]]] + label = 'Windchill / Hitzeindex / gefühlte Temperatur' + [[[[obs]]]] + [[[[[windchill]]]]] + color = '#0099CC' + [[[[[heatindex]]]]] + color = '#610000' + [[[[[appTemp]]]]] + color = '#C41E39' + + [[[wind]]] + label = 'Windgeschwindigkeit / Böen' + [[[[obs]]]] + [[[[[windSpeed]]]]] + [[[[[windGust]]]]] + + [[[lightning_graph]]] + label = 'Blitze' + [[[[obs]]]] + [[[[[lightning_distance]]]]] + color = '#497E76' + [[[[[lightning_strike_count]]]]] + color = '#F0CA00' + +[CheetahGenerator] + encoding = html_entities + search_list_extensions = user.general_util.GeneralUtil, user.stats_util.StatsUtil, user.diagram_util.DiagramUtil, user.celestial_util.CelestialUtil, user.archive_util.ArchiveUtil, user.table_util.TableUtil, user.forecast_util.ForecastUtil + + [[SummaryByMonth]] + # Reports that summarize "by month" + [[[NOAA_month]]] + encoding = normalized_ascii + template = NOAA/NOAA-%Y-%m.txt.tmpl + #stale_age = 3600 # Every hour + [[[summary_month]]] + template = month-%Y-%m.html.tmpl + #stale_age = 3600 # Every hour + + [[SummaryByYear]] + # Reports that summarize "by year" + [[[NOAA_year]]] + encoding = normalized_ascii + template = NOAA/NOAA-%Y.txt.tmpl + #stale_age = 3600 # Every hour + [[[summary_year]]] + template = year-%Y.html.tmpl + #stale_age = 3600 # Every hour + + # Reports that show statistics "to date", such as day-to-date, + # week-to-date, month-to-date, etc. + [[ToDate]] + [[[day]]] + template = index.html.tmpl + + [[[week]]] + template = week.html.tmpl + + [[[month]]] + template = month.html.tmpl + + [[[year]]] + template = year.html.tmpl + #stale_age = 3600 # Every hour + + [[[statistics]]] + template = statistics.html.tmpl + stale_age = 10800 # Every 3 hours + + [[[celestial]]] + template = celestial.html.tmpl + + # Static pages, add as many as you want. + [[Static]] + #[[[about]]] + #template = about.html.tmpl + #title = About + +[CopyGenerator] + copy_once = dist/js/index.js, dist/scss/index.css, favicon.ico, manifest.json, icon-192x192.png, icon-256x256.png, icon-384x384.png, icon-512x512.png, service-worker.js + # copy_always = + +[Generators] + generator_list = weewx.cheetahgenerator.CheetahGenerator, weewx.reportengine.CopyGenerator diff --git a/entrypoint.sh b/entrypoint.sh index bbcb843..08a4f34 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,12 +22,16 @@ if [ "$(id -u)" = 0 ]; then # start nginx if [ -e /data/nginx.conf ]; then nginx -c /data/nginx.conf + else + nginx -c /defaults/nginx.conf fi # skin config - if [ -e /data/weewx-wdc-skin.conf ]; then - rm -f ./skins/weewx-wdc/skin.conf - ln -s /data/weewx-wdc-skin.conf ./skins/weewx-wdc/skin.conf + rm -f ./skins/weewx-wdc/skin.conf + if [ -e /data/skin-wdc/skin.conf ]; then + ln -s /data/skin-wdc/skin.conf ./skins/weewx-wdc/skin.conf + else + ln -s /defaults/skin-wdc/skin.conf ./skins/weewx-wdc/skin.conf fi if [ "${WEEWX_UID:-weewx}" != 0 ]; then