My friend ask me to test Invoice Ninja on my server. This software is very popular since you can do many things with invoice. This software made with Laravel 5.2 and I’ve test it ‘hard way’ in my vps .I think I can share simpler way to get this software run in affordable vps.
This documentation using Vultr vps smallest server and serverpilot free account. In nutshell, you have great invoice software with free control panel 🙂
Lets get start!
Setup VPS Server
VPS provider is Vultr. They provide the plan with pricing $2.5/month.
I use Ubuntu (14.04 64 bit) with following specs : 512MB and 20GB SSD storage.
After hit deploy button write down these information :
- Ip address
- username (root)
- password for vps server
Setting URL for access Invoice Ninja
I use Simple Zone Editor from my cpanel hosting to set A record for subdomain http://ninja.hostingformula.net
update :
I change my dns manager to cloudflare.
$ dig ns hostingformula.net
; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> ns hostingformula.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47657
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;hostingformula.net. IN NS
;; ANSWER SECTION:
hostingformula.net. 84500 IN NS naomi.ns.cloudflare.com.
hostingformula.net. 84500 IN NS dom.ns.cloudflare.com.
;; Query time: 4528 msec
;; SERVER: 108.61.10.10#53(108.61.10.10)
;; WHEN: Tue Apr 04 05:52:45 UTC 2017
;; MSG SIZE rcvd: 102
For cloud flare user just assign A record to vps ip address.
This url is not working yet but we’ll working on it 🙂
Connect VPS Server to ServerPilot
ServerPilot only support server that run Ubuntu (14.04 and 16.04 64 bit at this moment)
Click on ‘Connect Server’ button then add required information :
ServerPilot will install required software (php, mysql database etc include security patch) and will provide you with this display. Click on + Create App
Enter ninja in name field, domain ninja.hostingformula.net (you change it to your own) and pick suitable PHP version (I choose PHP 7.0).
After click Create App then you’ll see settings summary .
Upload Invoice Ninja Code to VPS Server
Next step is uploading Invoice Ninja code to vps server that run by ServerPilot (note: you always have access to your server include change your root password as ServerPilot only need it to install required software).
Login to vps server with putty (using windows) or from your terminal
Change ip address 45.77.33.103 to your own.
MacBook-Pro:~ alamsyahrasyid$ ssh [email protected]
The authenticity of host ‘45.77.33.103 (45.77.33.103)’ can’t be established.
ECDSA key fingerprint is SHA256:miqdnOuhaWR3ArGd/Qq73WAqRaQP79/mpDSTFvOro+M.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘45.77.33.103’ (ECDSA) to the list of known hosts.
[email protected]’s password:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-112-generic x86_64)
Manage this server at https://manage.serverpilot.io
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
**********************************************************************
* Learn about SSH, SFTP, PHP, MySQL, apps, cron, and more at: *
* https://serverpilot.io/community/articles/system-user-guide *
* *
* To use a specific PHP version for the ‘php’ command, see: *
* https://serverpilot.io/community/articles/how-to-use-the-php-cli *
**********************************************************************
$ pwd
/srv/users/serverpilot
$ cd apps/
Switch to root account
$ su
Password:
Download latest Invoice Ninja
# wget -c https://download.invoiceninja.com/ninja-v3.2.0.zip
–2017-04-04 04:07:11– https://download.invoiceninja.com/ninja-v3.2.0.zip
Resolving download.invoiceninja.com (download.invoiceninja.com)… 104.18.36.134, 104.18.37.134, 2400:cb00:2048:1::6812:2586, …
Connecting to download.invoiceninja.com (download.invoiceninja.com)|104.18.36.134|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 101977765 (97M) [application/zip]
Saving to: ‘ninja-v3.2.0.zip’
100%[=====================================================================================================================================================>] 101,977,765 7.59MB/s in 15s
2017-04-04 04:07:28 (6.31 MB/s) – ‘ninja-v3.2.0.zip’ saved [101977765/101977765]
# ls -al
total 99608
drwxr-xr-x+ 3 root serverpilot 4096 Apr 4 04:07 .
drwxr-xr-x+ 8 serverpilot serverpilot 4096 Apr 4 04:00 ..
drwxr-xr-x+ 3 serverpilot serverpilot 4096 Apr 4 03:51 ninja
-rw-rw-r–+ 1 root root 101977765 Apr 2 20:33 ninja-v3.2.0.zip
[email protected]:/srv/users/serverpilot/apps# mv ninja ninja_old
# unzip ninja-v3.2.0.zip
# chown -R serverpilot:serverpilot ninja
Create database for Invoice Ninja
From ServerPilot dashboard click on Database section and create new database.
I use name, username and password ‘ninja’ for the sake of quick demonstration but for production server I suggest you to use recommended db username and db password from serverpilot auto suggest.
Install Invoice Ninja
Open url (in my case I open http://ninja.hostingformula.net) and I see this view
Application Settings
Make sure to enter URL that match steps 2 above.
Make sure to input the information and test connection.
Email Settings
Make sure to enter valid information in this section. I suggest you to use 3rd party if possible like Mailgun (they give frist 10k email free every month) or use free gmail smtp. Valid information will avoid you headache in the future (email in spam, bulk etc).
User Details
This information will be use for access your Invoice Ninja.
Summary
The steps in this guide are create vps server, connect it to free serverpilot account then upload invoice ninja code to vps server. Access the url then supply all required information (database, email and account information).
ps :
- make sure to restart server after successfull installation to release memory.
before restart
free -m
total used free shared buffers cached
Mem: 489 473 16 73 21 240
-/+ buffers/cache: 211 278
Swap: 511 0 511
after restart
free -m
total used free shared buffers cached
Mem: 489 384 105 56 10 210
-/+ buffers/cache: 163 326
Swap: 511 0 511
big difference between 16 and 105 🙂
2. Open ticket to vultr to open port 25 if you use their smtp (vultr block email by default)