Closed NightSkySK closed 10 months ago
The logs you posted here look like everything is running fine - perhaps you have just not waited long enough for the server to make initial connection to the database?
As an experiment, run docker compose up
(instead of docker compose up -d
) and you can see the logs from the different containers. Then make your request, and the docker logs should provide more information.
Ensure that you wait a minute or so after starting the server
I have been trying to make it work for some time, but I will try it again during the weekend and let you know the result.
No worries. The docker logs should be the most informative for us
I don't know what I do wrong this time... Launching fresh EC2 instance with Amazon Linux 2023 and prepare all dependencies with user data
#!/bin/bash
set -x
#docker
dnf update -y
dnf install -y docker
service docker start
systemctl enable docker
usermod -a -G docker ec2-user
chmod 666 /var/run/docker.sock
#docker-compose-plugin
mkdir -p /usr/local/lib/docker/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
#docker-compose
#curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
#chmod +x /usr/local/bin/docker-compose
#git
dnf install -y git
Docker version 24.0.5, build ced0996 Docker Compose version v2.24.0
coping production docker-compose.yml and prepared .env
scp -i ~/.ssh/aws.pem docker-compose.yml .env nginx.prod.conf ec2-user@16.171.24.xxx:~/.
and run docker compose run inventree-server invoke update
[+] Running 15/15
✔ inventree-db 14 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 10.5s
✔ 2f44b7a888fa Pull complete 0.8s
✔ a7f35665fcb5 Pull complete 0.4s
✔ 084e7cac132b Pull complete 0.4s
✔ 3dfd9d3ef559 Pull complete 0.9s
✔ f9a86bb2457f Pull complete 1.0s
✔ fe977d323b28 Pull complete 1.2s
✔ 683d6af0b661 Pull complete 1.3s
✔ 9d6cf683eb24 Pull complete 1.3s
✔ e3dde9f5a40c Pull complete 2.8s
✔ 0c6134ad6fc1 Pull complete 1.7s
✔ b1aae309429c Pull complete 1.8s
✔ b9fca0bb2c78 Pull complete 2.2s
✔ a7ce99218bd0 Pull complete 2.2s
✔ 79e76ae8b2b7 Pull complete 2.6s
[+] Creating 2/1
✔ Network inventree-production_default Created 0.1s
✔ Volume "inventree-production_inventree_data" Created 0.0s
⠋ Container inventree-production-inventree-db-1 Creating 0.0s
Error response from daemon: invalid mount config for type "bind": invalid mount path: 'inventree-production_inventree_data' mount path must be absolute
Each time I get same error, once on Friday I was able to fix it (it was occurring using docker-compose but not with docker compose plugin) Any advice?
Have you edited any of the following files in any way?
docker-compose.yml and ngix.prod.conf same as in the repo Inventree\docker\production
folder
.env
only necessary changes to make it all working:
# InvenTree environment variables for a postgresql production setup
# Location of persistent database data (stored external to the docker containers)
# Note: You *must* un-comment this line, and point it to a path on your local machine
# e.g. Linux
INVENTREE_EXT_VOLUME=/home/inventree/data
# e.g. Windows (docker desktop)
#INVENTREE_EXT_VOLUME=c:/Users/inventree/data
# Default web port for the InvenTree server
INVENTREE_WEB_PORT=1337
# Ensure debug is false for a production setup
INVENTREE_DEBUG=False
INVENTREE_LOG_LEVEL=WARNING
# InvenTree admin account details
# Un-comment (and complete) these lines to auto-create an admin acount
INVENTREE_ADMIN_USER=admin.user
INVENTREE_ADMIN_PASSWORD=admin.password
INVENTREE_ADMIN_EMAIL=admin@email.com
# Database configuration options
# Note: The example setup is for a PostgreSQL database
INVENTREE_DB_ENGINE=postgresql
INVENTREE_DB_NAME=inventree
INVENTREE_DB_HOST=inventree-db
INVENTREE_DB_PORT=5432
# Database credentials - These must be configured before running
# Uncomment the lines below, and change from the default values!
INVENTREE_DB_USER=dbuser
INVENTREE_DB_PASSWORD=dbpassword
# Redis cache setup (disabled by default)
# Un-comment the following lines to enable Redis cache
# Note that you will also have to run docker-compose with the --profile redis command
# Refer to settings.py for other cache options
#INVENTREE_CACHE_HOST=inventree-cache
#INVENTREE_CACHE_PORT=6379
# Options for gunicorn server
INVENTREE_GUNICORN_TIMEOUT=90
# Enable custom plugins?
INVENTREE_PLUGINS_ENABLED=True
# Run migrations automatically?
INVENTREE_AUTO_UPDATE=False
# Image tag that should be used
INVENTREE_TAG=stable
COMPOSE_PROJECT_NAME=inventree-production
Normally you get the bind error if /home/inventree/data does not exist or if docker can somehow not access the folder(permission error). Checked if it is there? If not create it and try it again. For your bad gateway error the docker logs of the proxy would be interesting, assuming all files @SchrodingersGat mentioned are in one folder and have not been modified. If it persists it can be an issue with docker too. I don't know the installation procedure on fedora but maybe just use the convenience script if youre unsure https://docs.docker.com/engine/install/fedora/#install-using-the-convenience-script
If you are pointing to /home/inventree/data/
- does the inventree
user (and associated directories) exist?
Finally, I didn't manage to fix my problem with the binding error on Amazon Linux 2023. Even if user inventree
was created, folder /home.inventree/data
existed and with a double check of all permission settings. After many tries, I've given up.
I've set up a new server running Ubuntu 20.04 LTS and the whole installation went smoothly including the docker and docker compose plugin installation as well as the whole process of setting up production dockers of Inventree finished with success from the first time. (no invalid mount config for type "bind": invalid mount path: 'inventree-production_inventree_data' mount path must be absolute
or 502 Bad Gateway
ngix response either)
Most probably my problem with Amazon Linux installation could be solved, however I'm not advanced enough to solve them, may be some community member will be able to deal with those and propose some guidelines for less advanced user as I am. From other hand documentation clearly says:
Docker Skills Required
This guide assumes that you are reasonably comfortable with the basic concepts of docker and docker compose.
So the Amazon Linux / Fedora / Centos are clearly requiring mode skills than Ubuntu or Debian so I will stick with that.
@NightSkySK glad you got it working in one way. There are so many complexities with setting up a system like this even with a simplified docker interface
As a side note, this might be also due to SELinux. Makes me wonder why the 0.12.X worked if it was due to SELinux, but I still submitted a patch here which should reduce future issues on the RHEL family of systems. With SELinux in enforcing mode, you have to make sure that your volume mounts contain the container_file_t
label (check with ls -laZ /your/data/directory
). You can also apply the labels manually using chcon -t container_file_t -R /your/data/directory
Please verify that this bug has NOT been raised before.
Describe the bug*
Simmilarly to Issue 6156, also once I install version stable/0.13.0 via docker compose I get
502 Bad Gateway
Ngix response on http://localhost:1337 As it is my first contact with InvenTree, before I rise this ticket I've edit docker compose yml and changedINVENTREE_TAG=0.12.10
and repeat procedure:This time InvenTree is up and running at
0.12.10
Steps to Reproduce
.env
file make sure you are haveINVENTREE_TAG=stable
docker compose run inventree-server invoke update
docker compose run inventree-server invoke superuser
docker compose up -d
Expected behaviour
We should see login page at http://localhost:1337 instead I saw 502 Bad Gateway
Deployment Method
Version Information
Inventree: 0.13.0
Please verify if you can reproduce this bug on the demo site.
Relevant log output