Jeremy Davis's picture

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

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

From now on, you can just run:

L. Arnold's picture

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.

Jeremy Davis's picture

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?

Add new comment