<<< macOS WeeWX Guides >>>
Upgrading Weewx
These instructions work on MAC OSX El Capitan, and were written to upgrade from 3.0 to 3.5 of Weewx.
Get the code
First download the latest copy of the WeeWX code from the WeeWX Open Source website and store it in a directory of your choice. I have created a sub directory off of my home directory for this purpose
Installation
Change into the directory you just created, or wherever you want to install Weewx. I have used a test area under my own login area for all my testing, and I then move the installation to a secure area from which the WEB site is delivered. I would recommend that you follow a similar strategy and definitely do not expose your local area to the internet.
$ cd /Users/Mike/Weewx/
Then unzip the archive file and change into the directory that this creates
$ tar xvf weewx-X.Y.Z.tar.gz
$ cd weewx-X.Y.Z
Test Build
Unless you are very brave, or maybe have never done this before, you should ALWAYS test the upgrade before overwriting you production installation. Failure to do this may give you the opportunity to test out how good your backup regime is.
I have created a test harness that I use prior to rolling out any new code and the following steps will take you through the process I use
First edit the weewx.conf file in the new directory that you have jsut created and make the following changes
Replace
WEEWX_ROOT = /home/weewx With the directory name for your test area
WEEWX_ROOT = /Users/Mike/Dropbox/Weewx/new In my case
station_type = unspecified Initially to simulator, eventually to your weather station type
station_type = Simulator For the initial testing
HTML_ROOT = public_html With the name of your website
HTML_ROOT = MountWeather In my case
archive_interval = 300 This value from your weatherstation which may need modifying
archive_interval = 60 In my case
record_generation = hardware Retrieves the data from your weatherstation
record_generation = software Generates synthetic data, necessary to run the test harness
Then edit the setup.cfg file and point it towards your test area
Replace
home = /home/Weewx/ with the name of your test directory
home = /Users/Mike/Dropbox/Weewx/new In my case
The next step is to copy all of your production code into your test area, I prefer to do this via a script rather than run the commands manually to reduce the likely hood of errors. Below is an example fo the script I use.
$ vi CopyLiveFilestoNew.sh
LIVE_DESTINATION=/Groups/revitt/WebSites/Weewx
NEW_LOCATION=/Users/Mike/Dropbox/Weewx/new
Echo Clear down test area
Echo
sudo rm -vfr $NEW_LOCATION/*
Echo Copy Production Scripts into $NEW_LOCATION
Echo
cp -vr $LIVE_DESTINATION/* $NEW_LOCATION
Echo
Echo Done .....
Echo
:x
$ chmod 755 CopyLiveFilestoNew.sh
$ ./CopyLiveFilestoNew.sh
Then build and install the new version:
$ cd /Users/Mike/Weewx/
$ ./setup.py build
$ sudo ./setup.py install
Check that the weewx.conf file in the test area is stil utilising the simulator
$ cd /Users/Mike/Dropbox/Weewx/weewx-3.5.0
$ sudo chmod 777 weewx.conf
Edit weewx.conf
Replace
WEEWX_ROOT = /Groups/revitt/WebSites/Weewx/ This is your live area and needs to be edited
WEEWX_ROOT = /Users/Mike/Dropbox/Weewx/new In my case
station_type = unspecified Initially to simulator, eventually to your weather station type
station_type = Simulator For the initial testing
Test Run
You should now have a test environment with a complete copy of your production environment, ready for testing.
Again I prefer to do this via a script, the commnads for creating and running the script are replicated below
$ cd /Users/Mike/Dropbox/Weewx
$ vi runTest.sh
echo tail -f /var/log/system.log
/Users/Mike/Dropbox/Weewx/new/bin/weewxd /Users/Mike/Dropbox/Weewx/new/weewx.conf
$ chmod 755 runTest.sh
$ ./runTest.sh
tail -f /var/log/system.log
LOOP: 2016-03-27 12:04:22 BST (1459076662) altimeter: 32.0998981381, appTemp: 28.4601091875, barometer: 31.099999999, cloudbase: 2136.71162923, dateTime: 1459076662, dewpoint: 27.2035609939, heatindex: 32.6785829702, humidex: 32.6785829702, inDewpoint: 31.079533828, inHumidity: 29.9999999587, inTemp: 63.0000000207, maxSolarRad: 583.160267993, outHumidity: 79.999999969, outTemp: 32.6785829702, pressure: 31.099999999, radiation: 999.642540212, rain: 0, rainRate: 0, usUnits: 1, UV: 13.994995563, windchill: 32.6785829702, windDir: 359.999999814, windGust: 6.19745677e-09, windGustDir: 359.999999814, windSpeed: 5.16454790045e-09
LOOP: 2016-03-27 12:04:24 BST (1459076664) altimeter: 32.0998981296, appTemp: 28.4580736503, barometer: 31.0999999907, cloudbase: 2136.70115911, dateTime: 1459076664, dewpoint: 27.2017895837, heatindex: 32.6767654914, humidex: 32.6767654914, inDewpoint: 31.0795336993, inHumidity: 29.9999996282, inTemp: 63.0000001859, maxSolarRad: 583.193289457, outHumidity: 79.9999997211, outTemp: 32.6767654914, pressure: 31.0999999907, radiation: 999.634244561, rain: 0, rainRate: 0, usUnits: 1, UV: 13.9948794239, windchill: 32.6767654914, windDir: 359.999998327, windGust: 5.57771153709e-08, windGustDir: 359.999998327, windSpeed: 4.64809293277e-08
The tail command shows you that the simulator is generating data.
Now locate index.html in your test are, this will be within the HTML_ROOT that you specified earlier, double click it and keep refreshing to test that the new release is working as expected.
Live Build
If everything worked as expected then it is a simple task to upgrade your system
First stop your background Daemon
$ cd /Groups/revitt/WebSites/Weewx/
$ sudo launchctl unload /Library/LaunchDaemons/com.weewx.weewxd.plist
Then modify weewx.conf and setup.cfg to point to your production area.
$ vi weewx.conf
Replace
WEEWX_ROOT = /home/weewx With the directory name for your test area
WEEWX_ROOT = /Groups/revitt/WebSites/Weewx In my case
station_type = unspecified Initially to simulator, eventually to your weather station type
station_type = Vantage In my case
HTML_ROOT = public_html With the name of your website
HTML_ROOT = MountWeather In my case
$ vi setup.cfg
Replace
home = /home/Weewx With the directory name for your production area
home = /Groups/revitt/WebSites/Weewx In my case
Being paranoid I still prefer to keep a full backup of my current website before performing the upgrade, as this gives me an easy route back should it all go wrong, so copy the current website into a backup area
$ sudo cp -vfr /Groups/revitt/WebSites/Weewx/ /Users/Mike/Dropbox/Weewx/Backups/Weewx.3.0
Then stop the background Daemon and run the upgrade scripts
$ cd /Users/Mike/Dropbox/Weewx/weewx-3.5.0
$ sudo launchctl unload /Library/LaunchDaemons/com.weewx.weewxd.plist
$ ./setup.py build
$ sudo ./setup.py install
$ sudo launchctl load /Library/LaunchDaemons/com.weewx.weewxd.plist
Now log onto your website and check it out