How to update your own Invoice Ninja to latest version

My bad for neglecting so many Invoice Ninja version from latest installation (version 3.2), when I log in I see this message :

A new version of Invoice Ninja is available. You’re running v3.2.0, the latest is v3.4.2

But actual download link lead me to 3.5.1 ( at the time of writing) which make confuse on which path should I choose for updating method :

  1. Update to 3.4.2 first then update to 3.5.1 or
  2. Update to the latest (3.2 to 3.5.1)

Well, Invoice Ninja provide support docs for the case. You can see it here.

But, it would be nice to try it first with dummy server to convince myself and preparing for unexpected issue that might occur.

Lets get start!

  1. Log in to vps server as root

  2. Checking path and ownership

cd /srv/users/serverpilot/apps

ls -l

total 99608
drwxrwxr-x+ 12 serverpilot serverpilot 4096 Jul 7 08:04 invoice
drwxr-xr-x+ 3 serverpilot serverpilot 4096 Jul 7 02:56 invoice_old
-rw-rw-r–+ 1 root root 101977765 Apr 2 20:33

ls invoice artisan composer.json gulpfile.js resources
Gruntfile.js bootstrap composer.lock package.json server.php
LICENSE bower.json config phpspec.yml storage c3.php database phpunit.xml tests
app codeception.yml docs public vendor

as you see from the above result :

path : /srv/users/serverpilot/apps/invoice

ownership : serverpilot (for user and group)

3. Download shell script and save it to a file

copy and paste from ‘raw paste data’

cd /root

mkdir ninja

cd ninja


paste ‘raw paste data’ content and save.

Don’t forget to change all instructed fields.

For me I use (only changed lines) :


temporary dir, change to :


4. Change shell script into executable

chmod +x

5. Run


Wed Jul 26 04:31:47 UTC 2017 – Updating Invoice Ninja from v3.2.0 to v3.5.1.

Downloading Invoice Ninja v3.5.1 archive “” …

–2017-07-26 04:31:47–
Resolving (…,, 2400:cb00:2048:1::6812:2586, …
Connecting to (||:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 107764137 (103M) [application/zip]
Saving to: ‘/root/ninja/’

100%[=====================================================================================================================================================>] 107,764,137 19.1MB/s in 6.5s

2017-07-26 04:31:56 (15.8 MB/s) – ‘/root/ninja/’ saved [107764137/107764137]

Extracting to temporary folder “/root/ninja” …

Syncing to install folder “/srv/users/serverpilot/apps/invoice” …

Number of files: 26,867 (reg: 23,078, dir: 3,789)
Number of created files: 7,812 (reg: 7,202, dir: 610)
Number of deleted files: 0
Number of regular files transferred: 13,565
Total file size: 265,796,876 bytes
Total transferred file size: 202,555,393 bytes
Literal data: 202,555,393 bytes
Matched data: 0 bytes
File list size: 720,838
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 203,841,807
Total bytes received: 272,099

sent 203,841,807 bytes received 272,099 bytes 37,111,619.27 bytes/sec
total size is 265,796,876 speedup is 1.30

Resetting permissions for “/srv/users/serverpilot/apps/invoice/storage” …

Removing downloaded ZIP file “/root/ninja/” …

Removing temporary folder “/root/ninja” …

Wed Jul 26 04:32:07 UTC 2017 – Invoice Ninja successfully updated to v3.5.1!

6. Try login

Click on Settings and see ‘powered by’ part. Yes, it works!

Note :

I use dummy server so I forget to backup first (my bad). Always backup your existing invoice ninja before doing update. In case you don’t know how to backup it. You can follow this steps (after log in to vps server) :

Find mysql username and password

cat /srv/users/serverpilot/apps/invoice/.env | grep DB_


Backup sql

mysqldump -uninja -p ninja > /srv/users/serverpilot/apps/invoice/ninja320.sql

Compress invoice ninja files

cd /srv/users/serverpilot/apps/

tar cvzf ninja320.tar.gz invoice

ls -l | grep ninja

-rw-rw-r–+ 1 root root 101977765 Apr 2 20:33
-rw-rw-r–+ 1 root root 101207881 Jul 26 04:50 ninja320.tar.gz

In case something wrong with update process then you can switch back to old version 🙂