Docker image - issues with file uploads - Failed to open stream: Operation timed out

Unless you are running the exact docker-compose file, it is very difficult to debug what is going on.

The Docker images are built from invoiceninja/dockerfiles so they are certainly “official” in that sense.

So, I should dedicate a standalone VPS be able to run an exact, clean install with docker compose file?
I’m sorry, it doesn’t make sense. I get that it’s opensource, and you are on your own 99% of the time. And I appreciate any kind of help I can get.

But I have a feeling there is not much understanding of what docker configs are… Maybe on both sides.

Even the fact that config is different between docker hub and github… If it is really hard to debug what’s going on - why have debug mod, config examples posted, extra debug variables?

What my configs are lucking so significantly that makes it so difficult to debug this?

You can run multiple docker containers on a single instance, you may need to juggle ports, but it is certainly possible.

We are not experts in Docker at all that is why we can only focus support on the official repo as there are just too many permutations to handle when things deviate from the standard file.

I didn’t say that I can’t run multiple docker containers. Quite opposite. I said that all my docker containers are configured in a single docker-compose.yml. Just like your config on github has it.

I understand that there is an issue with knowledge resources in docker field. It’s ok. But it is not a reason to simply dismiss something because “it doesn’t look like what I see in this other book”.

For example the logo issue - for a file to be uploaded as logo, it has to pass through web server (ngnix in “standard config”, caddy in my case), be accepted and configured by the backend. Clearly this chain is happening and logo is accepted by backend. But then something breaks in the app and it can’t generate the pdf preview anymore.

This fact is dismissed, because - oh, your config is so different it almost like chinese for us? I’m sorry if I come across as an ignorant humang being. But it’s kinda hard to find logic in this.
Doesn’t the error displayed in place of pdf preview hint on something? It doesn’t to me - there is no reasonble and informative log output that I can act upon.

@sdggq

I’m not being dismissive, I’ve laid it out pretty clearly.

We are not docker experts. We provide a standard file which works I’m sorry your customized version does not. But if the application was broken, it would be broken for everybody, in this case, something is happening with your specific configuration.

So… no idea then. Got it :slight_smile:

anybody knows where
uri:/api/v1/documents/
located in filesystem?

Found it with

cd "INV NINJA VOLUME"
find ./ -type d -name "documents"

Further investigation showed that inside the docker container php.ini doesn’t match the github version posted here - https://github.com/invoiceninja/dockerfiles/tree/master/config/php
in many ways.

What should be used?

Conflicting information provided between Docker - where php.ini and php-cli.ini are not getting passed through to the docker.
and https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml where php.ini and php-cli.ini are passed through to docker container.

Confirmed that uploaded to tasks - files are being created in filesystem and I can open them directly without auth by following

https://"domain name"/storage/3nRvxjdaX06fqFrHkPggMHo7cRViWHss/documents/UjZZqILu2aUglDmvetJWlkWRruqux4PwFNjxOHPB.png

However when trying to open same file from Flutter UI (still no clue on how to do that in REACT) I’m getting

in laravellog
[2023-09-04 13:15:15] production.ERROR: file_get_contents(https://invoices."REDUCTED"/storage/3nRvxjdaX06fqFrHkPggMHo7cRViWHss/documents/UjZZqILu2aUglDmvetJWlkWRruqux4PwFNjxOHPB.png): Failed to open stream: Operation timed out {"userId":1,"exception":"[object] (ErrorException(code: 0): file_get_contents(https://invoices."REDUCTED"/storage/3nRvxjdaX06fqFrHkPggMHo7cRViWHss/documents/UjZZqILu2aUglDmvetJWlkWRruqux4PwFNjxOHPB.png): Failed to open stream: Operation timed out at /var/www/app/app/Http/Controllers/DocumentController.php:124)
[stacktrace]
#0 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(254): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /var/www/app/app/Http/Controllers/DocumentController.php(124): file_get_contents()
#3 /var/www/app/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(145): App\\Http\\Controllers\\DocumentController->App\\Http\\Controllers\\{closure}()
#4 /var/www/app/vendor/symfony/http-foundation/StreamedResponse.php(102): Illuminate\\Routing\\ResponseFactory->Illuminate\\Routing\\{closure}()
#5 /var/www/app/vendor/symfony/http-foundation/Response.php(423): Symfony\\Component\\HttpFoundation\\StreamedResponse->sendContent()
#6 /var/www/app/public/index.php(61): Symfony\\Component\\HttpFoundation\\Response->send()
#7 {main}
"}

and

in ui instead of thumbnail
HTTPException: Invalid statusCode: 500, uri = https://invoice."REDUCTED"/api/v1/documents/wMvbmOeYAI/download: https://invoices."REDUCTED"/api/v1/documents/wMvbmOeYAI/download

The logo is being uploaded correctly - that out of the questions, since it’s appearing in invoices and by the company name left top corner. Why previews break in the invoice design settings - still a mistery.

Also, not sure if anybody will pay attention but
image

this is potentially destructive to user data on persistent storage.

Are there API calls that should be routed in a specific way from flutter to backend?

Soooo…

file_get_contents(https://invoices."REDUCTED".com/storage/3nRvxjdaX06fqFrHkPggMHo7cRViWHss/documents/YPogE8ICsdUmlDiRgCBioxGAYya3b7kYbSchwAnr.png): Failed to open stream: Operation timed out

Any clue as where I should dig?

I’m a certainly not alone with this stuff.

there is something fishy with ninja internals that triggers the firewall.

Why is this destructive?

1 Like

@Rusticus,
I didn’t verify this on my setup, hence said potentially. But with the docker documentation in mind, docker-compose down

  • Will destroy volumes created with UP
  • Will bring down the whole docker-compose.yml - meaning all the containers not related to Invoice ninja. And people like me do have other containers running.

Docker-compose stop “container name”
Docker-compose rm “container name”
Docker-compose pull “container”
Docker-compose up -d to spin it up (along with the rest of the changes of any to other containers)

Sorry, typing from the phone. So typos and such.

Actually according to the documentation:

Stops containers and removes containers, networks, volumes, and images created by `up`.

By default, the only things removed are:

* Containers for services defined in the Compose file
* Networks defined in the networks section of the Compose file
* The default network, if one is used

Networks and volumes defined as external are never removed.

Anonymous volumes are not removed by default. However, as they don’t have a stable name, they will not be automatically mounted by a subsequent `up`. For data that needs to persist between updates, use explicit paths as bind mounts or named volumes.

So yes, if you really use anonymous volumes, you are right, it’s dangerous, on the other side, hard to reuse the data in all situations

1 Like

Thanks for digging in. The fact that invoice ninja recommends you to do something without thinking about your environment - is scary.

On their defense, if you really use anonymous volumes, it’s your own fault/problem

I don’t see any problem with a proper setup

It’s not only about volumes tho. There are other containers in the compose file. They might not be configured to expect this. Or down time might not be expected from them and so on.

I get the idea of opensource = you are on your own most of the time. And you better be an experienced dude or dudette - but it doesn’t diminish the fact that a single docker container is recommending something that is going to affect all other containers. I’ve never seen this in documentation for other containers.
It’s like opposite of what containerization is trying to achieve =)

Guess I start to sound like drama queen. Take the mic away please lol.