mirror of
https://github.com/akuker/RASCSI.git
synced 2026-04-26 06:18:10 +00:00
Merge pull request #819 from nucleogenic/docker-dev-environment
Docker environment for development and testing
This commit is contained in:
@@ -10,6 +10,7 @@ import pathlib
|
||||
from tempfile import TemporaryDirectory
|
||||
from re import escape, match
|
||||
from json import loads, JSONDecodeError
|
||||
from shutil import move
|
||||
from util.run import run
|
||||
|
||||
FORK_OUTPUT_TYPE_VISIBLE = "visible"
|
||||
@@ -140,7 +141,7 @@ def extract_archive(file_path, **kwargs):
|
||||
# The parent dir may not be specified as a member, so ensure it exists
|
||||
target_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
logging.debug("Moving temp file: %s -> %s", source_path, target_path)
|
||||
source_path.rename(target_path)
|
||||
move(source_path, target_path)
|
||||
moved.append(member)
|
||||
|
||||
return {
|
||||
|
||||
@@ -4,7 +4,7 @@ Flask==2.0.1
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.1
|
||||
MarkupSafe==2.0.1
|
||||
protobuf==3.17.3
|
||||
protobuf==3.20.1
|
||||
requests==2.26.0
|
||||
simplepam==0.1.5
|
||||
flask_babel==2.0.0
|
||||
|
||||
+16
-2
@@ -1048,6 +1048,11 @@ if __name__ == "__main__":
|
||||
help="Log level for Web UI. Default: warning",
|
||||
choices=["debug", "info", "warning", "error", "critical"],
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dev-mode",
|
||||
action="store_true",
|
||||
help="Run in development mode"
|
||||
)
|
||||
|
||||
arguments = parser.parse_args()
|
||||
APP.config["TOKEN"] = arguments.password
|
||||
@@ -1064,5 +1069,14 @@ if __name__ == "__main__":
|
||||
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)s %(message)s",
|
||||
level=arguments.log_level.upper())
|
||||
|
||||
print("Serving rascsi-web...")
|
||||
bjoern.run(APP, "0.0.0.0", arguments.port)
|
||||
if arguments.dev_mode:
|
||||
print("Running rascsi-web in development mode ...")
|
||||
APP.debug = True
|
||||
from werkzeug.debug import DebuggedApplication
|
||||
try:
|
||||
bjoern.run(DebuggedApplication(APP, evalex=False), "0.0.0.0", arguments.port)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
else:
|
||||
print("Serving rascsi-web...")
|
||||
bjoern.run(APP, "0.0.0.0", arguments.port)
|
||||
|
||||
+10
-1
@@ -110,6 +110,9 @@ while [ "$1" != "" ]; do
|
||||
-l | --log-level)
|
||||
ARG_LOG_LEVEL="--log-level $VALUE"
|
||||
;;
|
||||
-d | --dev-mode)
|
||||
ARG_DEV_MODE="--dev-mode"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown parameter \"$PARAM\""
|
||||
exit 1
|
||||
@@ -122,4 +125,10 @@ PYTHON_COMMON_PATH=$(dirname $PWD)/common/src
|
||||
echo "Starting web server for RaSCSI Web Interface..."
|
||||
export PYTHONPATH=$PWD/src:${PYTHON_COMMON_PATH}
|
||||
cd src
|
||||
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL}
|
||||
|
||||
if [[ $ARG_DEV_MODE ]]; then
|
||||
watchmedo auto-restart --directory=../../ --pattern=*.py --recursive -- \
|
||||
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE}
|
||||
else
|
||||
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE}
|
||||
fi
|
||||
Reference in New Issue
Block a user