Skip to content

Commit 61f351d

Browse files
committed
fix boot script
1 parent a30072c commit 61f351d

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

services/storage/docker/boot.sh

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ IFS=$(printf '\n\t')
66

77
INFO="INFO: [$(basename "$0")] "
88

9-
# BOOTING application ---------------------------------------------
109
echo "$INFO" "Booting in ${SC_BOOT_MODE} mode ..."
1110
echo "$INFO" "User :$(id "$(whoami)")"
1211
echo "$INFO" "Workdir : $(pwd)"
1312

13+
#
14+
# DEVELOPMENT MODE
15+
#
16+
# - prints environ info
17+
# - installs requirements in mounted volume
18+
#
1419
if [ "${SC_BUILD_TARGET}" = "development" ]; then
1520
echo "$INFO" "Environment :"
1621
printenv | sed 's/=/: /' | sed 's/^/ /' | sort
@@ -23,31 +28,34 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then
2328
cd -
2429
echo "$INFO" "PIP :"
2530
uv pip list
26-
27-
echo "$INFO" "Setting entrypoint to use watchmedo autorestart..."
28-
entrypoint='watchmedo auto-restart --recursive --pattern="*.py;*/src/*" --ignore-patterns="*test*;pytest_simcore/*;setup.py;*ignore*" --ignore-directories --'
29-
30-
elif [ "${SC_BUILD_TARGET}" = "production" ]; then
31-
entrypoint=""
3231
fi
3332

3433
if [ "${SC_BOOT_MODE}" = "debug" ]; then
3534
# NOTE: production does NOT pre-installs debugpy
3635
uv pip install --no-cache-dir debugpy
3736
fi
3837

38+
#
39+
# RUNNING application
40+
#
3941
APP_LOG_LEVEL=${STORAGE_LOGLEVEL:-${LOG_LEVEL:-${LOGLEVEL:-INFO}}}
4042
SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]')
41-
42-
# RUNNING application ----------------------------------------
43-
echo "$INFO" "Selected config ${SC_BUILD_TARGET}"
4443
echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL"
4544

4645
if [ "${SC_BOOT_MODE}" = "debug" ]; then
47-
# NOTE: needs debupgy installed
48-
echo "$INFO" "Debugpy initializing in port ${STORAGE_REMOTE_DEBUGGING_PORT} with ${SC_BUILD_TARGET}"
49-
eval "$entrypoint" python3 -m debugpy --listen 0.0.0.0:"${STORAGE_REMOTE_DEBUGGING_PORT}" -m \
50-
simcore_service_storage run
46+
reload_dir_packages=$(find /devel/packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo '--reload-dir {} \' \;)
47+
48+
exec sh -c "
49+
cd services/storage/src/simcore_service_storage && \
50+
python -m debugpy --listen 0.0.0.0:${STORAGE_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \
51+
--host 0.0.0.0 \
52+
--reload \
53+
$reload_dir_packages
54+
--reload-dir . \
55+
--log-level \"${SERVER_LOG_LEVEL}\"
56+
"
5157
else
52-
exec simcore-service-storage run
58+
exec uvicorn simcore_service_storage.main:the_app \
59+
--host 0.0.0.0 \
60+
--log-level "${SERVER_LOG_LEVEL}"
5361
fi

0 commit comments

Comments
 (0)