Invoice Ninja Installed in Docker

Invoice Ninja Installed in Docker

In OpenMediaVault, Tutorials, Video by dbtech

I had a request on Reddit the other day to get InvoiceNinja setup and running in Docker. I thought, “sure, that’s no big deal.” Boy was I wrong. I spent days poring over Reddit posts and forums and hub.docker.com and kept winding up with nothing that worked.

Finally, after more searching I ran across this page on hub.docker.com. So I tried it and worked. Sort of. It got me to an installation page where everything else just pulled up a page that told me the site was unavailable.

The thing about what I had just tried is that the developer hadn’t included a database to go with it and InvoiceNinja needs a database.

So I went back to something familiar and grabbed the Docker compose file from NextCloud and reverse-engineered it a bit and came up with a solution that works.

Before we get into that, though, we need to generate an App Key to put into our Docker compose file.

To generate that key, SSH into your server and run this:

docker run --rm -it invoiceninja/invoiceninja php artisan key:generate --show

Save the base64 code that is generated as we’ll need that in a moment.

Next, copy this into a new Portainer Stack:

version: '2'

volumes:
  invoiceninja:
  db:

services:
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=ninja
      - MYSQL_PASSWORD=ninja
      - MYSQL_DATABASE=ninja
      - MYSQL_USER=ninja

  app:
    image: cdnhammernet/invoiceninja
    environment:
      - APP_KEY=SomeRandomStringSomeRandomString 
      - APP_URL=http://www.panda.local 
      - DB_HOST=db 
      - DB_DATABASE=ninja 
      - DB_USERNAME=ninja 
      - DB_PASSWORD=ninja 
    ports:
      - 889:80
    links:
      - db
    restart: always

Now you can paste in the base64 code we generated into the “APP_KEY” environmental variable.

Next, change the “APP_URL” to reflect the URL of your server. Don’t include https or the port number at the end.

Feel free to change the database name, username, and password if you want, but be sure to change it in both places in the code. Leave “DB_HOST” as “db”.

Once you have all of that done, you can click the “Deploy the Stack” button and wait until the container is done deploying. It will take a few minutes and you can track it by going into the InvoiceNinja logs in Portainer when it says “[service.d] done.” you can go to http://your-server-address:889 and fill in the necessary blanks and click “Submit”.

After just a moment, the page will reload and you’ll be asked to login with the user account you created on the previous page.

That’s it! You should have InvoiceNinja running on your Docker server!

OpenMediaVault Tutorials

If you’re interested in other tutorials for your home server, check here: https://dbtechreviews.com/category/openmediavault/

/=========================================/

Like what I do? Want to be generous and help support my channel?

Here are some ways to support:

Patreon: https://dbte.ch/patreon

Ko-fi: https://dbte.ch/kofi

/=========================================/

Remember to leave a like on this video and subscribe if you want to see more!

/=========================================/

Follow Me:

Twitter: https://dbte.ch/tw

Facebook: https://dbte.ch/fb

Subscribe: https://dbte.ch/ytsub