How to Install Invoice Ninja on Your Synology NAS

How to Install Invoice Ninja on Your Synology NAS

Invoice Ninja is a leading platform for freelancers & SMB’s to invoice clients, accept payments, track expenses & time-billable tasks. Invoicing, Quotes, Expenses, Tasks. Built with Laravel, Flutter and React. In this step by step guide I will show you how to install Invoice Ninja on your Synology NAS using Docker & Portainer.

💡Note: This guide works perfectly with the latest version of Invoice Ninja v5.11.6

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 1

  • STEP 5

Now click the “Create” button. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 2

  • STEP 6

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in Invoice Ninja. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: invoiceninja.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 5485

Invoice Ninja Synology NAS Set up 3

  • STEP 7

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 8

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 4

 

  • STEP 9

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 5

  • STEP 10

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it invoiceninja. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Invoice Ninja Synology NAS Set up 6

  • STEP 11

Now create four new folders inside the invoiceninja folder that you created at STEP 10 and name them db, public, redis, storage. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Invoice Ninja Synology NAS Set up 7

  • STEP 12

Download (click on the blue link below) then upload the in-vhost.conf file below in the invoiceninja folder that you have previously created at STEP 10. Follow the instructions in the image below. 🔒Note: Support my work to unlock the password. You can use this password to download any file on mariushosting forever!

👉🏻Download in-vhost.conf

Invoice Ninja Synology NAS Set up 8

  • STEP 13

Right click on the invoiceninja folder that you have previously created at STEP 10 then click Properties. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 9

  • STEP 14

Go to the Permission tab then click Advanced options. From the drop-down menu choose “Make inherited permissions explicit“. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 10

  • STEP 15

Select Everyone then click the Edit tab. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 11

  • STEP 16

Check all Read and Write Permissions. Click Done. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 12

  • STEP 17

After you click Done on STEP 16, check “Apply to this folder, sub-folders and files“. Click Save. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 13

  • STEP 18

Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.

  • STEP 19

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 20

In the Name field type in invoiceninja. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

services:
  redis:
    image: redis
    command:
      - /bin/sh
      - -c
      - redis-server --requirepass redispass
    container_name: InvoiceNinja-REDIS
    hostname: invoiceninja-redis
    mem_limit: 256m
    mem_reservation: 50m
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    read_only: true
    user: 1026:100
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping || exit 1"]
    volumes:
      - /volume1/docker/invoiceninja/redis:/data:rw
    environment:
      TZ: Europe/Bucharest
    restart: on-failure:5

  db:
    image: mariadb:11.4-noble #LTS Long Time Support Until May 29, 2029.
    container_name: InvoiceNinja-DB
    hostname: invoiceninja-db
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:false
      - seccomp:unconfined
      - apparmor:unconfined
    volumes:
      - /volume1/docker/invoiceninja/db:/var/lib/mysql:rw
    environment:
      TZ: Europe/Bucharest
      MYSQL_ROOT_PASSWORD: rootpass
      MYSQL_DATABASE: invoiceninja
      MYSQL_USER: ninjauser
      MYSQL_PASSWORD: ninjapass
    restart: on-failure:5

  invoiceninja:
    image: invoiceninja/invoiceninja:latest
    container_name: InvoiceNinja
    hostname: invoiceninja
    mem_limit: 4g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: stat /etc/passwd || exit 1
    volumes:
      - /volume1/docker/invoiceninja/public:/var/www/app/public:rw
      - /volume1/docker/invoiceninja/storage:/var/www/app/storage:rw
    environment:
      APP_NAME: Invoice Ninja
      APP_ENV: production
      APP_KEY: base64:nQhdYqmk7FNh9S/OMpWO/y3SDOkD1XxvvRMltw6kSJU= # or generate self: Portainer-invoiceninja-console-bin/sh -> php artisan key:generate --show
      APP_DEBUG: false
      APP_URL: https://invoiceninja.yourname.synology.me
      IN_USER_EMAIL: yourown@email
      IN_PASSWORD: mariushosting
      REQUIRE_HTTPS: true
      TRUSTED_PROXIES: "*"
      IS_DOCKER: true
      QUEUE_CONNECTION: database
      DB_HOST: invoiceninja-db
      DB_DATABASE: invoiceninja
      DB_USERNAME: ninjauser
      DB_PASSWORD: ninjapass
      CACHE_DRIVER: redis
      SESSION_DRIVER: redis
      REDIS_HOST: invoiceninja-redis
      REDIS_PASSWORD: redispass
#      PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
#      PHANTOMJS_SECRET=password
      PHANTOMJS_PDF_GENERATION: false
      PDF_GENERATOR: snappdf
      MAIL_MAILER: smtp
      MAIL_HOST: smtp.gmail.com
      MAIL_PORT: 587
      MAIL_USERNAME: Your-own-gmail-address
      MAIL_PASSWORD: Your-own-app-password
      MAIL_ENCRYPTION: STARTTLS
      MAIL_FROM_ADDRESS: Your-own-gmail-address
      MAIL_FROM_NAME: Invoice
      #ERROR_EMAIL: error@mail.com # Error emails are sent to this email
    restart: on-failure:5
    depends_on:
      redis:
        condition: service_healthy
      db:
        condition: service_started

  nginx:
    image: nginx:latest
    container_name: InvoiceNinja-NGINX
    hostname: invoiceninja-nginx
    mem_limit: 512m
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: curl -f http://localhost:80/ || exit 1
    ports:
      - 5485:80
    volumes:
      - /volume1/docker/invoiceninja/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
      - /volume1/docker/invoiceninja/public:/var/www/app/public:ro
    restart: on-failure:5
    depends_on:
      invoiceninja:
        condition: service_started

Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 1026 is my personal UID value and 100 is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value for APP_URL and type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for IN_USER_EMAIL and type in your own administrator email address. You will need this email at STEP 24.
Note: Before you paste the code above in the Web editor area below, change the value for IN_PASSWORD and type in your own administrator password. mariushosting is an example for a password. You should type in your own password. You will need this password at STEP 24.
Note: Before you paste the code above in the Web editor area below, change the value for MAIL_USERNAME and type in your own Gmail address. STEP 18.
Note: Before you paste the code above in the Web editor area below, change the value for MAIL_PASSWORD and type in your own Gmail app password. STEP 18.
Note: Before you paste the code above in the Web editor area below, change the value for MAIL_FROM_ADDRESS and type in your own Gmail address. STEP 18.

Invoice Ninja Synology NAS Set up 14 new 2025

  • STEP 21

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Invoice Ninja Synology NAS Set up 15 new 2025

⌛Now just wait because the Invoice Ninja image is about 1.4GB.

  • STEP 22

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Invoice Ninja Synology NAS Set up 16

  • STEP 23

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 24

Please wait approximately 3-5 minutes for the installation to be completed or you will get a 502 bad gateway page. Now open your browser and type in your HTTPS/SSL certificate like this https://invoiceninja.yourname.synology.me that you have previously created at STEP 6. In my case it’s https://invoiceninja.mariushosting.synology.me If everything goes right, you will see the Invoice Ninja login page. Type in your own Email (IN_USER_EMAIL) and Password (IN_PASSWORD) that you have previously created at STEP 20 then click Login with email. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 17

  • STEP 25

Set up your Company Name, First Name, Last Name, Language, Currency and the theme you want. Click Save. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 18

  • STEP 26

You will be asked to upload your own logo. Click UPLOAD. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 19

  • STEP 27

After you upload your own logo, click Save at the top right of the page. Follow the instructions in the image below.

Invoice Ninja Synology NAS Set up 20

  • STEP 28

Invoice Ninja dashboard at a glance!

Invoice Ninja Synology NAS Set up 21

  • STEP 29

Start creating your first invoice!

Invoice Ninja Synology NAS Set up 22

Enjoy Invoice Ninja!

🆘TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issues article.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the Invoice Ninja container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Friday / December 20th, 2024 at 11:21 AM