Hi, I would like to confirm that the following steps to update is correct, using shared hosting and cPanel:
- Download latest version and overwrite all files in FTP
- Visit .com/update to run the update process
- Copy the update script to a notepad, rename it as autoupdate.sh and upload to FTP
- Set up a cron job to point to and run the script daily.
That’s basically correct.
For the manual update the app should detect the change and automatically redirect you to /update.
For the automatic update make sure to set the correct parameters in the shell script.
Just to add to what Hillel said, if you’re using the current version, it will visit
ninja.url/update automatically (if you don’t have
UPDATE_SECRET set in .env), to keep from introducing problems between copying the files over and when you actually go to login the next time.
Also, you don’t technically have to have an extension on the file, as long as it has execute permissions set. I just set chown to
root:root, and set the permissions to 774.
There ARE a couple lines in there (64 and 83, then comment out 84, if I remember correctly off the top of my head) to utilize the
UPDATE_SECRET variable in the .env, but I have yet to sort out some strange issues where loading
ninja.url/update?secret=<somevalue> fails on the first attempt, but works fine on the next, so use that at your own risk. Once I can figure out what’s going on with that, the next version of the update script will be completely automatic. It will find your Invoice Ninja install, double-check the proper owner of
/var/www/ninja/storage, whether or not you’re using
Are there any details about the 500 error in either the web server error log or storage/logs/laravel-error.log
Which versions are you updating from/to?
Try removing line #8. I haven’t heard of it causing issues, but that
#! that starts it might be confusing the system into thinking it’s a shell setting? It gets highlighted as one.
Just to make sure you got all the carriage returns, try running it through dos2unix just to be sure. Also, try setting the permissions to 775. I don’t THINK that lacking write permissions applies outside of the file itself, but giving it to the group anyway can’t really hurt.
I’m not sure… if you see a 500 error there should be an error in one of the log files. Did you check both the web server log and the application log?
When you copy over the new files the .env and storage/version.txt files will remain from the previous version.
If you’re unable to install dos2unix, you can do it the long way. First, use
cat -v to check the file and see if the lines end in
^M or not. If they do, you can try
cat autoupdate.tct | tr -d '\r' > autoupdate.new
mv autoupdate.new autoupdate.tct
chmod 775 autoupdate.tct
But if they’re denying scripts for security reasons, they may be blocking their execution entirely, not just the .sh extension.
@Hillel, I wasn’t able to find the web server log files. By the way, I am accessing my server through cPanel and there is no /user/local folder in FTP.
@Titanfail, I checked that there were no ^M entries in the file, and had the username and permissions set correctly but the script couldn’t find version.txt
I decided to give up on autoupdates - my web host probably has multiple security policies blocking the script from running, since it is a shared server.
I reached out to support again regarding manual install, they did something with the files on their side and I was able to update successfully. I was told to contact support again whenever I needed to update as the fix was easier to implement for them than it is for me with my limited privileges.
I am trying to find out what the fix is so I can leave it as a comment here for anyone facing similar issues in future. At the moment, I know it is not permissions of file ownership related as those did not change.
Thanks to both of you for the awesome support! It totally made purchasing white label worth it, vs other competing web apps.
Depending on what you’re currently paying for shared hosting, the locked down account and need to contact support in order to update your install might mean a VPS would be a more cost-effective solution.
I followed manual update, copied new files over existing files to override all…i saw a popup saying my domain.ca says new update i should refesh so i did, i am on sign in page…i got 500 error too
2021/04/05 18:05:21 [error] 9155#9155: *3267 FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream, client: 192.168.1.4, server:$erver: africana.ca, request: “GET /flutter_service_worker.js?v=5.1.26 HTTP/1.0”, upstream: “fastcgi://unix:/run/php/php7.3-fpm.sock:”, host: “africana.ca”, referrer: $rrer: “https://mydomain.com/flutter_service_worker.js?v=5.1.26”
this is my error log…i use a reverse proxy because i am testing invoice ninja on a test local server…whether manual update where i copy zip folder content from v5.1.35 to override the existing or i use force update in the login section, still get 500 error…