@hobbit666 You can use either way, they both accomplish the same thing that is downloading the newest source files.
Step 1: Backup your database
While logged in, go to Admin > Backups and generate a new backup. Download that file and keep it somewhere safe, in case you need to restore back to that version if something goes wrong with your upgrade.
Step 2: Backup your old version
The easiest way to do this will be to just rename your old Snipe-IT install directory and create a new, empty directory that uses the old directory name, but you can handle this any way that works for you.
For example, if your Snipe-IT was installed in /var/www/snipe-it, you could rename that directory to /var/www/snipe-it-backup and then create a new directory /var/www/snipe-it.
Step 3: Download/clone the new release
Download the zip from: https://github.com/snipe/snipe-it/archive/master.zip
or
git clone https://github.com/snipe/snipe-it.git
Step 4: Update dependencies
Whenever you pull down a new version, you should update the dependencies via Composer and dump the autoloader.
NOTE: Never run composer as a super-user or Administrator. Always run it as the user that owns the Snipe-IT files. Running composer as a super-user will break things in ways that will be difficult to debug later. Just don't do it.
1st you'll need to install composer into the directory if you don't have it installed globally:
cd <install-dir>
curl -sS https://getcomposer.org/installer | php
Noq update dependencies and dump the auto-loader.
php composer.phar install --no-dev --prefer-source
php composer.phar dump-autoload
Step 5: Copy over your configuration settings
IMPORTANT:
This step will only need to be done once, while upgrading to v3.0. Once you've upgraded to v3.0, you won't ever have to do this part again.
Open up your .env file in your new Snipe-IT install directory, and update the configuration placeholders you see there with the values you were previously using in your individual config files.
If you don't have a .env file, just copy the existing .env.example over to .env and use that:
cp .env.example .env
The files you'll be copying from are:
app/config/app.php
app/config/production/app.php
app/config/production/database.php
app/config/production/mail.php
app/config/production/session.php
| New .env Setting |
Old Config File |
Old Config File Key |
Notes |
| APP_ENV |
N/A |
N/A |
Set to production |
| APP_DEBUG |
/app/config/production/app.php |
debug |
| APP_KEY |
/app/config/production/app.php |
key |
Make SURE you keep this app key the same from your old version. |
| APP_URL |
/app/config/production/app.php |
url |
| APP_TIMEZONE |
/app/config/app.php |
timezone |
| APP_LOCALE |
/app/config/app.php |
locale |
| DB_CONNECTION |
/app/config/production/database.php |
default |
This should be mysql |
| DB_HOST |
/app/config/production/database.php |
connections-> mysql-> host |
| DB_DATABASE |
/app/config/production/database.php |
connections-> mysql-> database |
| DB_USERNAME |
/app/config/production/database.php |
connections-> mysql-> username |
| DB_PASSWORD |
/app/config/production/database.php |
connections-> mysql-> password |
| DB_PREFIX |
/app/config/production/database.php |
connections-> mysql-> prefix |
| DB_DUMP_PATH |
N/A |
N/A |
Path to your dabase dump binary (such as mysqldump)e.g. '/usr/local/bin' |
| MAIL_DRIVER |
/app/config/production/mail.php |
driver |
| MAIL_HOST |
/app/config/production/mail.php |
host |
| MAIL_PORT |
/app/config/production/mail.php |
port |
| MAIL_USERNAME |
/app/config/production/mail.php |
username |
| MAIL_PASSWORD |
/app/config/production/mail.php |
password |
| MAIL_ENCRYPTION |
/app/config/production/mail.php |
encryption |
| MAIL_FROM_ADDR |
/app/config/production/mail.php |
from->address |
| MAIL_FROM_NAME |
/app/config/production/mail.php |
from->name |
| IMAGE_LIB |
N/A |
N/A |
Should be set to gd or imagick, depending on which library you have on your server. |
| SESSION_LIFETIME |
/app/config/production/session.php |
lifetime |
| EXPIRE_ON_CLOSE |
/app/config/production/session.php |
expire_on_close |
| ENCRYPT |
N/A |
N/A |
Should be set to true if you wish to encrypt your cookies. |
| COOKIE_NAME |
/app/config/production/session.php |
cookie |
| COOKIE_DOMAIN |
/app/config/production/session.php |
domain |
| SECURE_COOKIES |
/app/config/production/session.php |
secure |
Everything else in your .env can be left alone, as they are more advanced settings that are not commonly used.
Step 6: Move uploaded files and check permissions
Since Laravel's file structure has changed, you're going to need to move a few files around to make sure your uploaded files (logo, uploaded asset files, asset model files, etc) are in their new location.
cp ../snipe-it-backup/app/storage/dumps/* snipe-it/storage/app/backups/
cp ../snipe-it-backup/app/private_uploads/* snipe-it/storage/private_uploads/
cp ../snipe-it-backup/public/uploads/* snipe-it/public/uploads/
Also confirm that your entire storage directory (and subdirectories) is writable by the web server.
Step 7: Migrate the database
Always run your database migrations on any upgrade, as this will make sure your database schema is up to date with what the new code expected.
php artisan migrate
Forgetting to run these commands can mean your DB might end up out of sync with the new files you just pulled, or you may have some funky cached autoloader values.
It’s a good idea to get into the habit of running these every time you pull anything new down. If there are no database changes to migrate, it won't hurt anything to run migrations anyway, you’ll just see "Nothing to migrate".
Step 8: Launch Snipe-IT in a browser
You should be all set now, so just go to your old Snipe-IT URL and make sure everything is working.