Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent Internal Server Error after fresh Digital Ocean droplet deployment #8754

Open
1 of 7 tasks
levins-law opened this issue Dec 23, 2024 · 3 comments
Open
1 of 7 tasks
Labels
question This is a question setup Relates to the InvenTree setup / installation process

Comments

@levins-law
Copy link

Deployment Method

  • Installer
  • Docker Development
  • Docker Production
  • Bare metal Development
  • Bare metal Production
  • Digital Ocean image
  • Other (please provide a link Steps to Reproduce

Describe the problem*

I have tried several iterations of deploying a fresh DO droplet. Each time I am now prompted with the following error when I try to access Inventree:

Image

Image

Steps to Reproduce

  1. Click on the Deploy to Digital Icon logo.
  2. Click on the Create Inventree Droplet icon.
  3. Create a Basic type droplet, CPU type Regular
  4. Create Droplet
  5. Go to project, click on Get Started

Image

  1. Click on Quick Access to Inventree
    Image

  2. The usual login prompt is missing, goes straight to server error page

Image

Relevant log output

root@inventree0168onubuntu2004-s-1vcpu-1gb-nyc2-01:~# inventree logs
==> /var/log/inventree/setup_2024-11-14_22_22_39.log <==
==> /var/log/inventree/setup_2024-12-23_22_37_42.log <==
# POI01| Importing functions
# POI01| Functions imported
# POI03| Setting base environment variables
# POI03| Using existing config file: /etc/inventree/config.yaml
# POI03| Installing requirements
# POI03| Installed requirements
# POI03| Collected environment variables:
# POI03|    INVENTREE_MEDIA_ROOT=/opt/inventree/data/media
# POI03|    INVENTREE_STATIC_ROOT=/opt/inventree/data/static
# POI03|    INVENTREE_BACKUP_DIR=/opt/inventree/data/backup
# POI03|    INVENTREE_PLUGINS_ENABLED=true
# POI03|    INVENTREE_PLUGIN_FILE=/etc/inventree/plugins.txt
# POI03|    INVENTREE_SECRET_KEY_FILE=/etc/inventree/secret_key.txt
# POI03|    INVENTREE_DB_ENGINE=postgresql
# POI03|    INVENTREE_DB_NAME=inventree
# POI03|    INVENTREE_DB_USER=inventree
# POI03|    INVENTREE_DB_HOST=localhost
# POI03|    INVENTREE_DB_PORT=5432
# POI04| Running in docker: no
# POI05| Using init command: systemctl
# POI06| Getting the IP address of the server via web service
# POI06| IP address is 162.243.234.188
# POI07| Python environment already present
# POI07| Found earlier used version: /opt/inventree/env/bin/python
# POI07| Using python command: /opt/inventree/env/bin/python
# POI08| Checking if update checks are needed
# POI08| Running upgrade
# POI08| Old version is: 0.16.8-1730959683.f23d4053.focal | 16 - updating to 0.17.0-1734433548.156c3cc9.focal | 16
# POI09| Setting up python environment
Requirement already satisfied: invoke in ./env/lib/python3.9/site-packages (2.2.0)
Requirement already satisfied: wheel in ./env/lib/python3.9/site-packages (0.45.0)
# POI09| Loading extra packages from INSTALLER_EXTRA
# POI09| Installing extra pip packages
Requirement already satisfied: psycopg2-binary in ./env/lib/python3.9/site-packages (2.9.10)
# POI09| Stopping nginx
# POI09| Stopped nginx
# POI09| Setting up nginx to /etc/nginx/sites-enabled/inventree.conf
# POI09| Starting nginx
# POI09| Started nginx
# POI09| (Re)creating init scripts
Nothing to do.
Nothing to do.
# POI09| Enabling InvenTree on boot
# POI09| Enabled InvenTree on boot
# POI10| Admin data already exists - skipping
# POI11| Stopping InvenTree
# POI11| Stopped InvenTree
# POI12| Updating InvenTree
Requirement already satisfied: uv in ./env/lib/python3.9/site-packages (0.5.2)
Requirement already satisfied: wheel in ./env/lib/python3.9/site-packages (0.45.0)
Using Python 3.9.5 environment at: env
Resolved 144 packages in 1.19s
Prepared 77 packages in 6.80s
Uninstalled 68 packages in 312ms
Installed 77 packages in 293ms
 - async-timeout==4.0.3
 + async-timeout==5.0.1
 - attrs==23.2.0
 + attrs==24.2.0
 - babel==2.15.0
 + babel==2.16.0
 - bleach==6.1.0
 + bleach==6.2.0
 - cffi==1.16.0
 + cffi==1.17.1
 - cryptography==42.0.8
 + cryptography==43.0.3
 - deprecated==1.2.14
 + deprecated==1.2.15
 - diff-match-patch==20230430
 + diff-match-patch==20241021
 - dj-rest-auth==6.0.0
 + dj-rest-auth==7.0.0
 - django==4.2.15
 + django==4.2.17
 - django-allauth==0.63.3
 + django-allauth==65.2.0
 - django-cleanup==8.1.0
 + django-cleanup==9.0.0
 - django-cors-headers==4.4.0
 + django-cors-headers==4.6.0
 - django-dbbackup==4.1.0
 + django-dbbackup==4.2.1
 - django-filter==24.2
 + django-filter==24.3
 + django-ipware==7.0.1
 - django-otp==1.5.0
 + django-otp==1.5.4
 - django-q2==1.6.2
 + django-q2==1.7.4
 + django-structlog==8.1.0
 - django-taggit==5.0.1
 + django-taggit==6.1.0
 - dulwich==0.22.1
 + dulwich==0.22.6
 - et-xmlfile==1.1.0
 + et-xmlfile==2.0.0
 + flexcache==0.3
 + flexparser==0.4
 - fonttools==4.53.0
 + fonttools==4.55.0
 - googleapis-common-protos==1.63.2
 + googleapis-common-protos==1.66.0
 - grpcio==1.64.1
 + grpcio==1.68.0
 - gunicorn==22.0.0
 + gunicorn==23.0.0
 - icalendar==5.0.13
 + icalendar==6.1.0
 - importlib-metadata==7.1.0
 + importlib-metadata==8.5.0
 - isodate==0.6.1
 + isodate==0.7.2
 - jsonschema==4.22.0
 + jsonschema==4.23.0
 - jsonschema-specifications==2023.12.1
 + jsonschema-specifications==2024.10.1
 - lxml==5.2.2
 + lxml==5.3.0
 - markdown==3.6
 + markdown==3.7
 - markupsafe==2.1.5
 + markupsafe==3.0.2
 - openpyxl==3.1.4
 + openpyxl==3.1.5
 - opentelemetry-api==1.25.0
 + opentelemetry-api==1.28.2
 - opentelemetry-exporter-otlp==1.25.0
 + opentelemetry-exporter-otlp==1.28.2
 - opentelemetry-exporter-otlp-proto-common==1.25.0
 + opentelemetry-exporter-otlp-proto-common==1.28.2
 - opentelemetry-exporter-otlp-proto-grpc==1.25.0
 + opentelemetry-exporter-otlp-proto-grpc==1.28.2
 - opentelemetry-exporter-otlp-proto-http==1.25.0
 + opentelemetry-exporter-otlp-proto-http==1.28.2
 - opentelemetry-instrumentation==0.46b0
 + opentelemetry-instrumentation==0.49b2
 - opentelemetry-instrumentation-django==0.46b0
 + opentelemetry-instrumentation-django==0.49b2
 - opentelemetry-instrumentation-redis==0.46b0
 + opentelemetry-instrumentation-redis==0.49b2
 - opentelemetry-instrumentation-requests==0.46b0
 + opentelemetry-instrumentation-requests==0.49b2
 - opentelemetry-instrumentation-wsgi==0.46b0
 + opentelemetry-instrumentation-wsgi==0.49b2
 - opentelemetry-proto==1.25.0
 + opentelemetry-proto==1.28.2
 - opentelemetry-sdk==1.25.0
 + opentelemetry-sdk==1.28.2
 - opentelemetry-semantic-conventions==0.46b0
 + opentelemetry-semantic-conventions==0.49b2
 - opentelemetry-util-http==0.46b0
 + opentelemetry-util-http==0.49b2
 - packaging==24.1
 + packaging==24.2
 - pillow==10.3.0
 + pillow==11.0.0
 - pint==0.21
 + pint==0.24.4
 - pip-licenses==4.4.0
 + pip-licenses==5.0.0
 + platformdirs==4.3.6
 - prettytable==3.10.0
 + prettytable==3.12.0
 - protobuf==4.25.3
 + protobuf==5.28.3
 - pyjwt==2.8.0
 + pyjwt==2.10.1
 - pyphen==0.15.0
 + pyphen==0.17.0
 + python-ipware==3.0.0
 - pytz==2024.1
 + pytz==2024.2
 - qrcode==7.4.2
 + qrcode==8.0
 - rapidfuzz==3.9.3
 + rapidfuzz==3.10.1
 - redis==5.0.7
 + redis==5.2.0
 - rpds-py==0.18.1
 + rpds-py==0.21.0
 - sentry-sdk==2.8.0
 + sentry-sdk==2.19.0
 - sqlparse==0.5.0
 + sqlparse==0.5.2
 + structlog==24.4.0
 - tinycss2==1.2.1
 + tinycss2==1.4.0
 + tomli==2.1.0
 + tzdata==2024.2
 - weasyprint==61.2
 + weasyprint==62.3
 - whitenoise==6.7.0
 + whitenoise==6.8.2
 - wrapt==1.16.0
 + wrapt==1.17.0
 - zipp==3.19.2
 + zipp==3.21.0
 - zopfli==0.2.3
 + zopfli==0.2.3.post1
warning: Requirements file `/etc/inventree/plugins.txt` does not contain any dependencies
Using Python 3.9.5 environment at: env
Audited in 6ms
2024-12-23 22:38:35,268 ERROR {'event': 'No CSRF_TRUSTED_ORIGINS specified. Please provide a list of trusted origins, or specify INVENTREE_SITE_URL', 'timestamp': '2024-12-23T22:38:35.268220Z', 'logger': 'inventree', 'level': 'error'}
# POI12| u | Updating InvenTree installation...
# POI12| u | Installing required python packages from '/opt/inventree/src/backend/requirements.txt'
# POI12| u | Collecting uv
# POI12| u |   Downloading uv-0.5.11-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.0 MB)
# POI12| u | Collecting setuptools
# POI12| u |   Downloading setuptools-75.6.0-py3-none-any.whl (1.2 MB)
# POI12| u | Installing collected packages: uv, setuptools
# POI12| u |   Attempting uninstall: uv
# POI12| u |     Found existing installation: uv 0.5.2
# POI12| u |     Uninstalling uv-0.5.2:
# POI12| u |       Successfully uninstalled uv-0.5.2
# POI12| u |   Attempting uninstall: setuptools
# POI12| u |     Found existing installation: setuptools 72.1.0
# POI12| u |     Uninstalling setuptools-72.1.0:
# POI12| u |       Successfully uninstalled setuptools-72.1.0
# POI12| u | Successfully installed setuptools-75.6.0 uv-0.5.11
# POI12| u | Installing plugin packages from '/etc/inventree/plugins.txt'
# POI12| u | Requirement already satisfied: uv in ./env/lib/python3.9/site-packages (0.5.11)
# POI12| u | Python version 3.9.5 - /opt/inventree/env/bin/python3
# POI12| u | ERROR: InvenTree command failed: 'python3 manage.py collectplugins'
# POI12| u | - Refer to the error messages in the log above for more information
# POI12| Set permissions for data dir and media: /opt/inventree/data
# POI14| Site URL already set - skipping
# POI15| Starting InvenTree
# POI15| Started InvenTree
# POI16| Printing Final message
####################################################################################
This InvenTree install uses nginx, the settings for the webserver can be found in
/etc/nginx/sites-enabled/inventree.conf
Try opening InvenTree with either
http://localhost/ or http://162.243.234.188/

Admin user data:
   Email: 
   Username: 
   Password: 
####################################################################################
# POI17| Running postinstall script - done - Mon Dec 23 22:38:35 UTC 2024
No journal files were found.
Failed to add filter for units: No data available
@levins-law levins-law added question This is a question setup Relates to the InvenTree setup / installation process triage:not-checked Item was not checked by the core team labels Dec 23, 2024
@SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat removed the triage:not-checked Item was not checked by the core team label Dec 23, 2024
@levins-law
Copy link
Author

@SchrodingersGat thank you for looking at this. This was not necessary the first time I deployed the droplet months ago. I am further confused because the URL and credentials are already provided in the message of the day when I open the SSH terminal.

Please understand that I have no experience with Linux and I can barely manage interacting with the console. I do my best to follow instructions and steps others have shared, but I don't really know what I am doing. Maybe Inventree just isn't for me.

I tried executing root@inventree0168onubuntu2004-s-1vcpu-1gb-nyc2-01:~# inventree config:set INVENTREE_SITE_URL=http://162.243.234.188 but I am still getting the internal server error.

Thanks again for your assistance.

@SchrodingersGat
Copy link
Member

This was not necessary the first time I deployed the droplet months ago.

As you can see in our 0.17.0 release notes under "breaking changes" (and also on the release blog) there is a change to the underlying django code which requires an adjustment to your setup.

Read the "Samesite Cookie Fix" section - and this PR for further information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question setup Relates to the InvenTree setup / installation process
Projects
None yet
Development

No branches or pull requests

2 participants