You are here
I just discovered that Aleksand posted on GitHub asking about how to update Snipe-IT. Rather than answer there, I thought I'd post here instead.
Please note that this only applies to a v16.x server, future releases (i.e. v17.0 or later) should be easy as the line line of this post... (TBC)
Reading the upgrade docs, it looks like git install is preferred. Unfortunately, our v16.x Snipe-IT appliance uses tarball install, so we could use the manual upgrade path. As git install is preferable, I'm aiming to move the appliance to a git install, so now is a good time to switch your server to git install too, so let's do that. This will basically be what the docs note, but we'll use the custom TurnKey tools.
First SSH in as root (or use Webshell - don't use the shell in Webmin! - it's not a proper interactive shell).
First run a backup. If you're using TKLBAM, then:
tklbam-backup --full-backup now
If you're not using TKLBAM or you want a local backup as well, then create a local backup like this (using TurnKey's PHP artisan wrapper):
turnkey-artisan snipeit:backup
Then rename the current Snipe-IT directory and clone the latest version via git:
cd /var/www mv snipe-it snipe-it-backup git clone https://github.com/snipe/snipe-it
Now fix permissions, enter the snipe-it dir and install dependencies with composer:
chown -R www-data:www-data snipe-it cd snipe-it turnkey-composer install --no-dev --prefer-source
That will likely take a little while. When it's done, copy in the required old files:
cp -R ../snipe-it-backup/public/uploads/* public/uploads cp -R ../snipe-it-backup/storage/private_uploads/* storage/private_uploads cp -R ../snipe-it-backup/storage/app/backups/* storage/app/backups cp -R ../snipe-it-backup/.env ./ cp -R ../snipe-it-backup/storage/oauth-private.key storage/oauth-private.key cp -R ../snipe-it-backup/storage/oauth-public.key storage/oauth-public.key
Then finally, you can run the update itself (migrate DB, clear cache, etc). Unfortunately this command is a little convoluted, but perhaps we'll write a helper script for that too in the future?:
runuser - www-data -s /bin/bash -c "cd /var/www/snipe-it && php upgrade.php"
Once you've done that, all future updates can be done via this same command. Although to make your life marginally easier, you could just make a helper script. We might do that for future releases... Here's what I would suggest:
cat > /usr/local/bin/turnkey-snipe-it-upgradeFrom now on, you can just run:
turnkey-snipe-it-upgrade
This is a great template Jeremy
What can be done to make information like this easy to find on different Apps would be great.
I have worked through a few upgrades (Joomla was one, Magento another).. but having a general path on any/all apps would be more than fantastic. I know that is difficult but it really makes a difference in terms of users assessments of reliability and long term usability.
I hate to be a broken record. I know that I sometimes am.
Thanks for the feedback Landis
Yes I agree. Unfortunately it all takes time and I don't always have the time. Plus, this appliance was/is particularly easy. Most of my post was copy/paste direct from their docs (with a little adjustment for our custom helper scripts) and the Snipe-IT devs provides a pretty powerful upgrade script that does most of the heavy lifting.
It'd be great if you could document your upgrades when you next do one. AN/dor if you get stuck, please do ask and I'm more than happy to do what I can to help.
As for organising, I added some tags which hopefully might make it easier to find. But perhaps we should add pages to the wiki? My only reservation is that there are already some out of date pages (which already desperately need an update) in the wiki and I don't want to just make that problem worse. Writing and maintaining docs is a full time job in and of itself really... Having said that, perhaps we could add a page for snipe-it and just link to this thread?! (Then it would be clear how old it is and how relevant it might be?! WHat do you think?
You need to set the "domain"
Assuming that you are running the TurnKey Linux Snipe-IT appliance, then you now need to set a domain. If you installed Snipe-IT via some other method (i.e. not a TurnKey appliance), then the solution below will almost certainly not help!
It is now required to set the "domain" (if you want to access via IP address, then you'll need to set the IP address as the domain). If you have an earlier version of our appliance, then you'll need to download the latest update of the Snipe-IT inithook.
Be sure to backup before downloading and running this inithook, just in case something goes wrong. Get the script and run like this:
Welcome to TurnKey, yep, run via SSH (or local terminal)
Yes, these need to be run within an interactive terminal. SSH via a native client is the best option IMO, but Webshell (via https on port 12320) is another option. If you are running your TurnKey server as some sort of VM, then using the terminal directly is likely another option. Note that Webmin's terminal isn't a complete interactive terminal, so won't work for this (or any other operation that requires interaction).
Having said all that, IMO SSH is the best way to go. I'm a Linux user and just use the built-in OpenSSH client CLI tool within a local terminal. If you are using Mac OSX, then you should already have the OpenSSH client too. If you're on Windows, you'll need to install an SSH client. A few common/popular ones are:
Once connected to your server, then you should be able to simply copy paste those instructions into the terminal (note that to paste in PuTTY, use right mouse click).
If you have any troubles and/or further questions, please let me know.
I think you are confused.
Why are you using an IP address instead of the github domain? I think you are confused.
It's not possible for an IP address to get a valid SSL cert, that's why you're getting that error. And it looks like you ar trying to download the script from yourself?! You need to SSH into your server, run the code exactly as I posted it earlier in this thread. That will download a script from GitHub, then run it. The script will be interactive and one of the steps, it will ask for a domain.
Ideally you should use a domain for your server, but if you don't want to and want to just access your Snipe-IT server web UI via IP address (i.e. type in IP in web browser address bar), then instead of a domain, input the IP address (in the interactive script - when it asks for domain).
Hopefully that clears things up a bit...?!
Upgrade not working again
Looks like you've also upgraded to Bullseye?!
It looks like you've upgraded to a Debian Bullseye/11 base as well?!
The issue you are hitting is that we've refactored Inithooks in v17.x/Bullseye so they now provide a library (the first steps in allowing inithooks and confconsole to share some code). But it appears that you don't have the current v17.x Snipe-IT inithook. It's been updated, so you should be able to just download the current one from Github.
Re running the code snippet I posted earlier in this thread should do the job:
No... I didn't upgrade the
No... I didn't upgrade the entire OS, all I did was PHP7.4 which was a requirement for Snipe IT 6+, then I ran the update as per above.
I can certainly try what you've suggested and let you know.
Keith
Oops, my bad...
My apologies, the issue should have hit me right between the eyes! The problem is that we've updated the build code in the Snipe-IT buildcode repo - to support the new (but not yet released) v17.x TurnKey Snipe-IT appliance. The code that I provided via my copy/paste instructions was literally the cause of the problem... Doh!
The fix is to download the code from that particular point in time. So mostly it's the same, just via a different URL. I.e. try this:
Hopefully that should work now. Note the specific 'commit' ID - FYI that URL provides the "raw" (aka plain text) copy of snipe-it.py file at the correct point in time.
Apologies again about that. Hopefully this last piece of guidance gets you across the line! Please let me know how you go.
Working now!
Update not working using above commands
Please share the error message
Please share the error message. Otherwise, I have no idea what might be going wrong.
Update not working using above commands
Apologies on really slow response...
I've just discovered this post (from ages ago) was stuck in the spam filter. If you log in when you post, then you will likely avoid many of the spam traps (and I can manually grant you user permissions to avoid the spam traps if you still have issues posting).
Anyway, I suspect that you may have already worked out the cause of the issue and/or discovered a workaround. Regardless, my reading of your post (after I updated the formatting so it was readable - another reason why posting as a logged in user is preferable) suggests that the primary issue is that the newer version requires a newer version of PHP than what is installed by default.
You have 2 choices there.
The first is to install a newer version of PHP on your current system. I've actually just done an up to date post on how to do that this morning.
The other option is to do a Debian style "in place" OS upgrade. The current appliance you are using (v16.x) is based on Debian Buster/10. The newer version of Debian (Bullseye/11) includes PHP 7.4 (the minimum requirement noted in your posted output). Technically an "in place" upgrade isn't "supported", but that's only because we don't have the spare cycles to exhaustively test that. We don't explicitly do anything that should cause issues with the process though, so It should still work. You just won't get all of the tweaks that we apply to the newer release. The best and most complete documentation on doing a Buster -> Bullseye upgrade can be found in the specific section of the Debian Bullseye/11 Release Notes. It's probably a bit over the top really and a number of steps can be skipped. I suggest that you also do an internet search for something like "upgrade debian buster to bullseye" for some less convoluted and explict instructions on upgrading to give you some more ideas about that. Worst case scenario, following the Debian docs should get you over the line.
Which ever way you go, once you are using a newer version of PHP (either 7.4 or 8.0) then hopefully, the upgrade will "just work".
Either way, if this is still relevant, please post back to let us know how you get on.
Add new comment