Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
191 lines (132 sloc) 7.7 KB
layout title description date sidebar comments sharing footer published
page
Import / Backup
Import data from existing emonPi Emoncms accounts
2015-03-08 21:36
true
false
true
true
true

« Previous step: Add Temperature Nodes


The Emoncms backup module can be used to backup Emoncms account data and import data from another Emoncms account. This process can also be used to migrate from an older emonPi / emonBase image to the latest image.

Currently the Backup Module can only be used with Local Emoncms not Emoncms.org

Backup / Export

Export from an older emonPi / emonBase

If the Backup module is not visible in the Local Emoncms menu then the emonPi / emonBase is running an older version e.g Emoncms V8.x.

To check what software stack (emonSD pre-built SD card) version an emonPi is running see instructions on emonPi emonSD download repository and changelog

To export data from an older emonPi:

  1. Install the backup module by running Admin > emonPi update in Local Emoncms
  2. Wait (up to) 60s for the update to begin and then another couple of minutes for it to complete; the update log page can be refreshed to view progress
  3. Log-out then back into Local Emoncms
  4. Backup module should now be visible under Extras > Backup
  5. Follow Backup instructions below

Backup

  1. Click Create Backup (see screenshot below)
  2. Wait for backup to be created, then refresh the page to view Download Backup link
  3. Download .tar.gz compressed backup

backup old data


Import / Restore

Importing / restoring a backup will overwrite ALL data in the current Emoncms account.

Note: If a new emonSD pre-built-SDcard image has been written to an SD card larger than 4GB the read-write ~/data partition should be expanded to fill the SD card to create sufficient space to import a backup. Do not use Raspbian raspi-config, instead connect via SSH) and run $ sudo emonSDexpand and follow prompts.

To import a backup:

  1. Check available disk space in the data partition (/home/pi/data), see Local Emoncms > Setup > Administration
  2. Select .tar.gz backup file
  3. Wait for upload to complete
  4. Click Import Backup
  5. Check restore log (see below)
  6. Log out then log back into Local Emocms using the imported account login credentials

Backup tar.gz filename cannot contain any spaces; e.g., if the same backup has been downloaded more than once: rename 'emoncms-backup-2016-04-23 (1).tar' to 'emoncms-backup-2016-04-23.tar' before uploading.

emonSDexpand will run ~/usefulscripts/sdpart/./sdpart_imagefile script, for more info see Useful Scripts Readme

Import

Successful import log example

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script> <script src="/javascripts/showHide.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('.show_hide').showHide({ speed: 100, // speed you want the toggle to happen //easing: '', // the animation effect you want. Remove this line if you dont want an effect and if you haven't included jQuery UI changeText: 0, // if you dont want the button text to change, set this to 0 showText: 'View',// the button text to show when a div is closed hideText: 'Close' // the button text to show when a div is open }); }); </script>

View

    Sat 23 Apr 00:42:28 UTC 2016
    Reading ~/backup/config.cfg....
    Location of mysql database: /home/pi/data
    Location of emonhub.conf: /home/pi/data
    Location of emoncms.conf: /home/pi/data
    Location of Emoncms: /var/www/emoncms
    Backup destination: /home/pi/data
    Backup source path: /home/pi/data/uploads
    Starting import from /home/pi/data/uploads to /home/pi/data...
    Image version: emonSD-29Mar16
    new image
    Backup found: emoncms-backup-2016-04-23.tar.gz starting import..
    Decompressing backup..
    Removing compressed backup to save disk space..
    Wipe any current data from account..
    Restore phpfina and phptimeseries data folders...
    Emoncms MYSQL database import...
    Import emonhub.conf > /home/pi/data/old.emohub.conf
    Import emoncms.conf > /home/pi/data/old.emoncms.conf
    Start with fresh config: copy NEW default emonpi.emonhub.conf:
    cp /home/pi/emonhub/conf/emonpi.default.emonhub.conf /home/pi/data/emonhub.conf
    OK
    Update Emoncms Database
    ["ALTER TABLE dashboard MODIFY `height` int(11) Default '600'","ALTER TABLE dashboard MODIFY `main` tinyint(1) Default '0'","ALTER TABLE dashboard MODIFY `public` tinyint(1) Default '0'","ALTER TABLE dashboard MODIFY `published` tinyint(1) Default '0'","ALTER TABLE dashboard MODIFY `showdescription` tinyint(1) Default '0'","ALTER TABLE `dashboard` ADD `backgroundcolor` varchar(6) NOT NULL DEFAULT 'EDF7FC'","ALTER TABLE feeds MODIFY `time` int(10);","ALTER TABLE feeds MODIFY `value` double;","ALTER TABLE `feeds` ADD `processList` text NOT NULL","ALTER TABLE input MODIFY `time` int(10);","ALTER TABLE users MODIFY `salt` varchar(32);","ALTER TABLE users MODIFY `timezone` varchar(64) Default 'UTC';"]
    Restarting emonhub...
    Restarting feedwriter...
    Sat 23 Apr 00:42:39 UTC 2016
    === Emoncms import complete! ===

Included in backup

  • Emoncms account credentials
  • Historic Feed data
  • Input Processing config (only when migrating from Emoncms V9 > V9 setup)
  • Dashboards
  • MyElectric / MySolarPV app settings
  • EmonHub config: emonhub.conf*

* Included in backup but not restored due to potential version conflicts: saved as old.xxxx.xxx in ~/data for manual restore if required.

Not included in backup

  • WiFi passcode & custom network config
  • Custom NodeRED flows
  • Custom openHAB settings
  • Input processing setup if migrating from Emoncms V8, input processing will need to be re-creatred after import and new inputs should be logged to imported feeds

How-to backup items not automatically included

  • nodeRED custom flows: select all flows then menu > export > clipboard copy the JSON text
  • Connect via SSH:
    • See Technical > Service Credentials
    • WiFi settings & password: backup copy: ~/data/wpa_supplicant.conf
    • openHAB custom config: copy ~/data/open_openHab folder

Video Guide

<iframe width="560" height="315" src="https://www.youtube.com/embed/5U_tOlsWjXM" frameborder="0" allowfullscreen></iframe>

Troubleshooting

If you have any questions or if an error occures during the backup or import process please post in the Hardware > emonPi category of the Community Forums. Please provide as much infomation as possible e.g. backup / import logs and emonSD version.

Alternatively try and perform a manual import, see Backup Module Readme.


Next step: Applications: