Upgrade problems and failure
Per instructions at https://snipe-it.readme.io/v4.0/docs/upgrading-to-v4
Step 4 says to run composer dump. There is no such command. Actual command appears to be php composer.phar dump.
This section also does not have the warning about running these commands as sudo. However, per past submissions, you MUST run as sudo, otherwise the commands fail due to permissions. The only hybrid I have found to satisfy these two contradictory conditions is to sudo -u www-data. However, that generates errors as well as it tries to write cache to the home of the user running the command instead of the home of the user you are running the command as. Any additions to the documentation to clarify all this would be immensely helpful.
Step 6 when running php composer.phar install --no-dev --prefer-source this happens:
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Update failed (Failed to clone https://github.com/jmespath/jmespath.php.git via https, ssh protocols, aborting.
- https://github.com/jmespath/jmespath.php.git
error: RPC failed; result=56, HTTP code = 0
fatal: The remote end hung up unexpectedly
- [email protected]:jmespath/jmespath.php.git
Could not create directory '/var/www/.ssh'.
Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
)
Would you like to try reinstalling the package instead [yes]?
This kind of error condition then happens about 100 more times for every package it needs to update so you sit there for 10 minutes typing yes over and over to get through it all. Pretty much the most painful update experience ever, and seems there must be a better way.
Step 7 seems to not be needed as the .env is not replaced during update? However it specifically mentions APP_LOCALE=en which is not in the file? Is this suggesting new things should be added? If so, where is the documentation on that?
Then we hit step 9, and experience critical failure in the code apparently:
PHP Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 444
Line 444 of that file reads function event(...$args)
What do? Should those ... be removed? If so, line 446 also has those... How has anyone upgraded if this is in place?
For further info, this is on Ubuntu 16 server going from 3.6.6 to 4.1.3
- composer can be installed globally or locally. Depending on how it's installed changes how you interact with it.
- Permissions and configuration will vary depending on your install. Managing these is part of managing software. You need to make sure the webserver can read/write to the directory.
- Your version of php is too old. This is why you're encountring the errors in step 9
Several things here.
-
There are a TON of new requirements in v4 that are not talked about or specifically called out. The big bold red warning at the top of the upgrade instructions needs to say you MUST re-review ALL requirements and upgrade as needed BEFORE proceeding. In particular, calling out PHP version and the new required extensions is important, and mentioning that some distributions simply do not easily support newer PHP versions, so be very sure your PHP is compliant not just up to date.
-
There are a LOT of new REQUIRED fields in the .env file. This needs to be called out in big bold red letters. You can NOT simply move through the upgrade with your old .env, you MUST copy in a new .env from the example, change values as needed from your old .env, review all the new parameters and get them set up, and THEN you can proceed with the upgrade. Otherwise you will have errors and in particular the migration step will fail.
-
php-bcmath is REQUIRED, and is not listed in the requirements page. Running through the composer steps will fail without this installed.
-
By FAR the easiest way to work with composer and artisan, and this really should be mentioned IMHO due to the sudo warnings, is to chown -R the install directory to yourself, do everything, then chown it back to www-data. This is the only way I have seen to resolve all the permissions issues you hit otherwise.
There are now some bugs post upgrade, I'll address those separately.
There are a TON of new requirements in v4 that are not talked about or specifically called out.
The requirements are always listed on the requirements page. https://snipe-it.readme.io/v4.0/docs/requirements
Additionally, we direct you to the requirements page on the upgrade page.
There are a LOT of new REQUIRED fields in the .env file.
That's not really true. We did add a few fields to the .env but there are sensible fallbacks if the values don't exist.
Additionally, Step 7 of the upgrade tells you to add in any missing .env variables. https://snipe-it.readme.io/v4.0/docs/upgrading-to-v4#section-step-7-copy-over-any-new-env-settings
php-bcmath is REQUIRED, and is not listed in the requirements page.
You're correct - we've fixed that. Thank you for the heads up.
Running through the composer steps will fail without this installed.
Which I assume tells you that it needs bcmath.
Many times, packages that we use have new requirements. If we already have those extensions enabled on our system, we won't see the requirement because it won't fail as we run composer update to set our lock file for our users. It's not a malicious or lazy omission - if it doesn't flag for us as a new requirement, we don't realize we have to call it out. (Additionally, BCmath is installed by default on Windows.)
By FAR the easiest way to work with composer and artisan, and this really should be mentioned IMHO due to the sudo warnings, is to chown -R the install directory to yourself, do everything, then chown it back to www-data. This is the only way I have seen to resolve all the permissions issues you hit otherwise.
Composer should not be run as root/sudo, ever, period. By far the easiest way to handle it is to install it globally and run it as whatever user owns the files for Snipe-IT. We tell you not to run it as sudo/root in multiple places, and composer itself warns you not to do so. This is a basic web server permissions issue and is really out of scope for our documentation.