mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-27 20:16:22 +02:00
New sdcard base image & sd card build fixes (#3456)
- wrapt fix - python3-mako - Fix install issues with wrong hashes and python environment mismatch - #3455 fix ExecStart path of blitzapi
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Build your SD card image based on: 2022-04-04-raspios-bullseye-arm64.img.xz
|
# Build your SD card image based on: 2022-04-04-raspios-bullseye-arm64.img.xz
|
||||||
# https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-04-07/
|
# https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/
|
||||||
# SHA256: 5adcab7a063310734856adcdd2041c8d58f65c185a3383132bc758886528a93d
|
# SHA256: c42856ffca096480180b5aff66e1dad2f727fdc33359b24e0d2d49cc7676b576
|
||||||
# PGP fingerprint: 8738CD6B956F460C
|
# PGP fingerprint: 8738CD6B956F460C
|
||||||
# PGP key: https://www.raspberrypi.org/raspberrypi_downloads.gpg.key
|
# PGP key: https://www.raspberrypi.org/raspberrypi_downloads.gpg.key
|
||||||
# setup fresh SD card with image above - login per SSH and run this script:
|
# setup fresh SD card with image above - login per SSH and run this script:
|
||||||
@@ -304,7 +304,8 @@ echo -e "\n*** SOFTWARE UPDATE ***"
|
|||||||
# lsb-release -> needed to know which distro version we're running to add APT sources
|
# lsb-release -> needed to know which distro version we're running to add APT sources
|
||||||
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release"
|
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release"
|
||||||
|
|
||||||
python_dependencies="python3-venv python3-dev python3-wheel python3-jinja2 python3-pip"
|
# python3-mako --> https://github.com/rootzoll/raspiblitz/issues/3441
|
||||||
|
python_dependencies="python3-venv python3-dev python3-wheel python3-jinja2 python3-pip python3-mako"
|
||||||
server_utils="rsync net-tools xxd netcat openssh-client openssh-sftp-server sshpass psmisc ufw sqlite3"
|
server_utils="rsync net-tools xxd netcat openssh-client openssh-sftp-server sshpass psmisc ufw sqlite3"
|
||||||
[ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config
|
[ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config
|
||||||
apt_install ${general_utils} ${python_dependencies} ${server_utils} ${armbian_dependencies}
|
apt_install ${general_utils} ${python_dependencies} ${server_utils} ${armbian_dependencies}
|
||||||
@@ -320,7 +321,7 @@ sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
|
|||||||
# pytesseract mechanize PySocks urwid Pillow requests
|
# pytesseract mechanize PySocks urwid Pillow requests
|
||||||
# 3. Nyx
|
# 3. Nyx
|
||||||
# setuptools
|
# setuptools
|
||||||
python_libs="grpcio==1.42.0 googleapis-common-protos==1.53.0 toml==0.10.2 j2cli==0.3.10 requests[socks]==2.21.0 protobuf==3.20.1 mako==1.2.3"
|
python_libs="grpcio==1.42.0 googleapis-common-protos==1.53.0 toml==0.10.2 j2cli==0.3.10 requests[socks]==2.21.0 protobuf==3.20.1 wrapt==1.14.1"
|
||||||
torbox_libs="pytesseract mechanize PySocks urwid Pillow requests setuptools"
|
torbox_libs="pytesseract mechanize PySocks urwid Pillow requests setuptools"
|
||||||
sudo -H python3 -m pip install --upgrade pip
|
sudo -H python3 -m pip install --upgrade pip
|
||||||
sudo -H python3 -m pip install ${python_libs} ${torbox_libs}
|
sudo -H python3 -m pip install ${python_libs} ${torbox_libs}
|
||||||
|
32
home.admin/config.scripts/blitz.web.api.sh
Executable file → Normal file
32
home.admin/config.scripts/blitz.web.api.sh
Executable file → Normal file
@@ -18,6 +18,7 @@ fi
|
|||||||
DEFAULT_GITHUB_USER="fusion44"
|
DEFAULT_GITHUB_USER="fusion44"
|
||||||
DEFAULT_GITHUB_REPO="blitz_api"
|
DEFAULT_GITHUB_REPO="blitz_api"
|
||||||
DEFAULT_GITHUB_BRANCH="main"
|
DEFAULT_GITHUB_BRANCH="main"
|
||||||
|
DEFAULT_GITHUB_COMMITORTAG="v0.5.0-beta"
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# UPDATE CONFIG
|
# UPDATE CONFIG
|
||||||
@@ -155,6 +156,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
DEFAULT_GITHUB_BRANCH="$4"
|
DEFAULT_GITHUB_BRANCH="$4"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$5" != "" ]; then
|
||||||
|
DEFAULT_GITHUB_COMMITORTAG="$5"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "# INSTALL Web API ..."
|
echo "# INSTALL Web API ..."
|
||||||
# clean old source
|
# clean old source
|
||||||
rm -r /root/blitz_api 2>/dev/null
|
rm -r /root/blitz_api 2>/dev/null
|
||||||
@@ -185,17 +190,24 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
sudo -u blitzapi ln -s /mnt/hdd/app-data/.lightning /home/blitzapi/
|
sudo -u blitzapi ln -s /mnt/hdd/app-data/.lightning /home/blitzapi/
|
||||||
|
|
||||||
cd /home/blitzapi || exit 1
|
cd /home/blitzapi || exit 1
|
||||||
|
|
||||||
# git clone https://github.com/fusion44/blitz_api.git /home/blitzapi/blitz_api
|
# git clone https://github.com/fusion44/blitz_api.git /home/blitzapi/blitz_api
|
||||||
if ! git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /home/blitzapi/blitz_api; then
|
if ! sudo -u blitzapi git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git blitz_api; then
|
||||||
echo "error='git clone failed'"
|
echo "error='git clone failed'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd blitz_api || exit 1
|
cd blitz_api || exit 1
|
||||||
if ! git checkout ${DEFAULT_GITHUB_BRANCH}; then
|
if ! sudo -u blitzapi git checkout ${DEFAULT_GITHUB_BRANCH}; then
|
||||||
echo "error='git checkout failed'"
|
echo "error='git checkout failed'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! pip install -r requirements.txt --no-deps; then
|
if ! git reset --hard ${DEFAULT_GITHUB_COMMITORTAG}; then
|
||||||
|
echo "error='git reset failed'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# install
|
||||||
|
sudo -u blitzapi python3 -m venv venv
|
||||||
|
if ! sudo -u blitzapi ./venv/bin/pip install -r requirements.txt --no-deps; then
|
||||||
echo "error='pip install failed'"
|
echo "error='pip install failed'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -216,7 +228,7 @@ After=network.target mnt-hdd.mount
|
|||||||
WorkingDirectory=/home/blitzapi/blitz_api
|
WorkingDirectory=/home/blitzapi/blitz_api
|
||||||
# before every start update the config with latest credentials/settings
|
# before every start update the config with latest credentials/settings
|
||||||
ExecStartPre=-/home/admin/config.scripts/blitz.web.api.sh update-config
|
ExecStartPre=-/home/admin/config.scripts/blitz.web.api.sh update-config
|
||||||
ExecStart=/usr/bin/python -m uvicorn app.main:app --port 11111 --host=0.0.0.0 --root-path /api
|
ExecStart=/home/blitzapi/blitz_api/venv/bin/python -m uvicorn app.main:app --port 11111 --host=0.0.0.0 --root-path /api
|
||||||
User=blitzapi
|
User=blitzapi
|
||||||
Group=blitzapi
|
Group=blitzapi
|
||||||
Type=simple
|
Type=simple
|
||||||
@@ -265,14 +277,14 @@ if [ "$1" = "update-code" ]; then
|
|||||||
echo "# Update Web API CODE"
|
echo "# Update Web API CODE"
|
||||||
systemctl stop blitzapi
|
systemctl stop blitzapi
|
||||||
cd /home/blitzapi/blitz_api
|
cd /home/blitzapi/blitz_api
|
||||||
currentBranch=$(git rev-parse --abbrev-ref HEAD)
|
currentBranch=$(sudo -u blitzapi git rev-parse --abbrev-ref HEAD)
|
||||||
echo "# updating local repo ..."
|
echo "# updating local repo ..."
|
||||||
oldCommit=$(git rev-parse HEAD)
|
oldCommit=$(sudo -u blitzapi git rev-parse HEAD)
|
||||||
git fetch
|
sudo -u blitzapi git fetch
|
||||||
git reset --hard origin/${currentBranch}
|
sudo -u blitzapi git reset --hard origin/${currentBranch}
|
||||||
newCommit=$(git rev-parse HEAD)
|
newCommit=$(sudo -u blitzapi git rev-parse HEAD)
|
||||||
if [ "${oldCommit}" != "${newCommit}" ]; then
|
if [ "${oldCommit}" != "${newCommit}" ]; then
|
||||||
pip install -r requirements.txt
|
sudo -u blitzapi ./venv/bin/pip install -r requirements.txt
|
||||||
else
|
else
|
||||||
echo "# no code changes"
|
echo "# no code changes"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user