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

Add package-based install method (#3743)

* Add runtime

* add procfile

* add settings for packaging

* use heroku buildpack

* maybe a hash works?

* try brnach instead of tag or hash

* remove reference alltogether

* maybe this syntax?

* switch back to normal buildpack

* and heroku again

* try official sample

* maybe a tar?

* just git clone?

* lower version

* lower version

* switch of settings

* try this again

* maybe install python before?

* no sudo?

* just build for ubuntu?

* set runtime lower and use custom buildpack

* remove initial command

* add release command

* do not collect static while releaseing

* switch to custom backend

* Update .pkgr.yml

* new backend

* upgrade runtime version

* consolidate env

* update python version

* add debian as target

* fix os name

* extend requirements

* remove release command

* remove ssl dep

* add worker command

* add scripts

* debug listing

* make scripts executable

* use python3

* add python install

* add python as dep

* debug step

* switch to app home

* set paths right

* check local command

* remove path

* update path

* add sample install script

* more debugging

* dbg msg

* more enviroment stuff

* more dbugging

* more defined install script

* reduce function

* add debug script

* and more

* remove before

* reduce lines

* cleanup deps

* maybe this way?

* rm "

* rename env

* fix files

* use dot annotation

* ls

* add msgs

* move activation

* ref?

* use source

* use point annotation

* remove activate

* create env and add it to the enviroment

* use full paths

* move python init

* use modern python

* use version numbers for ubuntu

* add default env vars ( for now)

* use export

* use shorthand command

* add more variables

* use apphome reference in paths

* add wasyprint dependencies

* also use wheels

* add gettext for comiling messages

* add nginx setting

* remove postgres from required stack

* refactor fiel configs

* make sure parent dirs exsist

* add wheels

* move python setup again

* update packe name

* update gunicron command

* move to config

* try cleaner procfile

* use python 3 wheels

* update service def

* Add enviroment settings to packaging

* restart nginx

* remove slack

* change nginx config name

* fix styles

* set permissions on update

* Add single line install to README

* move nginx names back

* use production sample as nginx config

* fix sed statement

* cleaner nginx setup

* keep configs in config file instead of packaging index

* fix sed connamds to remove spaces

* reintroduce spaces

* Also disable debug mode

* fix file permissions

* remove unneeded commands

* readd missing spaces

* add admin user generation

* Show public ipadress in final message

* small cleanups

* Add log to setup

* remove logging

* remove logging parts

* chown all dirs

* run update command as right user already

* set path before running command

* fix permission setup

* switch right assignment

* run commands with sudo

* pass in envs

* preserve only selected enviroment

* show enviroment variables

* silence curl

* fix envs

* clean up final message

* move nginx file to variable

* make admin creation conditional

* a bit more overview for setup variables

* test if nginx is available

* unlink instead of delet

* clean up functions

* well that was dumb

* ok double dumb - now i tested it

* use config for admin generation

* fix logic

* show value - not call it

* switch functions to sh

* fix syntax

* add admin data to exposed envs

* remove keeping of admin pwd

* switch to true/false

* make nginx file location configureable

* use gunicorn instead

* fix syntax

* set base dir

* move env to seperate function

* Also use/write database settings

* use conf values if available

* format sh

* update passed envs

* fix dep

* enable installing extra packages via env (ie database backends)

* ann more logging steps

* add more debuggin steps

* get local envs

* add more debug and reorder

* more code for testing

* fix call

* Add debug msg

* turn install quiet

* fix syntax

* reduce debugging

* add log step

* add datestamp

* add marker to inv execution

* fix syntax

* add codeowner
This commit is contained in:
Matthias Mair
2022-10-16 01:14:18 +02:00
committed by GitHub
parent c6709a7055
commit 2800d843e0
10 changed files with 478 additions and 2 deletions

View File

@ -22,6 +22,16 @@ def get_base_dir() -> Path:
return Path(__file__).parent.parent.resolve()
def ensure_dir(path: Path) -> None:
"""Ensure that a directory exists.
If it does not exist, create it.
"""
if not path.exists():
path.mkdir(parents=True, exist_ok=True)
def get_config_file(create=True) -> Path:
"""Returns the path of the InvenTree configuration file.
@ -39,6 +49,7 @@ def get_config_file(create=True) -> Path:
if not cfg_filename.exists() and create:
print("InvenTree configuration file 'config.yaml' not found - creating default file")
ensure_dir(cfg_filename.parent)
cfg_template = base_dir.joinpath("config_template.yaml")
shutil.copyfile(cfg_template, cfg_filename)
@ -169,6 +180,7 @@ def get_plugin_file():
if not plugin_file.exists():
logger.warning("Plugin configuration file does not exist - creating default file")
logger.info(f"Creating plugin file at '{plugin_file}'")
ensure_dir(plugin_file.parent)
# If opening the file fails (no write permission, for example), then this will throw an error
plugin_file.write_text("# InvenTree Plugins (uses PIP framework to install)\n\n")
@ -201,6 +213,7 @@ def get_secret_key():
if not secret_key_file.exists():
logger.info(f"Generating random key file at '{secret_key_file}'")
ensure_dir(secret_key_file.parent)
# Create a random key file
options = string.digits + string.ascii_letters + string.punctuation

View File

@ -1,4 +1,8 @@
# Secret key for backend
# Use the environment variable INVENTREE_SECRET_KEY_FILE
#secret_key_file: '/etc/inventree/secret_key.txt'
# Database backend selection - Configure backend database settings
# Documentation: https://inventree.readthedocs.io/en/latest/start/config/
@ -22,6 +26,13 @@ database:
# HOST: Database host address (if required)
# PORT: Database host port (if required)
# --- Database settings ---
#ENGINE: sampleengine
#NAME: '/path/to/database'
#USER: sampleuser
#PASSWORD: samplepassword
#HOST: samplehost
#PORT: sampleport
# --- Example Configuration - MySQL ---
#ENGINE: mysql
@ -105,8 +116,8 @@ sentry_enabled: False
# Set this variable to True to enable InvenTree Plugins
# Alternatively, use the environment variable INVENTREE_PLUGINS_ENABLED
plugins_enabled: False
#plugin_file: /path/to/plugins.txt
#plugin_dir: /path/to/plugins/
#plugin_file: '/path/to/plugins.txt'
#plugin_dir: '/path/to/plugins/'
# Allowed hosts (see ALLOWED_HOSTS in Django settings documentation)
# A list of strings representing the host/domain names that this Django site can serve.