mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-05-18 21:36:31 -04:00
rename startup script and make the mediamanager logo look cooler on startup
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -25,14 +25,19 @@ ENV PUBLIC_VERSION=${VERSION} \
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ca-certificates gcc mime-support curl gzip unzip tar 7zip bzip2 unar && \
|
||||
apt-get install -y ca-certificates gcc bc locales mime-support curl gzip unzip tar 7zip bzip2 unar && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
|
||||
RUN locale-gen
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --locked
|
||||
|
||||
COPY --chmod=755 mediamanager-backend-startup.sh .
|
||||
COPY --chmod=755 mediamanager-startup.sh .
|
||||
COPY config.example.toml .
|
||||
COPY media_manager ./media_manager
|
||||
COPY alembic ./alembic
|
||||
@@ -42,4 +47,4 @@ COPY --from=frontend-build /frontend/build /app/web/build
|
||||
|
||||
HEALTHCHECK CMD curl -f http://localhost:8000${BASE_PATH}/api/v1/health || exit 1
|
||||
EXPOSE 8000
|
||||
CMD ["/app/mediamanager-backend-startup.sh"]
|
||||
CMD ["/app/mediamanager-startup.sh"]
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This script is used to start the MediaManager backend service.
|
||||
|
||||
|
||||
# text created with https://patorjk.com/software/taag/ font: Slanted
|
||||
echo "
|
||||
__ ___ ___ __ ___ ____ __ __
|
||||
/ |/ /__ ____/ (_)___ _/ |/ /___ _____ ____ _____ ____ _____ / __ )____ ______/ /_____ ____ ____/ /
|
||||
/ /|_/ / _ \/ __ / / __ \`/ /|_/ / __ \`/ __ \/ __ \`/ __ \`/ _ \/ ___/ / __ / __ \`/ ___/ //_/ _ \/ __ \/ __ /
|
||||
/ / / / __/ /_/ / / /_/ / / / / /_/ / / / / /_/ / /_/ / __/ / / /_/ / /_/ / /__/ ,< / __/ / / / /_/ /
|
||||
/_/ /_/\___/\__,_/_/\__,_/_/ /_/\__,_/_/ /_/\__,_/\__, /\___/_/ /_____/\__,_/\___/_/|_|\___/_/ /_/\__,_/
|
||||
/____/
|
||||
"
|
||||
echo "Buy me a coffee at https://buymeacoffee.com/maxdorninger"
|
||||
|
||||
# Initialize config if it doesn't exist
|
||||
CONFIG_DIR=${CONFIG_DIR:-/app/config}
|
||||
CONFIG_FILE="$CONFIG_DIR/config.toml"
|
||||
EXAMPLE_CONFIG="/app/config.example.toml"
|
||||
|
||||
echo "Checking configuration setup..."
|
||||
|
||||
# Create config directory if it doesn't exist
|
||||
if [ ! -d "$CONFIG_DIR" ]; then
|
||||
echo "Creating config directory: $CONFIG_DIR"
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
fi
|
||||
|
||||
# Copy example config if config.toml doesn't exist
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Config file not found. Copying example config to: $CONFIG_FILE"
|
||||
if [ -f "$EXAMPLE_CONFIG" ]; then
|
||||
cp "$EXAMPLE_CONFIG" "$CONFIG_FILE"
|
||||
echo "Example config copied successfully!"
|
||||
echo "Please edit $CONFIG_FILE to configure MediaManager for your environment."
|
||||
echo "Important: Make sure to change the token_secret value!"
|
||||
else
|
||||
echo "ERROR: Example config file not found at $EXAMPLE_CONFIG"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Config file found at: $CONFIG_FILE"
|
||||
fi
|
||||
|
||||
echo "Running DB migrations..."
|
||||
|
||||
uv run alembic upgrade head
|
||||
|
||||
echo "Starting MediaManager backend service..."
|
||||
echo ""
|
||||
echo "🔐 LOGIN INFORMATION:"
|
||||
echo " If this is a fresh installation, a default admin user will be created automatically."
|
||||
echo " Check the application logs for the login credentials."
|
||||
echo " You can also register a new user and it will become admin if the email"
|
||||
echo " matches one of the admin_emails in your config.toml"
|
||||
echo ""
|
||||
|
||||
PORT=${PORT:-8000}
|
||||
uv run fastapi run /app/media_manager/main.py --port "$PORT" --proxy-headers
|
||||
151
mediamanager-startup.sh
Normal file
151
mediamanager-startup.sh
Normal file
@@ -0,0 +1,151 @@
|
||||
#!/bin/bash
|
||||
# This script is used to start the MediaManager backend service.
|
||||
|
||||
|
||||
# text created with https://patorjk.com/software/taag/ font: Slanted
|
||||
display_cool_text() {
|
||||
local ascii_art="$1"
|
||||
|
||||
local r_blue=80
|
||||
local g_blue=100
|
||||
local b_blue=230
|
||||
|
||||
local r_orange=255
|
||||
local g_orange=140
|
||||
local b_orange=80
|
||||
|
||||
local r_red=230
|
||||
local g_red=40
|
||||
local b_red=70
|
||||
|
||||
local max_width=0
|
||||
while IFS= read -r line; do
|
||||
local line_length=${#line}
|
||||
if (( line_length > max_width )); then
|
||||
max_width=$line_length
|
||||
fi
|
||||
done <<< "$ascii_art"
|
||||
|
||||
while IFS= read -r line; do
|
||||
local length=${#line}
|
||||
|
||||
if [[ $length -eq 0 ]]; then
|
||||
echo ""
|
||||
continue
|
||||
fi
|
||||
|
||||
local seg1=$((max_width / 2))
|
||||
|
||||
for (( i=0; i<length; i++ )); do
|
||||
local char="${line:$i:1}"
|
||||
|
||||
local r=0
|
||||
local g=0
|
||||
local b=0
|
||||
|
||||
if (( i < seg1 )); then
|
||||
local percentage=$(echo "scale=2; $i / $seg1" | bc)
|
||||
r=$(echo "scale=0; $r_blue + ($r_orange - $r_blue) * $percentage" | bc | cut -d. -f1)
|
||||
g=$(echo "scale=0; $g_blue + ($g_orange - $g_blue) * $percentage" | bc | cut -d. -f1)
|
||||
b=$(echo "scale=0; $b_blue + ($b_orange - $b_blue) * $percentage" | bc | cut -d. -f1)
|
||||
else
|
||||
local segment_pos=$(( i - seg1 ))
|
||||
local segment_length=$(( max_width - seg1 ))
|
||||
if [[ $segment_length -eq 0 ]]; then
|
||||
segment_length=1
|
||||
fi
|
||||
local percentage=$(echo "scale=2; $segment_pos / $segment_length" | bc)
|
||||
r=$(echo "scale=0; $r_orange + ($r_red - $r_orange) * $percentage" | bc | cut -d. -f1)
|
||||
g=$(echo "scale=0; $g_orange + ($g_red - $g_orange) * $percentage" | bc | cut -d. -f1)
|
||||
b=$(echo "scale=0; $b_orange + ($b_red - $b_orange) * $percentage" | bc | cut -d. -f1)
|
||||
fi
|
||||
|
||||
[[ $r -lt 0 ]] && r=0
|
||||
[[ $r -gt 255 ]] && r=255
|
||||
[[ $g -lt 0 ]] && g=0
|
||||
[[ $g -gt 255 ]] && g=255
|
||||
[[ $b -lt 0 ]] && b=0
|
||||
[[ $b -gt 255 ]] && b=255
|
||||
|
||||
if [[ "$char" == " " ]]; then
|
||||
printf " "
|
||||
else
|
||||
printf "\033[38;2;%d;%d;%dm%s\033[0m" $r $g $b "$char"
|
||||
fi
|
||||
done
|
||||
printf "\n"
|
||||
done <<< "$ascii_art"
|
||||
}
|
||||
ASCII_ART='
|
||||
|
||||
██████ ██████ █████ ███
|
||||
░░██████ ██████ ░░███ ░░░
|
||||
░███░█████░███ ██████ ███████ ████ ██████
|
||||
░███░░███ ░███ ███░░███ ███░░███ ░░███ ░░░░░███
|
||||
░███ ░░░ ░███ ░███████ ░███ ░███ ░███ ███████
|
||||
░███ ░███ ░███░░░ ░███ ░███ ░███ ███░░███
|
||||
█████ █████░░██████ ░░████████ █████░░████████
|
||||
░░░░░ ░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░░░
|
||||
|
||||
|
||||
|
||||
██████ ██████
|
||||
░░██████ ██████
|
||||
░███░█████░███ ██████ ████████ ██████ ███████ ██████ ████████
|
||||
░███░░███ ░███ ░░░░░███ ░░███░░███ ░░░░░███ ███░░███ ███░░███░░███░░███
|
||||
░███ ░░░ ░███ ███████ ░███ ░███ ███████ ░███ ░███░███████ ░███ ░░░
|
||||
░███ ░███ ███░░███ ░███ ░███ ███░░███ ░███ ░███░███░░░ ░███
|
||||
█████ █████░░████████ ████ █████░░████████░░███████░░██████ █████
|
||||
░░░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ░░░░░░░░ ░░░░░███ ░░░░░░ ░░░░░
|
||||
███ ░███
|
||||
░░██████
|
||||
░░░░░░
|
||||
|
||||
'
|
||||
display_cool_text "$ASCII_ART"
|
||||
echo "Buy me a coffee at https://buymeacoffee.com/maxdorninger"
|
||||
|
||||
# Initialize config if it doesn't exist
|
||||
CONFIG_DIR=${CONFIG_DIR:-/app/config}
|
||||
CONFIG_FILE="$CONFIG_DIR/config.toml"
|
||||
EXAMPLE_CONFIG="/app/config.example.toml"
|
||||
|
||||
echo "Checking configuration setup..."
|
||||
|
||||
# Create config directory if it doesn't exist
|
||||
if [ ! -d "$CONFIG_DIR" ]; then
|
||||
echo "Creating config directory: $CONFIG_DIR"
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
fi
|
||||
|
||||
# Copy example config if config.toml doesn't exist
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Config file not found. Copying example config to: $CONFIG_FILE"
|
||||
if [ -f "$EXAMPLE_CONFIG" ]; then
|
||||
cp "$EXAMPLE_CONFIG" "$CONFIG_FILE"
|
||||
echo "Example config copied successfully!"
|
||||
echo "Please edit $CONFIG_FILE to configure MediaManager for your environment."
|
||||
echo "Important: Make sure to change the token_secret value!"
|
||||
else
|
||||
echo "ERROR: Example config file not found at $EXAMPLE_CONFIG"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Config file found at: $CONFIG_FILE"
|
||||
fi
|
||||
|
||||
echo "Running DB migrations..."
|
||||
|
||||
uv run alembic upgrade head
|
||||
|
||||
echo "Starting MediaManager backend service..."
|
||||
echo ""
|
||||
echo "🔐 LOGIN INFORMATION:"
|
||||
echo " If this is a fresh installation, a default admin user will be created automatically."
|
||||
echo " Check the application logs for the login credentials."
|
||||
echo " You can also register a new user and it will become admin if the email"
|
||||
echo " matches one of the admin_emails in your config.toml"
|
||||
echo ""
|
||||
|
||||
PORT=${PORT:-8000}
|
||||
uv run fastapi run /app/media_manager/main.py --port "$PORT" --proxy-headers
|
||||
Reference in New Issue
Block a user