Docker install blank webpage
Deployment Method
- [ ] Installer
- [ ] Docker Development
- [X] Docker Production
- [ ] Bare metal Development
- [ ] Bare metal Production
- [ ] Digital Ocean image
- [ ] Other (please provide a link
Steps to Reproduce
Describe the problem*
When I navigate to the web url described in my .env file I get an "unable to resolve error", and when I visit the port set for the webpage I get a blank page with no content.
Steps to Reproduce
I've installed inventree using the docker install on a raspberry pi as described in the install instructions.
I run various services on this raspberry pi and separate access via port, and so I have made two changes to my .env file: INVENTREE_SITE_URL="http://inventree.homepi.local" INVENTREE_WEB_PORT=8089
I am unable to resolve inventree.homepi.local, however when I go to homepi.local:8089 I do get a 200 code response, but it is a completely blank webpage with no content. This is generated by inventree as when I stop the containers I go back to being unable to resolve.
When I use curl I get the following:
- Connected to homepi.local port 8089
GET / HTTP/1.1 Host: homepi.local:8089 User-Agent: curl/8.4.0 Accept: /
< HTTP/1.1 200 OK < Server: Caddy < Date: Sun, 07 Apr 2024 14:12:53 GMT < Content-Length: 0 <
- Connection #0 to host homepi.local left intact
Relevant log output
No response
If you use a custom port you will need to include that in the site_url
Including the port in the site url results in being unable to resolve that url. I no longer get a status 200 response.
INVENTREE_SITE_URL="http://inventree.homepi.local:8089" INVENTREE_WEB_PORT=8089
Do not set INVENTREE_WEB_PORT to a custom value - delete that from your .env file. That is not the external web port, it is the internal web port within the docker container and should not be changed.
I have removed the web port customisation from the .evn file, and all that remains is:
INVENTREE_SITE_URL="http://inventree.homepi.local:8089/"
But I still get no response from that URL and the server seems to keep restarting in it's docker container.
and the server seems to keep restarting in it's docker container.
Ok, so what does the server container logs tell you? If it is restarting it should have an error message
EDIT: I updated the information in this post. It turned out to be slightly different from what I first thought.
I was just about to open a new issue, and then I found this, so I post my findings here.
INVENTREE_SITE_URL is not validated correct
I just updated to version 0.15.1. After the update my inventree-server and inventree-worker containers could not be started anymore. The "invoke update" command would also fail. I got the following error message:
"ERROR No CSRF_TRUSTED_ORIGINS specified. Please provide a list of trusted origins, or specify INVENTREE_SITE_URL"
I then specified a INVENTREE_SITE_URL in my .env
INVENTREE_SITE_URL="http://pi-server:1337"
However, now I got a new error message. It does seems that InvenTree does not like the format of the "INVENTREE_SITE_URL".
File "/home/inventree/src/backend/InvenTree/InvenTree/settings.py", line 1026, in <module>
validator(SITE_URL)
I played around with a dozen different settings, all gave the same problem. But when I reverted back to the example in the documentation it turned out to work fine.
INVENTREE_SITE_URL="http://inventree.local"
After playing around a bit more I figured out the problem seems to be in the validation of the URL. It does seems that you need a TLD in the URL. I have set up my domain via /etc/hosts and do not use a TLD, so it fails.
@chille to clarify:
- You are hosting InvenTree at
http://pi-server:1337 - You specify
INVENTREE_SITE_URL = http://pi-server:1337 - InvenTree fails to start because it considers the URL "invalid"?
Can you please share the full error log when you launch the server with the URL as above?
@chille @minorDeveloper could you respond to the latest message so we might resolve or close this?
@matmair the error was related to a very niche docker networking issue caused by another container. Running inventree in isolation had no issues. This can be closed.
I will continue to explore why this happened and if I figure it out I will reply here to assist with anyone with the same issue in the future.