Source Code added
This commit is contained in:
parent
800376eafd
commit
9efa9bc6dd
3912 changed files with 754770 additions and 2 deletions
13
machine-learning/scripts/configure-apt.sh
Executable file
13
machine-learning/scripts/configure-apt.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sed -i -e's/ main/ main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources
|
||||
sed -i -e's/ bookworm-updates/ bookworm-updates sid/g' /etc/apt/sources.list.d/debian.sources
|
||||
|
||||
# default priority is 500, so we set unstable to 450 to prefer stable packages
|
||||
cat > /etc/apt/preferences.d/preferences << EOL
|
||||
Package: *
|
||||
Pin: release a=unstable
|
||||
Pin-Priority: 450
|
||||
EOL
|
||||
27
machine-learning/scripts/healthcheck.py
Normal file
27
machine-learning/scripts/healthcheck.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import os
|
||||
import sys
|
||||
from ipaddress import ip_address
|
||||
|
||||
import requests
|
||||
|
||||
port = os.getenv("IMMICH_PORT", 3003)
|
||||
host = os.getenv("IMMICH_HOST", "0.0.0.0")
|
||||
|
||||
|
||||
def is_ipv6(host: str) -> bool:
|
||||
try:
|
||||
return ip_address(host).version == 6
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
host = "localhost" if host == "0.0.0.0" else host
|
||||
host = f"[{host}]" if is_ipv6(host) else host
|
||||
|
||||
try:
|
||||
response = requests.get(f"http://{host}:{port}/ping", timeout=2)
|
||||
if response.status_code == 200:
|
||||
sys.exit(0)
|
||||
sys.exit(1)
|
||||
except requests.RequestException:
|
||||
sys.exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue