Test installation or sandbox

Begonnen von malc_b, 23 Februar 2017, 15:58:56

Vorheriges Thema - Nächstes Thema

malc_b

Hi,

Anyone have suggestions on how to have a test installation in parallel with the main fhem install?  I've recently written a function to daily check for updates in fhem and tablet ui and then email me if there are any.  This means I'm almost daily running the update.  Often the updates seem to break my installation which I'm just building at the moment so isn't live.  However, when it is live the last thing I want to do is install an update which breaks fhem or tablet ui - no heating!.  What I could do with having is a shadow installation but I can't think of how that would work with just one set of hardware.  Or I guess I could backup fhem and then restore in the event of the update breaking it but that doesn't help in fixing the break.  Suggestions?

fruit

#1
There are frequently lots of daily updates but that does not mean you need to apply any of them unless you have a problem that needs sorting - that's not to suggest it's a good idea to continue to run an outdated system of course.

I will usually check the list of updates then scan the forum to see if there may be issues with updates to any modules I use.
If all looks OK then I will update when I know I have the time to check all is well or restore if not. Sometimes it's daily, sometimes once a week or so.

Updates have rarely caused problems here, maybe twice in three years or so.
Do make sure you read about list restore and restore commands, easy enough to use - and perhaps make sure you know where to find the restore directory just in case you need to do things manually.

I also have a backup of fhem on my desktop, run manually with rsync about once a week.

Edit:
It is also worth checking https://forum.fhem.de/index.php?board=57.0 to see if there have been any very recent updates to updates.
Any from 'today' may well be corrections to earlier updates
Feel free to follow up in German if you prefer

Wuehler

#2
Hi,

I have two strategies for this issue, but it depends on the complexity of your system and the number/demands of the users.
1. backup/restore for fhem
-daily copy on my synolgy, using synolgy-timebackup for building histories
-- I'm updating about every two weeks. I never had really problems and does not need the backup yet.
-- New features configured/coded by myself normaly won't be recognised by my users until i told them or update tablet ui
2. a test site for tablet ui
- I copied the folder www/tablet/ to www/tablet_prod and gave my users only the links to tablet_prod
- an update of tablet ui will update the files in www/tablet and I am coding in www/tablet
- if everything is fine I copy the content from tablet to tablet_prod
-- More often an update cause changes in the appereance of the ui.
-- My coding of tablet ui will be recognised by the users very fast
at the end of my html-files I use some javascript so I can recognise if I am in test or prod environment:
</body>
    <script>
      if(window.location.pathname.indexOf("/tablet/") != -1 ){
        document.title="FHEM-iPad TEST";
        document.getElementsByTagName('body')[0].style.background="#000000 url('./images/custom_background_1024x768_test.jpg') 0 0 no-repeat";
      }else{
        document.title="FHEM-iPad";
        document.getElementsByTagName('body')[0].style.background="#000000 url('./images/custom_background_1024x768_prod.jpg') 0 0 no-repeat";
      }
    </script>
</html>



I hope this will help for your environment.

malc_b

To help others this is what I have done.  My system is raspberry pi as admin I use the standard fhem interface.  Users have tablet ui interface.  Usefully on android tablets you can save a chrome web page as a desktop page which looks the same as an app.  Icon for the app is defined by the wb page page so I have in the index.html head

<link rel="icon" href="Traditional-Home.png">


In WEB I have menuEntries set to


attr WEB menuEntries Update Check,cmd=update check, Backup Fhem,cmd=backup, Tablet UI copy,cmd={`./tablet-copy.sh`}, Update,cmd=update, Restart,cmd=shutdown%20restart


Which puts all the useful commands on side menu pane (I need to see if I can fix restart as that moans about losing the page).  Tablet-copy.sh is in /opt/fhem and is this


#!/bin/bash
cp -r -p /opt/fhem/www/tablet/css/* /opt/fhem/www/tabletw/css \
&& cp -r -p /opt/fhem/www/tablet/fonts/* /opt/fhem/www/tabletw/fonts \
&& cp -r -p /opt/fhem/www/tablet/js/* /opt/fhem/www/tabletw/js \
&& cp -r -p /opt/fhem/www/tablet/lib/* /opt/fhem/www/tabletw/lib \
&& echo "tablet ui copy done ok" \
|| echo "tablet ui copy failed, see log"


So my procedure is update check to read what has changed; backup to save my fhem files, tablet ui copy which copies the test tablet directory (just css, js, etc, not html files as I would expect to move those manually as I fixed or updated them) to the tablet working directory.  Then of course I can do, update and restart.

I'm assuming that I'll update, which will also update tablet ui test directory and if there are no problems I'll copy that over to the working directory before the next update.  I've not opted to backup tablet ui separately as fhem backup does that.

malc_b

I forgot to add that I know have in fhem.cfg


define TABLETUI HTTPSRV ftui/ ./www/tabletw Tablet-UI
define TABLETUIT HTTPSRV ftuit/ ./www/tablet  Tablet-UI (test)


for my working tablet ui and test tablet ui.