Browse Source

[weewx] Fix static file paths weewx

Colin Powell 4 years ago
parent
commit
26213b314f

+ 1 - 1
ansible/roles/weewx/files/nginx.conf

@@ -1,3 +1,3 @@
 location /wx {
-    alias /usr/local/www/weewx;
+    alias /var/weewx/public_html;
 }

+ 9 - 3
ansible/roles/weewx/files/weewx.conf

@@ -8,7 +8,7 @@
 # This section is for general configuration information.
 
 # Set to 1 for extra debug info, otherwise comment it out or set to zero
-debug = 1
+#debug = 1
 
 # Root directory of the weewx data file hierarchy for this station WEEWX_ROOT = /home/weewx
 WEEWX_ROOT = /var/weewx
@@ -101,35 +101,41 @@ loop_on_init = 1
 
 [StdReport]
     SKIN_ROOT = skins
-    HTML_ROOT = /usr/local/www/weewx/
+    HTML_ROOT = public_html
     data_binding = wx_binding
     log_success = true
     log_failure = true
-    skin = neowx-material
     
     [[SeasonsReport]]
         # The SeasonsReport uses the 'Seasons' skin, which contains the
         # images, templates and plots for the report.
         skin = Seasons
+        enable = true
+        HTML_ROOT = public_html/seasons
     
     [[SmartphoneReport]]
         # The SmartphoneReport uses the 'Smartphone' skin, and the images and
         # files are placed in a dedicated subdirectory.
         skin = Smartphone
+	enable = true
         HTML_ROOT = public_html/smartphone
     
     [[MobileReport]]
         # The MobileReport uses the 'Mobile' skin, and the images and files
         # are placed in a dedicated subdirectory.
         skin = Mobile
+	enable = true
         HTML_ROOT = public_html/mobile
 
     [[neowx-material]]
         skin = neowx-material
+        enable = true
     
     [[StandardReport]]
         # This is the old "Standard" skin. By default, it is not enabled.
         skin = Standard
+        enable = true
+        HTML_ROOT = public_html/standard
     
     [[FTP]]
         skin = Ftp

+ 44 - 0
ansible/roles/weewx/files/weewx.rc

@@ -0,0 +1,44 @@
+#!/bin/sh
+# Start script for FreeBSD, contributed by user Fabian Abplanalp
+# Put this script in /usr/local/etc/rc.d then adjust WEEWX_BIN and
+# WEEWX_CFG values in /etc/defaults/weewx
+
+WEEWX_BIN="/usr/local/bin/python3.7 /usr/local/src/weewx/weewx-4.5.1/bin/weewxd"
+WEEWX_CFG="/usr/local/etc/weewx.conf"
+WEEWX_PID="/var/run/weewx.pid"
+
+
+# Read configuration variable file if it is present
+[ -r /etc/defaults/weewx ] && . /etc/defaults/weewx
+
+case "$1" in
+  "start")
+    echo "Starting weewx..."
+    ${WEEWX_BIN} --config ${WEEWX_CFG} --daemon &
+    echo $! > ${WEEWX_PID}
+    echo "done"
+  ;;
+
+  "stop")
+    echo "Stopping weewx..."
+    if [ -f ${WEEWX_PID} ] ; then
+      kill `cat ${WEEWX_PID}`
+      rm ${WEEWX_PID}
+      echo "done"
+    else
+      echo "not running?"
+    fi
+  ;;
+
+  "restart")
+    echo "Restarting weewx..."
+    $0 stop
+    sleep 2
+    $0 start
+  ;;
+
+  *)
+    echo "$0 [start|stop|restart]"
+  ;;
+
+esac

+ 2 - 2
ansible/roles/weewx/handlers/main.yml

@@ -1,7 +1,7 @@
 ---
-- name: Supervisor restarted
+- name: WeeWX restarted
   service:
-    name: supervisord
+    name: weewx
     state: restarted
 
 - name: Nginx restarted

+ 20 - 14
ansible/roles/weewx/tasks/main.yml

@@ -27,7 +27,7 @@
 
 - name: WeeWX source unpacked
   unarchive:
-    src: https://weewx.com/downloads/weewx-4.4.0.tar.gz
+    src: https://weewx.com/downloads/weewx-4.5.1.tar.gz
     dest: /usr/local/src/weewx
     remote_src: yes
 
@@ -38,31 +38,32 @@
 
 - name: WeeWX GW1000 driver installed
   shell:
-    chdir: /usr/local/src/weewx/weewx-4.4.0/bin
+    chdir: /usr/local/src/weewx/weewx-4.5.1/bin
     cmd: python3.7 wee_extension --install=/usr/local/src/weewx/gw1000-0.2.0.tar.gz
 
 - name: WeeWX built
   shell: python3.7 ./setup.py build
   args:
-    chdir: /usr/local/src/weewx/weewx-4.4.0
+    chdir: /usr/local/src/weewx/weewx-4.5.1
 
 - name: WeeWX config file installed
   copy:
     src: weewx.conf
-    dest: /usr/local/src/weewx/weewx-4.4.0/weewx.conf
+    dest: /usr/local/etc/weewx.conf
     owner: root
     mode: 0644
-  notify: Supervisor restarted
+  notify: WeeWX restarted
 
-- name: WeeWX supervisor file installed
+- name: WeeWX rc file installed
   copy:
-    src: weewx-supervisor.conf
-    dest: /usr/local/etc/supervisor/conf.d/weewx.conf
+    src: weewx.rc
+    dest: /usr/local/etc/rc.d/weewx
     owner: root
-    mode: 0644
-  notify: Supervisor restarted
+    mode: a+x
+  notify: WeeWX restarted
+
 
-- name: WeeWX NeoWX skin file installed
+- name: WeeWX NeoWX skin file emplaced
   copy:
     src: neowx-material-latest.zip
     dest: /usr/local/src/weewx/neowx-material-latest.zip
@@ -71,11 +72,16 @@
 
 - name: WeeWX NeoWX Material skin installed
   shell:
-    chdir: /usr/local/src/weewx/weewx-4.4.0/bin
+    chdir: /usr/local/src/weewx/weewx-4.5.1/bin
     cmd: python3.7 wee_extension --install=/usr/local/src/weewx/neowx-material-latest.zip
-  notify: Supervisor restarted
+  notify: WeeWX restarted
 
 - name: WeeWX first report generated
   shell:
-    chdir: /usr/local/src/weewx/weewx-4.4.0/bin
+    chdir: /usr/local/src/weewx/weewx-4.5.1/bin
     cmd: python3.7 wee_reports
+
+- name: WeeWX started
+  service:
+    name: weewx
+    state: started