Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include upgrade script for OctoPrint #4

Closed
guysoft opened this issue Aug 4, 2013 · 16 comments
Closed

Include upgrade script for OctoPrint #4

guysoft opened this issue Aug 4, 2013 · 16 comments

Comments

@guysoft
Copy link
Owner

guysoft commented Aug 4, 2013

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
@CraigRK
Copy link

CraigRK commented Mar 22, 2014

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...).

@foosel
Copy link
Collaborator

foosel commented Mar 23, 2014

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.

@CraigRK
Copy link

CraigRK commented Apr 20, 2014

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.

@foosel
Copy link
Collaborator

foosel commented Aug 7, 2014

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.

@guysoft
Copy link
Owner Author

guysoft commented Aug 7, 2014

@foosel This script uses virtualenv, its been tested.

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

@foosel
Copy link
Collaborator

foosel commented Aug 7, 2014

@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

@foosel
Copy link
Collaborator

foosel commented Dec 18, 2014

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.

@guysoft
Copy link
Owner Author

guysoft commented Dec 18, 2014

@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.

@foosel
Copy link
Collaborator

foosel commented Dec 18, 2014

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

@foosel
Copy link
Collaborator

foosel commented Dec 18, 2014

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 :/

@tiagojanz
Copy link

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.

@guysoft
Copy link
Owner Author

guysoft commented Mar 21, 2015

@seefood
Copy link

seefood commented May 6, 2015

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...

@guysoft
Copy link
Owner Author

guysoft commented May 7, 2015

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  * 

@foosel
Copy link
Collaborator

foosel commented Jul 5, 2015

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 :)

@foosel foosel closed this as completed Jul 5, 2015
@seefood
Copy link

seefood commented Aug 2, 2015

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
Projects
None yet
Development

No branches or pull requests

5 participants