Trying to setup Invoice Ninja Self-hosted in Docker

I’ve been pulling my hair out trying to get Invoice Ninja to work self hosted on my machine. Before I get into the thick of the issue I want to make sure that I have my understanding correct. If I made mistakes there then I can fix them and then try to learn on my own if it works.

I have a mac mini running as a server with proxmox. I have a VM running with docker and portainer in it along with several other containers including nginx to get ssl and https on my internal sites within my network.

Will that cause an issue with the nginx that invoice ninja wants to run?

Will I just setup my proxying on my current nginx to point to the one for invoice ninja? or how does that work?

In the env file it gives a DB and a user name and password (default to Ninja) and a SQL section with password and names.

Should the password for the DB and SQL be the same? different? does it matter? Same with user name and other information?

I followed the dbtech video on youtube and aside from using my own generated passwords and such did everything exactly as he did in the video and end up with an error message on the app container that shows:

In Connector.php line 70:

SQLSTATE[HY000] [1045] Access denied for user ‘ninja’@‘172.22.0.3’ (using
password: YES)

I went through the section of changing permissions. I have tried setting the DB and SQL password different or the same with the same effect. So I am confused on where I would remedy this situation, but wondered if it could be due to the two separate nginx things not being done right?

I would say I am tech savvy, but not when it comes to coding and that type of stuff so forgive my ignorance if some of the things should be pretty self-explanatory.

Thanks,

Hi,

The setup through Docker should be straightforward, I would have suggested the video but it seems like you’ve already watched it.

You may want to test the database credentials manually to ensure that they’re correct.

so I think I was able to attempt to login to the database for that container and it failed for both the root or user password, but they are exactly as written in the ENV file. So what would one do to fix this issue?

@david do you have any suggestions?

I don’t have any experience with portainer, but you may have luck with these references:

Went back through things and repulled the docker compose and such and now don’t receive that error but do receive this error:

SQLSTATE[HY000] [2002] Connection refused

progress at least.

Nevermind, it went right back to the same issue, so I didn’t get any further. Might try again later but for now I think I might give up. Even when I followed the ubuntu guide I ran into the same issue in a VM.

I’m running into this same issue in a couple instances. Somehow I got it working once but two other times i get DB access denied even after changing the user/pass a bunch of times and rebuilding.

@xisdibik Did you ever get this worked out?
@david I’ve run and rerun, deleted, repulled, etc all the same as this other user has stated they have done in my docker instance. It seems that the database portion isn’t creating the users and/or setting the passwords. I get the same errors xisdibik is stating in this thread and also like him, can not even login with the root credentials I specify in the env file.

I did not. I ended up paying for the hosted version as it’s still a lot cheaper than what I was using before. I’ll revisit self hosting sometime and maybe change next year if I get it working smoothly.

Thanks for replying and bummer. I’ve been fiddling with this for days. It’s all there as it should be but I just don’t think the db users/passwords are being created properly or at all? from the env file. Can’t even log in to the db instance as root as no password works. I don’t get it, I too followed the video exactly.

Oddly I did get a docker instance to work on a virtual Ubuntu machine but thought I would rather use it in docker/portainer running directly on the host machine rather than having multiple virtual layers.

Very odd indeed. If you keep trying and find a solution I’d love to hear what you did.

1 Like

I might start up a new thread and see if it gets any attention. I’ve found other instances similar to this but no real solution. In some cases, an account can be created manually but my root password for mysql from the env file never takes either.

I was curious what is the OS you used to run docker/portainer. The instance I’m having this mysql issue on is windows 11. Somehow I (previously) did get IN running on a hyperv Ubuntu/docker instance. I have not yet installed Portainer on that VM but may just do that and and run with it. I mostly thought it would be more efficient to just run this in docker/portainer right on the host Win11 machine but I think I need to move on and either use what I got working or look at other options.

Hello I have setup invoiceninja on docker a dozen times, on ubuntu and synology NAS. The trick is getting the compose file right so the services can access each other in the networks in the environment, if you’d like assistance directly on your server you can DM me

2 Likes