mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-27 10:08:44 +00:00
* provide context in docker startup logs
* reduce unnecessary docker logging
* this is set in one place; can be less complicated
(cherry picked from commit 8f668657b3)
Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
1 parent
f3857c6667
commit
0b08318758
2 files changed
+9
-22
No files matched your search
@@ -10,25 +10,23 @@ fi
|
|||||||
|
|
||||||
# Create required directory structure (if it does not already exist)
|
# Create required directory structure (if it does not already exist)
|
||||||
if [[ ! -d "$INVENTREE_STATIC_ROOT" ]]; then
|
if [[ ! -d "$INVENTREE_STATIC_ROOT" ]]; then
|
||||||
echo "Creating directory $INVENTREE_STATIC_ROOT"
|
echo "INFO: Creating directory $INVENTREE_STATIC_ROOT"
|
||||||
mkdir -p $INVENTREE_STATIC_ROOT
|
mkdir -p $INVENTREE_STATIC_ROOT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d "$INVENTREE_MEDIA_ROOT" ]]; then
|
if [[ ! -d "$INVENTREE_MEDIA_ROOT" ]]; then
|
||||||
echo "Creating directory $INVENTREE_MEDIA_ROOT"
|
echo "INFO: Creating directory $INVENTREE_MEDIA_ROOT"
|
||||||
mkdir -p $INVENTREE_MEDIA_ROOT
|
mkdir -p $INVENTREE_MEDIA_ROOT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d "$INVENTREE_BACKUP_DIR" ]]; then
|
if [[ ! -d "$INVENTREE_BACKUP_DIR" ]]; then
|
||||||
echo "Creating directory $INVENTREE_BACKUP_DIR"
|
echo "INFO: Creating directory $INVENTREE_BACKUP_DIR"
|
||||||
mkdir -p $INVENTREE_BACKUP_DIR
|
mkdir -p $INVENTREE_BACKUP_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if "config.yaml" has been copied into the correct location
|
# Check if "config.yaml" has been copied into the correct location
|
||||||
if [[ -f "$INVENTREE_CONFIG_FILE" ]]; then
|
if [[ ! -f "$INVENTREE_CONFIG_FILE" ]]; then
|
||||||
echo "Loading config file : $INVENTREE_CONFIG_FILE"
|
echo "INFO: Copying config file from $INVENTREE_BACKEND_DIR/InvenTree/config_template.yml to $INVENTREE_CONFIG_FILE"
|
||||||
else
|
|
||||||
echo "Copying config file from $INVENTREE_BACKEND_DIR/InvenTree/config_template.yml to $INVENTREE_CONFIG_FILE"
|
|
||||||
cp $INVENTREE_BACKEND_DIR/InvenTree/config_template.yaml $INVENTREE_CONFIG_FILE
|
cp $INVENTREE_BACKEND_DIR/InvenTree/config_template.yaml $INVENTREE_CONFIG_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -39,11 +37,11 @@ if [[ -n "$INVENTREE_PY_ENV" ]]; then
|
|||||||
|
|
||||||
if [[ -d "$INVENTREE_PY_ENV" ]]; then
|
if [[ -d "$INVENTREE_PY_ENV" ]]; then
|
||||||
# venv already exists
|
# venv already exists
|
||||||
echo "Using Python virtual environment: ${INVENTREE_PY_ENV}"
|
echo "INFO: Using Python virtual environment: ${INVENTREE_PY_ENV}"
|
||||||
source ${INVENTREE_PY_ENV}/bin/activate
|
source ${INVENTREE_PY_ENV}/bin/activate
|
||||||
else
|
else
|
||||||
# Setup a virtual environment (within the provided directory)
|
# Setup a virtual environment (within the provided directory)
|
||||||
echo "Running first time setup for python environment"
|
echo "INFO: Running first time setup for python environment"
|
||||||
python3 -m venv ${INVENTREE_PY_ENV} --system-site-packages --upgrade-deps
|
python3 -m venv ${INVENTREE_PY_ENV} --system-site-packages --upgrade-deps
|
||||||
|
|
||||||
# Ensure invoke tool is installed locally
|
# Ensure invoke tool is installed locally
|
||||||
|
|||||||
@@ -34,19 +34,8 @@ try:
|
|||||||
main_repo = Repo(pathlib.Path(__file__).parent.parent.parent.parent.parent)
|
main_repo = Repo(pathlib.Path(__file__).parent.parent.parent.parent.parent)
|
||||||
main_commit = main_repo[main_repo.head()]
|
main_commit = main_repo[main_repo.head()]
|
||||||
except NotGitRepository:
|
except NotGitRepository:
|
||||||
output = logger.warning
|
if os.environ.get('INVENTREE_DOCKER', 'false') != 'true':
|
||||||
|
logger.warning(git_warning_txt)
|
||||||
try:
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
if settings.DOCKER:
|
|
||||||
output = logger.info
|
|
||||||
except Exception:
|
|
||||||
# We may not have access to settings at this point
|
|
||||||
pass
|
|
||||||
|
|
||||||
output(git_warning_txt)
|
|
||||||
|
|
||||||
main_repo = None
|
main_repo = None
|
||||||
main_commit = None
|
main_commit = None
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user