Skip to content

Include upgrade script for OctoPrint #4

Closed

Description

@guysoft

I have been thinking for a while to include a script that will let you upgrade to the latest and greatest OctoPrint, and would also include rollback support.
I have a feeling other people have already things they use, so please feel free to share your snippets so we can get the best result.

Meanwhile you can update manually using:

cd ~/OctoPrint ; git pull origin ; ~/oprint/bin/pip install -r ~/OctoPrint/requirements.txt

Activity

  1. CraigRK commented on Mar 22, 2014

    @CraigRK

    I tried the update steps noted in the Wiki, namely:
    cd ~/OctoPrint/
    git pull
    git checkout
    sudo pip install -r requirements.txt

    Which seems similar to what you are saying (but allows me to get the Devel) branch, but it lost my settings (for example my user account, etc).

    Is this normal? Do I need to somehow manually hang onto certain files, etc?

    Could someone point me to some instructions so I don't have to spend a age working it out (I'm a Git & Linux novice...).

  2. foosel commented on Mar 23, 2014

    @foosel
    Collaborator

    What does ls -la ~/.octoprint say? You should have a config.yaml and a users.yaml file there, take a look in there and check if those look like your settings.

    A git pull shouldn't cause your settings to vanish and I also do my best to make config options auto migrate when I have to change stuff there.

  3. CraigRK commented on Apr 20, 2014

    @CraigRK

    Hi Gina,

    Thanks for responding and apologies for taking so long. I thought I would not contaminate the comments with a message simply saying I would get back to you.

    Due to needing my printer in a hurry and being busy I simply restored a backup image to a spare SD card and have been using my machine.

    Today I got a chance to boot up the "faulty"(upgraded) image on a spare Raspi. And would you know, it works. Maybe I didn't reboot it properly or something, but it seems I was wrong, this seems to work fine!!

    Apologies for wasting your time.

  4. foosel commented on Aug 7, 2014

    @foosel
    Collaborator

    Just for the record, updating instructions can also be found in the OctoPrint FAQ.

    The above script will not work correctly on OctoPi since that uses a virtualenv, so you need to use the correct python and pip executables from /home/pi/oprint/bin, otherwise stuff won't work. Please use the commands from the FAQ entry instead for both updating and switching branches.

  5. guysoft commented on Aug 7, 2014

    @guysoft
    OwnerAuthor

    @foosel This script uses virtualenv, its been tested.

    Note ~/oprint/bin/pip in the line :)

  6. foosel commented on Aug 7, 2014

    @foosel
    Collaborator

    @guysoft sorry, I meant the one from this comment with my warning

    Also, with octopi 0.9 it should be ~/oprint/bin/python setup.py install, as the daemon running now refers to ~/oprint/bin/octoprint which gets installed by setup.py which in turn also takes care of fetching and installing all necessary dependencies

  7. foosel commented on Dec 18, 2014

    @foosel
    Collaborator

    Just remembered this, I've been working on an updater for OctoPrint, any OctoPrint Plugins and also OctoPi (which at the moment depends on a update tar ball with updated files + an update script included to be published with the release on github, which can be easily done). I haven't yet come around to properly document everything (a common problem for me it seems...) but I just wanted to give a heads-up that I have something that is already working tremendously well for keeping the 10 or so RPis of my colleagues updated.

  8. guysoft commented on Dec 18, 2014

    @guysoft
    OwnerAuthor

    @foosel I am not sure it would be that simple to make OctoPi update itself depending only on a tar file, because installation of deb packages might be a problem, moreover when we update the raspbian image critical things change, but I guess its worth a shot.
    Having OctoPi update is a good start though.
    Worse case we could add a notification plugin that alerts if your OctoPi version is out of date, and lets you see the new feature list.

  9. foosel commented on Dec 18, 2014

    @foosel
    Collaborator

    Installation (and removal) of deb packages so far works great. As I said, it's not just a tar file that get's unpacked, there's also an update script included that get's executed as root and can do more sophisticated stuff. Take a look at the tarballs at https://github.com/OctoPrint/OctoPiUpdates/releases

  10. foosel commented on Dec 18, 2014

    @foosel
    Collaborator

    As added information, this is the corresponding OctoPrint Plugin which checks against github if a new OctoPi release is available and knows how to perform the update and this is the actual Update plugin into which the OctoPi updater hooks itself and which can check for updates against local git repos and both branch commits on github and releases published (or not yet published) on github and update by executing an update script (in the case of OctoPrint that does the usual shenanigans with git pull, setup.py install etc) or doing a pip install of a remote package (like the plugin itself), all the while making sure to use the correct python/pip paths. It shows you a nifty little update notification and lists what's new, and also shows you a list of currently tracked components and their local and remote versions.

    image

    image

    Damn, I really need to get around to documenting all this stuff properly, it's been a bit stressy at work, so I only got to churning out all these fun new toys but not properly document them yet, sorry :/

  11. tiagojanz commented on Dec 22, 2014

    @tiagojanz

    Hi foosel,
    Could you provide a image of this octopi version, I tried to make some sense on how to apply this but I have no clues at all.

  12. guysoft commented on Mar 21, 2015

    @guysoft
    OwnerAuthor
  13. seefood commented on May 6, 2015

    @seefood

    Hey guys, so is there a way to update my OctoPi other than the pip install upgrade of the OctoPrint itself?

    If I need to get the entire image again and overwrite my image, what's the list of files I want to back up so I don't have to create new logins and API keys for Cura?

    Worth adding to the readme, I think...

  14. guysoft commented on May 7, 2015

    @guysoft
    OwnerAuthor

    Not really.

    I tried once writing a backup script, if you want you can write an analogue "restore" that should do the trick:

    #!/bin/bash
    OS_PATH=/media/path/to/sd/card
    DEST_PATH=/tmp/sdcard
    
    rm -rf ${DEST_PATH}
    mkdir -p ${DEST_PATH}
    
    backup(){
        mkdir -p ${DEST_PATH}$1
        cp -av ${OS_PATH}$1 ${DEST_PATH}$1
    }
    
    backup /home/pi/.octoprint
    backup /home/pi/OctoPiPanel/OctoPiPanel.cfg
    backup /etc/network/interfaces
    
    GLOBIGNORE=".:.."
    shopt -u dotglob
    
    pushd ${DEST_PATH}
        tar czvf backup.tar.gz  * 
  15. foosel commented on Jul 5, 2015

    @foosel
    Collaborator

    Can be closed now that OctoPrint ships with integrated update mechanism and OctoPi 0.12 will have that configured out of the box.

    Reopen if you disagree :)

  16. seefood commented on Aug 2, 2015

    @seefood

    Upgrading the OctoPrint means all the rest of the plugins and components of OctoPi are upgraded too? like the mjpeg streamer and other bits? or do those get upgraded with an apt-get upgrade?

    specifically, I have 2015-06-13_2015-05-05-octopi-wheezy-0.12.0.zip installed. should I overwrite it with the latest image or is there an in-place upgrade procedure by now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions