add possibility to set debug-mode in .env
This commit is contained in:
parent
585fffd7ac
commit
4b14d042d7
33
setup.sh
33
setup.sh
|
@ -154,6 +154,9 @@ APPRISE_URLS=""
|
||||||
#APPRISE_URLS="pover://USER_KEY@APP_TOKEN
|
#APPRISE_URLS="pover://USER_KEY@APP_TOKEN
|
||||||
#gotify://gotify.example.com/TOKEN
|
#gotify://gotify.example.com/TOKEN
|
||||||
#matrixs://TOKEN@matrix.org/!ROOM_ID"
|
#matrixs://TOKEN@matrix.org/!ROOM_ID"
|
||||||
|
|
||||||
|
# Enable Debug (e.g. for VS Code)
|
||||||
|
DEBUGPY=0
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
cd $PROJECT_DIR
|
cd $PROJECT_DIR
|
||||||
|
@ -1974,14 +1977,28 @@ body {
|
||||||
CSS_END
|
CSS_END
|
||||||
|
|
||||||
|
|
||||||
# 7. Directories and permissions
|
# 7. directories and permissions
|
||||||
mkdir -p ../data
|
mkdir -p ../data
|
||||||
chmod -R a+rwX ../data
|
chmod -R a+rwX ../data
|
||||||
find ../data -type d -exec chmod 775 {} \;
|
find ../data -type d -exec chmod 775 {} \;
|
||||||
find ../data -type f -exec chmod 664 {} \;
|
find ../data -type f -exec chmod 664 {} \;
|
||||||
|
|
||||||
|
# entrypoint.sh script
|
||||||
|
cat <<SCRIPT_END > entrypoint.sh
|
||||||
|
#!/bin/sh
|
||||||
|
if [ "$DEBUGPY" = "1" ]; then
|
||||||
|
echo "Start with debugpy..."
|
||||||
|
exec python -m debugpy --listen 0.0.0.0:5678 --wait-for-client app.py
|
||||||
|
else
|
||||||
|
echo "Start with gunicorn..."
|
||||||
|
exec gunicorn -b 0.0.0.0:5000 app:app
|
||||||
|
fi
|
||||||
|
SCRIPT_END
|
||||||
|
|
||||||
# Translate-Skript erstellen UND SOFORT AUSFÜHREN
|
chmod +x entrypoint.sh
|
||||||
|
|
||||||
|
|
||||||
|
# create translate.sh and run it
|
||||||
cat <<'SCRIPT_END' > ../translate.sh
|
cat <<'SCRIPT_END' > ../translate.sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -1994,7 +2011,7 @@ if ! command -v jq &>/dev/null; then
|
||||||
echo "❌ jq is required. Install with: sudo apt-get install jq"
|
echo "❌ jq is required. Install with: sudo apt-get install jq"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "\n\033[1;32m✅ we are extracting translations from the templates.\033[0m"
|
echo -e "\n\033[1;32m✅ we are extracting translations from the templates.\033[0m"
|
||||||
# 1. Lege JSON-Dateien an, falls sie fehlen
|
# 1. Lege JSON-Dateien an, falls sie fehlen
|
||||||
for lang in "${LANGS[@]}"; do
|
for lang in "${LANGS[@]}"; do
|
||||||
file="$TRANSLATION_DIR/$lang.json"
|
file="$TRANSLATION_DIR/$lang.json"
|
||||||
|
@ -2022,7 +2039,7 @@ for lang in "${LANGS[@]}"; do
|
||||||
mv "$tmp" "$file"
|
mv "$tmp" "$file"
|
||||||
echo "Updated $file"
|
echo "Updated $file"
|
||||||
done
|
done
|
||||||
echo "\n\033[1;32m✅ JSON translation files updated. Please enter your translations!\033[0m"
|
echo -e "\n\033[1;32m✅ JSON translation files updated. Please enter your translations!\033[0m"
|
||||||
SCRIPT_END
|
SCRIPT_END
|
||||||
|
|
||||||
chmod +x ../translate.sh
|
chmod +x ../translate.sh
|
||||||
|
@ -2054,6 +2071,8 @@ RUN mkdir -p /app/data && \
|
||||||
ENV TZ=${TZ}
|
ENV TZ=${TZ}
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
@ -2071,9 +2090,9 @@ RUN groupadd -g ${GID} appuser && \
|
||||||
|
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000 5678
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|
||||||
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
|
|
||||||
DOCKER_END
|
DOCKER_END
|
||||||
|
|
||||||
# 6. docker-compose.yml
|
# 6. docker-compose.yml
|
||||||
|
@ -2098,7 +2117,7 @@ services:
|
||||||
- ../.env:/app/.env
|
- ../.env:/app/.env
|
||||||
user: "${UID:-1000}:${GID:-1000}"
|
user: "${UID:-1000}:${GID:-1000}"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "--wait-for-client", "app.py"]
|
command: ["/app/entrypoint.sh"]
|
||||||
|
|
||||||
COMPOSE_END
|
COMPOSE_END
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue