2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-30 20:55:42 +00:00

refactor(backend): switch to empty buildpack for package, extend supported OS versions (#10705)

* bump vers

* fix ssl?

Added build dependencies for libbz2, libffi, and libssl.

* try empty buildpack

* clean up

* fix ref

* remove things we now do not need anymore

* add 22.04 as a target

* cleanup installer

* add changelog entry

* add dotenv

* update skript

* make task more robust for package usage

* ensure we have a site-url set

* fix style

* fix syntax
This commit is contained in:
Matthias Mair
2025-10-29 01:26:40 +01:00
committed by GitHub
parent 5c556a2a80
commit f47a1a4675
11 changed files with 47 additions and 97 deletions

View File

@@ -2,10 +2,8 @@ name: inventree
description: Open Source Inventory Management System description: Open Source Inventory Management System
homepage: https://inventree.org homepage: https://inventree.org
notifications: true notifications: true
buildpack: https://github.com/mjmair/heroku-buildpack-python#v216-mjmair buildpack: https://github.com/matmair/null-buildpack#master
env: env:
- STACK=heroku-20
- DISABLE_COLLECTSTATIC=1
- INVENTREE_DB_ENGINE=sqlite3 - INVENTREE_DB_ENGINE=sqlite3
- INVENTREE_DB_NAME=database.sqlite3 - INVENTREE_DB_NAME=database.sqlite3
- INVENTREE_PLUGINS_ENABLED - INVENTREE_PLUGINS_ENABLED
@@ -38,4 +36,7 @@ dependencies:
- "libffi7 | libffi8" - "libffi7 | libffi8"
targets: targets:
ubuntu-20.04: true ubuntu-20.04: true
ubuntu-22.04: true
ubuntu-24.04: true
debian-11: true debian-11: true
debian-12: true

View File

@@ -1 +0,0 @@
3.9.2

View File

@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Adds UI elements to "check" and "uncheck" sales order shipments in [#10654](https://github.com/inventree/InvenTree/pull/10654) - Adds UI elements to "check" and "uncheck" sales order shipments in [#10654](https://github.com/inventree/InvenTree/pull/10654)
- Allow assigning project codes to order line items in [#10657](https://github.com/inventree/InvenTree/pull/10657) - Allow assigning project codes to order line items in [#10657](https://github.com/inventree/InvenTree/pull/10657)
- Added support for webauthn login for the frontend in [#9729](https://github.com/inventree/InvenTree/pull/9729) - Added support for webauthn login for the frontend in [#9729](https://github.com/inventree/InvenTree/pull/9729)
- Added support for Debian 12, Ubuntu 22.04 and Ubuntu 24.04 in the installer and package in [#10705](https://github.com/inventree/InvenTree/pull/10705)
### Changed ### Changed

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script was generated by bashly 1.1.1 (https://bashly.dannyb.co) # This script was generated by bashly 1.3.3 (https://bashly.dev)
# Modifying it manually is not recommended # Modifying it manually is not recommended
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then if ((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2))); then
printf "bash version 4 or higher is required\n" >&2 printf "bash version 4.2 or higher is required\n" >&2
exit 1 exit 1
fi fi
@@ -56,17 +56,16 @@ root_command() {
get_distribution get_distribution
echo "### Detected distribution: $OS $VER" echo "### Detected distribution: $OS $VER"
SUPPORTED=true # is this OS supported? SUPPORTED=true # is this OS supported?
NEEDS_LIBSSL1_1=false # does this OS need libssl1.1?
DIST_OS=${OS,,} DIST_OS=${OS,,}
DIST_VER=$VER DIST_VER=$VER
case "$OS" in case "$OS" in
Ubuntu) Ubuntu)
if [[ $VER == "24.04" ]]; then
SUPPORTED=true
if [[ $VER == "22.04" ]]; then if [[ $VER == "22.04" ]]; then
SUPPORTED=true SUPPORTED=true
NEEDS_LIBSSL1_1=true
DIST_VER="20.04"
elif [[ $VER == "20.04" ]]; then elif [[ $VER == "20.04" ]]; then
SUPPORTED=true SUPPORTED=true
else else
@@ -75,7 +74,6 @@ root_command() {
;; ;;
"Debian GNU/Linux" | "debian gnu/linux" | Raspbian) "Debian GNU/Linux" | "debian gnu/linux" | Raspbian)
if [[ $VER == "12" ]]; then if [[ $VER == "12" ]]; then
DIST_VER="11"
SUPPORTED=true SUPPORTED=true
elif [[ $VER == "11" ]]; then elif [[ $VER == "11" ]]; then
SUPPORTED=true SUPPORTED=true
@@ -111,15 +109,6 @@ root_command() {
fi fi
done done
if [[ $NEEDS_LIBSSL1_1 == "true" ]]; then
echo "### Installing libssl1.1"
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
do_call "sudo apt-get update"
do_call "sudo apt-get install libssl1.1"
sudo rm /etc/apt/sources.list.d/focal-security.list
fi
echo "### Getting and adding key" echo "### Getting and adding key"
curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg > /dev/null curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg > /dev/null
echo "### Adding package source" echo "### Adding package source"
@@ -146,15 +135,7 @@ version_command() {
} }
install.sh_usage() { install.sh_usage() {
if [[ -n $long_usage ]]; then printf "install.sh - Interactive installer for InvenTree\n\n"
printf "install.sh - Interactive installer for InvenTree\n"
echo
else
printf "install.sh - Interactive installer for InvenTree\n"
echo
fi
printf "%s\n" "Usage:" printf "%s\n" "Usage:"
printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n" printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n"
@@ -162,7 +143,7 @@ install.sh_usage() {
printf " install.sh --version | -v\n" printf " install.sh --version | -v\n"
echo echo
if [[ -n $long_usage ]]; then if [[ -n "$long_usage" ]]; then
printf "%s\n" "Options:" printf "%s\n" "Options:"
printf " %s\n" "--no-call, -n" printf " %s\n" "--no-call, -n"
@@ -184,13 +165,13 @@ install.sh_usage() {
printf " %s\n" "SOURCE" printf " %s\n" "SOURCE"
printf " Package source that should be used\n" printf " Package source that should be used\n"
printf " Allowed: stable, master, main\n" printf " %s\n" "Allowed: stable, master, main"
printf " Default: stable\n" printf " %s\n" "Default: stable"
echo echo
printf " %s\n" "PUBLISHER" printf " %s\n" "PUBLISHER"
printf " Publisher that should be used\n" printf " Publisher that should be used\n"
printf " Default: inventree\n" printf " %s\n" "Default: inventree"
echo echo
printf "%s\n" "Examples:" printf "%s\n" "Examples:"
@@ -203,11 +184,14 @@ install.sh_usage() {
} }
normalize_input() { normalize_input() {
local arg flags local arg passthru flags
passthru=false
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
arg="$1" arg="$1"
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then if [[ $passthru == true ]]; then
input+=("$arg")
elif [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
input+=("${BASH_REMATCH[1]}") input+=("${BASH_REMATCH[1]}")
input+=("${BASH_REMATCH[2]}") input+=("${BASH_REMATCH[2]}")
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
@@ -218,6 +202,9 @@ normalize_input() {
for ((i = 0; i < ${#flags}; i++)); do for ((i = 0; i < ${#flags}; i++)); do
input+=("-${flags:i:1}") input+=("-${flags:i:1}")
done done
elif [[ "$arg" == "--" ]]; then
passthru=true
input+=("$arg")
else else
input+=("$arg") input+=("$arg")
fi fi
@@ -226,37 +213,11 @@ normalize_input() {
done done
} }
inspect_args() {
if ((${#args[@]})); then
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
echo args:
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
else
echo args: none
fi
if ((${#other_args[@]})); then
echo
echo other_args:
echo "- \${other_args[*]} = ${other_args[*]}"
for i in "${!other_args[@]}"; do
echo "- \${other_args[$i]} = ${other_args[$i]}"
done
fi
if ((${#deps[@]})); then
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
echo
echo deps:
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
fi
}
parse_requirements() { parse_requirements() {
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "${1:-}" in key="$1"
case "$key" in
--version | -v) --version | -v)
version_command version_command
exit exit
@@ -301,11 +262,10 @@ parse_requirements() {
*) *)
if [[ -z ${args['source']+x} ]]; then if [[ -z ${args['source']+x} ]]; then
args['source']=$1 args['source']=$1
shift shift
elif [[ -z ${args['publisher']+x} ]]; then
elif [[ -z ${args['publisher']+x} ]]; then
args['publisher']=$1 args['publisher']=$1
shift shift
else else
@@ -321,7 +281,7 @@ parse_requirements() {
[[ -n ${args['source']:-} ]] || args['source']="stable" [[ -n ${args['source']:-} ]] || args['source']="stable"
[[ -n ${args['publisher']:-} ]] || args['publisher']="inventree" [[ -n ${args['publisher']:-} ]] || args['publisher']="inventree"
if [[ -n ${args['source']} ]] && [[ ! ${args['source']} =~ ^(stable|master|main)$ ]]; then if [[ -n ${args['source']:-} ]] && [[ ! ${args['source']:-} =~ ^(stable|master|main)$ ]]; then
printf "%s\n" "source must be one of: stable, master, main" >&2 printf "%s\n" "source must be one of: stable, master, main" >&2
exit 1 exit 1
fi fi
@@ -329,18 +289,19 @@ parse_requirements() {
} }
initialize() { initialize() {
version="2.0" declare -g version="2.0"
long_usage=''
set -e set -e
} }
run() { run() {
declare -A args=()
declare -A deps=() declare -g long_usage=''
declare -a other_args=() declare -g -A args=()
declare -a input=() declare -g -A deps=()
declare -g -a env_var_names=()
declare -g -a input=()
normalize_input "$@" normalize_input "$@"
parse_requirements "${input[@]}" parse_requirements "${input[@]}"
@@ -349,5 +310,6 @@ run() {
esac esac
} }
command_line_args=("$@")
initialize initialize
run "$@" run "${command_line_args[@]}"

View File

@@ -46,17 +46,16 @@ echo "### Installer for InvenTree - source: $publisher/$source_url"
get_distribution get_distribution
echo "### Detected distribution: $OS $VER" echo "### Detected distribution: $OS $VER"
SUPPORTED=true # is this OS supported? SUPPORTED=true # is this OS supported?
NEEDS_LIBSSL1_1=false # does this OS need libssl1.1?
DIST_OS=${OS,,} DIST_OS=${OS,,}
DIST_VER=$VER DIST_VER=$VER
case "$OS" in case "$OS" in
Ubuntu) Ubuntu)
if [[ $VER == "24.04" ]]; then
SUPPORTED=true
if [[ $VER == "22.04" ]]; then if [[ $VER == "22.04" ]]; then
SUPPORTED=true SUPPORTED=true
NEEDS_LIBSSL1_1=true
DIST_VER="20.04"
elif [[ $VER == "20.04" ]]; then elif [[ $VER == "20.04" ]]; then
SUPPORTED=true SUPPORTED=true
else else
@@ -100,15 +99,6 @@ for pkg in $REQS; do
fi fi
done done
if [[ $NEEDS_LIBSSL1_1 == "true" ]]; then
echo "### Installing libssl1.1"
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
do_call "sudo apt-get update"
do_call "sudo apt-get install libssl1.1"
sudo rm /etc/apt/sources.list.d/focal-security.list
fi
echo "### Getting and adding key" echo "### Getting and adding key"
curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg > /dev/null curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg > /dev/null
echo "### Adding package source" echo "### Adding package source"

View File

@@ -202,7 +202,7 @@ function detect_envs() {
export INVENTREE_DB_HOST=${INVENTREE_DB_HOST:-samplehost} export INVENTREE_DB_HOST=${INVENTREE_DB_HOST:-samplehost}
export INVENTREE_DB_PORT=${INVENTREE_DB_PORT:-123456} export INVENTREE_DB_PORT=${INVENTREE_DB_PORT:-123456}
export INVENTREE_SITE_URL=${INVENTREE_SITE_URL} export INVENTREE_SITE_URL=${INVENTREE_SITE_URL:-http://${INVENTREE_IP}}
export SETUP_CONF_LOADED=true export SETUP_CONF_LOADED=true
fi fi
@@ -327,7 +327,7 @@ function update_or_install() {
# Run update as app user # Run update as app user
echo "# POI12| Updating InvenTree" echo "# POI12| Updating InvenTree"
sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && pip install wheel" sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && pip install wheel python-dotenv"
sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && set -e && invoke update | sed -e 's/^/# POI12| u | /;'" sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && set -e && invoke update | sed -e 's/^/# POI12| u | /;'"
# Make sure permissions are correct again # Make sure permissions are correct again
@@ -407,13 +407,13 @@ function final_message() {
echo -e "${SETUP_NGINX_FILE}" echo -e "${SETUP_NGINX_FILE}"
echo -e "Try opening InvenTree with any of \n${INVENTREE_SITE_URL} , http://localhost/ or http://${INVENTREE_IP}/ \n" echo -e "Try opening InvenTree with any of \n${INVENTREE_SITE_URL} , http://localhost/ or http://${INVENTREE_IP}/ \n"
# Print admin user data only if set # Print admin user data only if set
if ["${INVENTREE_ADMIN_USER}" ]; then if [ -n "${INVENTREE_ADMIN_USER}" ]; then
echo -e "Admin user data:" echo -e "Admin user data:"
echo -e " Email: ${INVENTREE_ADMIN_EMAIL}" echo -e " Email: ${INVENTREE_ADMIN_EMAIL}"
echo -e " Username: ${INVENTREE_ADMIN_USER}" echo -e " Username: ${INVENTREE_ADMIN_USER}"
echo -e " Password: ${INVENTREE_ADMIN_PASSWORD}" echo -e " Password: ${INVENTREE_ADMIN_PASSWORD}"
else else
echo -e "No admin set during this operation - depending on the deployment method a admin user might have been created with an initial password saved in `${SETUP_ADMIN_PASSWORD_FILE}`" echo -e "No admin set during this operation - depending on the deployment method a admin user might have been created with an initial password saved in `$SETUP_ADMIN_PASSWORD_FILE`"
fi fi
echo -e "####################################################################################" echo -e "####################################################################################"
} }

View File

@@ -33,10 +33,10 @@ export SETUP_ADMIN_NOCREATION=${SETUP_ADMIN_NOCREATION:-false}
# SETUP_PYTHON can be set to use a different python version # SETUP_PYTHON can be set to use a different python version
# get base info # get base info
detect_ip
detect_envs detect_envs
detect_docker detect_docker
detect_initcmd detect_initcmd
detect_ip
detect_python detect_python
# Check if we are updating and need to alert # Check if we are updating and need to alert

View File

@@ -5,7 +5,7 @@ title: InvenTree Installer
## Installer ## Installer
The InvenTree installer automates the installation procedure for a production InvenTree server. The InvenTree installer automates the installation procedure for a production InvenTree server.
Supported OSs are Debian 11 and Ubuntu 20.04 LTS. Supported OSs are Debian 10, 11, 12 and Ubuntu 20.04 LTS, 22.04 LTS, 24.04 LTS.
### Quick Script ### Quick Script

View File

@@ -1,3 +0,0 @@
# Dummy requirements file to trigger the package pipeline
# The backend requirements file is located in src/backend/requirements.txt
#

View File

@@ -1 +0,0 @@
python-3.10.7

View File

@@ -1728,7 +1728,7 @@ def frontend_download(
# if clean, delete static/web directory # if clean, delete static/web directory
if clean: if clean:
shutil.rmtree(dest_path, ignore_errors=True) shutil.rmtree(dest_path, ignore_errors=True)
dest_path.mkdir() dest_path.mkdir(parents=True, exist_ok=True)
info(f'Cleaned directory: {dest_path}') info(f'Cleaned directory: {dest_path}')
# unzip build to static folder # unzip build to static folder
@@ -1792,6 +1792,7 @@ def frontend_download(
# if zip file is specified, try to extract it directly # if zip file is specified, try to extract it directly
if file: if file:
handle_extract(file) handle_extract(file)
static(c, frontend=False, skip_plugins=True)
return return
# check arguments # check arguments