Introduction
It has been a a number of years since I actually did a variety of freelance work. Principally, I did it within the night hours
just a few nights per week for some more money. Over the previous couple of years, that sort of work has
slowed down for me. Principally as a result of I take pleasure in enjoyable within the evenings and spending day off
of my pc now. It is bizarre to sort that, however “interest coding” actually hasn’t had as a lot
attraction to me since I began my present job just a few years in the past.
I like my job. I like working from house 100% of the time and I like being house
when the children get off the bus, throughout summer season breaks, and when the climate sucks. The
one factor this job has achieved although, is take away my need to take a seat in my workplace after
everybody else has gone to mattress and simply code.
However, that is okay. I’ve discovered different hobbies and am actually enthusiastic about some up coming
issues I am making an attempt out. In the event that they work out, I am going to have the ability to mix my coding abilities
with different hobbies. I am certain I am going to write about it sooner or later.
I say all of that, as a result of, regardless that I do not actively tackle freelance work any
longer, I nonetheless have shoppers that I did work for that can attain out as soon as and some time
for assist, consultations or a small undertaking. When that occurs, I want a method to invoice them
for my time.
Beforehand, my invoices would have been whipped up in Phrase and transformed to a PDF and despatched
off to the shopper. It labored for years. I used to be in a position to preserve observe of every little thing,
correctly report it (do not wish to mess with the tax man) and I saved chugging alongside. The
drawback now, is that if I am doing work for a shopper, I wish to do the work and be achieved. I do not
wish to frolicked making a presentable bill in Phrase.
So, I went trying to find some software program. I discovered InvoiceNinja. It is wonderful.
- Hosted or self hosted model
- Create easy invoices
- Create full quotes
- API (which I’ll most likely by no means use, however…it is there)
- Recurring billing
- Zapier integration
I’ve this behavior of self internet hosting my very own software program. See my posts on NextCloud
and GitLab for different examples.
This remainder of this submit goes to stroll by way of how I put in InvoiceNinja.
Getting Began
I will be self internet hosting InvoiceNinja. You could find that on their .org web site
or on GitHub.
On this, I will be putting in InvoiceNinja, establishing Apache to host it, and exhibiting how
to replace it sooner or later.
$ wget https://obtain.invoiceninja.com/ninja-v4.5.13.zip
$ unzip ninja-v4.5.13.zip
This downloads and unzips InvoiceNinja 4.5.14 to the present listing. Subsequent,
let’s transfer it to it is closing set up location and arrange acceptable proprietor and
permissions.
$ sudo mv ninja /var/www/html
$ cd /var/www/html
$ sudo chown -R www-data:www-data ninja/
$ sudo chmod -R 755 ninja/storage
Database setup
InvoiceNinja runs on MySQL (or MariaDB). We have to create the database, however
the installer will do the remainder of the work for us. Log into MySQL with a consumer
that may create new databases, customers and permissions.
Now we’ll run three instructions. The primary is to create the brand new database, the second
is to create the consumer. The third is to set acceptable permissions for the
new consumer and new password.
Consideration
Change the default password from ninja to one thing safe
Our three instructions:
CREATE DATABASE ninja;
CREATE USER 'ninja'@'localhost' IDENTIFIED BY 'ninja';
GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'localhost';
Exit MySQL.
Configure Apache
Now we will arrange a brand new virtualhost in Apache to serve InvoiceNinja.
Create an entry in sites-available.
nano /and so on/apache2/sites-available/invoiceninja.conf
My entry seems to be like this:
*:80>
DocumentRoot /var/www/html/ninja/public
ServerName bill.instance.com
Redirect everlasting / https://bill.instance.com/
/var/www/html/ninja/public>
Choices +FollowSymlinks
AllowOverride All
Require all granted
*:443>
ServerName bill.instance.com
DocumentRoot /var/www/html/ninja/public
SSLEngine on
SSLCertificateFile /path/to/dehydrated/certs/bill.instance.com/cert.pem
SSLCertificateKeyFile /path/to/dehydrated/certs/bill.instance.com/privkey.pem
SSLCertificateChainFile /path/to/dehydrated/certs/bill.instance.com/chain.pem
mod_headers.c>
Header at all times set Strict-Transport-Safety "max-age=15552000; includeSubDomains"
/var/www/html/ninja/>
Choices FollowSymLinks
AllowOverride All
Order permit,deny
permit from all
This units up a direct from HTTP to HTTPS. Then it factors to the SSL certificates I’ve
created for this subdomain. I beforehand wrote about how I arrange SSL. I adopted the
identical steps, utilizing the brand new subdomain.
With SSL and the subdomain arrange in CloudFlare, it is time to allow the positioning:
$ sudo a2ensite invoiceninja.conf
$ sudo systemctl reload apache2
Finishing the set up
Navigate to the brand new subdomain, and fill out the shape. Set up shall be
accomplished in a minute or so.
Updating
Sooner or later, InvoiceNinja will come out with an replace, and I am going to wish to replace
to get the most recent options and safety patches.
To begin with, we wish to obtain the most recent model:
$ wget https://obtain.invoiceninja.com/ninja-v4.5.14.zip
$ unzip ninja-v4.5.14.zip
Subsequent, rsync the information to the put in listing.
$ sudo rsync -tr ninja/ /var/www/html/ninja/
This messes up permissions, so reset these.
$ cd /var/www/html
$ sudo chown -R www-data:www-data ninja/
$ sudo chmod -R 755 ninja/storage
Lastly, hit the /replace URL to finish the method
wget https://bill.instance.com/replace
