2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 18:45:40 +00:00

[WIP] docker / Caddy (#6551)

* remove docker-sqlite file

- Do not want to encourage use of sqlite

* Add Caddyfile

* Add default site URL to .env

- Matches Caddyfile

* Cleanup / simplify .env file

* Remove dev nginx conf file

* Further cleanup of .env file

* Update docker-compose.yml

- Use caddy image instead of nginx as proxy

* Set max body size

* gunicorn: enable external logging

* Update file structure

* Cleanup docker-compose file

* Update docker/docker-compose.yml

Co-authored-by: Matthias Mair <code@mjmair.com>

* Update docker/Caddyfile

Co-authored-by: Matthias Mair <code@mjmair.com>

* Fix for postgresql packages

- Need postgresql13-client to be installed, it contains pg_dump
- Without this, backup / restore *does not work*

* Create static_i18n dir if it does not exist

* Reduce output from collectstatic

* Revert gunicorn logging

- Want to see the logs in docker

* Fix trailing slash

Ref: https://github.com/inventree/InvenTree/pull/6551#issuecomment-1962423765

* tasks.py - pass 'nouv' option through

* Update package requirements:

- Allow installation of rapidfuzz without building

* Install uv as part of docker image

* Add environment variable to control downstream URL

* Do not use uv package manager by default

- Currently does not work "correctly" - ignores installed packages
- Requires further work to run reliably

* Fix docker-compose file

- Do not build locally

* Cleanup gunicorn file

- Remove unused lien

* Cleanup docker-compose.yml

- Simpler volume management

* Update Caddyfile

Add newline

* Update requirements.txt

Add newline

* Update tasks.py

Add missing blank line

* Simplify Caddyfile

* Adds option for customizing web port

* cleanup docker-compose.yml

- Better mapping of caddy data
- Cleaner volume setup

* Add django version template

- Ensure all docs links point to the current django version we are using

* docs: cleanup intro.md

* Cleanup serving_files.md

* Cleanup config.md

* docker install docs updates

* Enable code block copying

* Fix include file

* Fix link

* Update docker install docs

* Update docker.md

* Add info about demo dataset

* Tweak heading

* Update docs link checks

* Fix workflow

* Another fix

* More ignore pattearns

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
Oliver
2024-02-28 01:06:19 +11:00
committed by GitHub
parent 8a128a2bdd
commit f6123cc261
35 changed files with 557 additions and 937 deletions

View File

@ -207,8 +207,8 @@ def check_file_existance(filename: str, overwrite: bool = False):
# Install tasks
@task(help={'nouv': 'Do not use UV'})
def plugins(c, nouv=False):
@task(help={'uv': 'Use UV (experimental package manager)'})
def plugins(c, uv=False):
"""Installs all plugins as specified in 'plugins.txt'."""
from InvenTree.InvenTree.config import get_plugin_file
@ -217,20 +217,20 @@ def plugins(c, nouv=False):
print(f"Installing plugin packages from '{plugin_file}'")
# Install the plugins
if nouv:
if not uv:
c.run(f"pip3 install --disable-pip-version-check -U -r '{plugin_file}'")
else:
c.run('pip3 install --no-cache-dir --disable-pip-version-check uv')
c.run(f"uv pip install -r '{plugin_file}'")
@task(post=[plugins], help={'nouv': 'Do not use UV'})
def install(c, nouv=False):
@task(help={'uv': 'Use UV package manager (experimental)'})
def install(c, uv=False):
"""Installs required python packages."""
print("Installing required python packages from 'requirements.txt'")
# Install required Python packages with PIP
if nouv:
if not uv:
c.run('pip3 install --upgrade pip')
c.run('pip3 install --upgrade setuptools')
c.run(
@ -241,6 +241,9 @@ def install(c, nouv=False):
c.run('uv pip install --upgrade setuptools')
c.run('uv pip install -U -r requirements.txt')
# Run plugins install
plugins(c, uv=uv)
@task(help={'tests': 'Set up test dataset at the end'})
def setup_dev(c, tests=False):
@ -305,7 +308,7 @@ def static(c, frontend=False):
frontend_build(c)
print('Collecting static files...')
manage(c, 'collectstatic --no-input --clear')
manage(c, 'collectstatic --no-input --clear --verbosity 0')
@task
@ -389,6 +392,7 @@ def migrate(c):
'frontend': 'Force frontend compilation/download step (ignores INVENTREE_DOCKER)',
'no_frontend': 'Skip frontend compilation/download step',
'skip_static': 'Skip static file collection step',
'uv': 'Use UV (experimental package manager)',
},
)
def update(
@ -397,6 +401,7 @@ def update(
frontend: bool = False,
no_frontend: bool = False,
skip_static: bool = False,
uv: bool = False,
):
"""Update InvenTree installation.
@ -414,7 +419,7 @@ def update(
- translate_stats
"""
# Ensure required components are installed
install(c)
install(c, uv=uv)
if not skip_backup:
backup(c)