mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-23 14:40:45 +01: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:
parent
4ce743a939
commit
6ef861ba0b
2 changed files with 28 additions and 15 deletions
|
@ -2,8 +2,8 @@
|
|||
|
||||
#########################################################################
|
||||
# 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/
|
||||
# SHA256: 5adcab7a063310734856adcdd2041c8d58f65c185a3383132bc758886528a93d
|
||||
# https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/
|
||||
# SHA256: c42856ffca096480180b5aff66e1dad2f727fdc33359b24e0d2d49cc7676b576
|
||||
# PGP fingerprint: 8738CD6B956F460C
|
||||
# PGP key: https://www.raspberrypi.org/raspberrypi_downloads.gpg.key
|
||||
# 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
|
||||
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"
|
||||
[ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config
|
||||
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
|
||||
# 3. Nyx
|
||||
# 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"
|
||||
sudo -H python3 -m pip install --upgrade pip
|
||||
sudo -H python3 -m pip install ${python_libs} ${torbox_libs}
|
||||
|
|
34
home.admin/config.scripts/blitz.web.api.sh
Executable file → Normal file
34
home.admin/config.scripts/blitz.web.api.sh
Executable file → Normal file
|
@ -18,6 +18,7 @@ fi
|
|||
DEFAULT_GITHUB_USER="fusion44"
|
||||
DEFAULT_GITHUB_REPO="blitz_api"
|
||||
DEFAULT_GITHUB_BRANCH="main"
|
||||
DEFAULT_GITHUB_COMMITORTAG="v0.5.0-beta"
|
||||
|
||||
###################
|
||||
# UPDATE CONFIG
|
||||
|
@ -155,6 +156,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
DEFAULT_GITHUB_BRANCH="$4"
|
||||
fi
|
||||
|
||||
if [ "$5" != "" ]; then
|
||||
DEFAULT_GITHUB_COMMITORTAG="$5"
|
||||
fi
|
||||
|
||||
echo "# INSTALL Web API ..."
|
||||
# clean old source
|
||||
rm -r /root/blitz_api 2>/dev/null
|
||||
|
@ -185,21 +190,28 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
sudo -u blitzapi ln -s /mnt/hdd/app-data/.lightning /home/blitzapi/
|
||||
|
||||
cd /home/blitzapi || exit 1
|
||||
|
||||
# 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'"
|
||||
exit 1
|
||||
fi
|
||||
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'"
|
||||
exit 1
|
||||
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'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# build the config and set unique secret (its OK to be a new secret every install/upadte)
|
||||
/home/admin/config.scripts/blitz.web.api.sh update-config
|
||||
secret=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 64 ; echo '')
|
||||
|
@ -216,7 +228,7 @@ After=network.target mnt-hdd.mount
|
|||
WorkingDirectory=/home/blitzapi/blitz_api
|
||||
# before every start update the config with latest credentials/settings
|
||||
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
|
||||
Group=blitzapi
|
||||
Type=simple
|
||||
|
@ -265,14 +277,14 @@ if [ "$1" = "update-code" ]; then
|
|||
echo "# Update Web API CODE"
|
||||
systemctl stop blitzapi
|
||||
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 ..."
|
||||
oldCommit=$(git rev-parse HEAD)
|
||||
git fetch
|
||||
git reset --hard origin/${currentBranch}
|
||||
newCommit=$(git rev-parse HEAD)
|
||||
oldCommit=$(sudo -u blitzapi git rev-parse HEAD)
|
||||
sudo -u blitzapi git fetch
|
||||
sudo -u blitzapi git reset --hard origin/${currentBranch}
|
||||
newCommit=$(sudo -u blitzapi git rev-parse HEAD)
|
||||
if [ "${oldCommit}" != "${newCommit}" ]; then
|
||||
pip install -r requirements.txt
|
||||
sudo -u blitzapi ./venv/bin/pip install -r requirements.txt
|
||||
else
|
||||
echo "# no code changes"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue