Update babybuddy-install.sh

This commit is contained in:
CanbiZ 2025-05-16 08:14:07 +02:00
parent ae69dfd36e
commit e389f015f6

View File

@ -22,10 +22,12 @@ $STD apt-get install -y \
libpq-dev \ libpq-dev \
nginx \ nginx \
python3 \ python3 \
python3-venv \ python3-pip \
python3-pip pipx
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
setup_uv
msg_info "Installing Babybuddy" msg_info "Installing Babybuddy"
cd /opt cd /opt
RELEASE=$(curl -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
@ -34,18 +36,17 @@ unzip -q v${RELEASE}.zip
mv babybuddy-${RELEASE} /opt/babybuddy mv babybuddy-${RELEASE} /opt/babybuddy
rm "v${RELEASE}.zip" rm "v${RELEASE}.zip"
cd /opt/babybuddy cd /opt/babybuddy
$STD pip install -U pip wheel pipenv mkdir -p /opt/data
export PIPENV_VENV_IN_PROJECT=1 uv venv .venv
export PIPENV_IGNORE_VIRTUALENVS=1 source .venv/bin/activate
export PIPENV_VERBOSITY=-1 uv pip install -r requirements.txt
$STD pipenv install
#$STD pipenv shell
cp babybuddy/settings/production.example.py babybuddy/settings/production.py cp babybuddy/settings/production.example.py babybuddy/settings/production.py
touch /opt/babybuddy/data/db.sqlite3 touch /opt/data/db.sqlite3
chown -R www-data:www-data /opt/babybuddy/data chown -R www-data:www-data /opt/data
chmod 640 /opt/babybuddy/data/db.sqlite3 chmod 640 /opt/data/db.sqlite3
chmod 750 /opt/babybuddy/data chmod 750 /opt/data
cp babybuddy/settings/production.example.py babybuddy/settings/production.py
SECRET_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32) SECRET_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)
ALLOWED_HOSTS=$(hostname -I | tr ' ' ',' | sed 's/,$//')",127.0.0.1,localhost" ALLOWED_HOSTS=$(hostname -I | tr ' ' ',' | sed 's/,$//')",127.0.0.1,localhost"
sed -i \ sed -i \
@ -56,12 +57,6 @@ sed -i \
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
python manage.py migrate python manage.py migrate
# Berechtigungen setzen
chown -R www-data:www-data /opt/babybuddy/data
chmod 640 /opt/babybuddy/data/db.sqlite3
chmod 750 /opt/babybuddy/data
msg_ok "Installed BabyBuddy WebApp"
# Django Admin Setup # Django Admin Setup
DJANGO_ADMIN_USER=admin DJANGO_ADMIN_USER=admin
DJANGO_ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) DJANGO_ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)