babybuddy (#4619)
* 'Add new script' * Update babybuddy.sh * add license --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
parent
047c2c44d6
commit
796c31eae4
86
ct/babybuddy.sh
Normal file
86
ct/babybuddy.sh
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/babybuddy/babybuddy
|
||||||
|
|
||||||
|
APP="Baby Buddy"
|
||||||
|
var_tags="${var_tags:-baby}"
|
||||||
|
var_disk="${var_disk:-5}"
|
||||||
|
var_cpu="${var_cpu:-2}"
|
||||||
|
var_ram="${var_ram:-2048}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-12}"
|
||||||
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
if [[ ! -d /opt/babybuddy ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/babybuddy_version.txt)" ]]; then
|
||||||
|
setup_uv
|
||||||
|
|
||||||
|
msg_info "Stopping Services"
|
||||||
|
systemctl stop nginx
|
||||||
|
systemctl stop uwsgi
|
||||||
|
msg_ok "Services Stopped"
|
||||||
|
|
||||||
|
msg_info "Cleaning old files"
|
||||||
|
cp babybuddy/settings/production.py /tmp/production.py.bak
|
||||||
|
find . -mindepth 1 -maxdepth 1 ! -name '.venv' -exec rm -rf {} +
|
||||||
|
msg_ok "Cleaned old files"
|
||||||
|
|
||||||
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
curl -fsSL "https://github.com/babybuddy/babybuddy/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||||
|
cd /opt/babybuddy
|
||||||
|
tar zxf "$temp_file" --strip-components=1 -C /opt/babybuddy
|
||||||
|
mv /tmp/production.py.bak babybuddy/settings/production.py
|
||||||
|
cd /opt/babybuddy
|
||||||
|
source .venv/bin/activate
|
||||||
|
$STD uv pip install -r requirements.txt
|
||||||
|
$STD python manage.py migrate
|
||||||
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
|
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Fixing permissions"
|
||||||
|
chown -R www-data:www-data /opt/data
|
||||||
|
chmod 640 /opt/data/db.sqlite3
|
||||||
|
chmod 750 /opt/data
|
||||||
|
msg_ok "Permissions fixed"
|
||||||
|
|
||||||
|
msg_info "Starting Services"
|
||||||
|
systemctl start uwsgi
|
||||||
|
systemctl start nginx
|
||||||
|
msg_ok "Services Started"
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -f "$temp_file"
|
||||||
|
msg_ok "Cleaned"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
build_container
|
||||||
|
description
|
||||||
|
|
||||||
|
msg_ok "Completed Successfully!\n"
|
||||||
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
6
ct/headers/babybuddy
Normal file
6
ct/headers/babybuddy
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
____ __ ____ __ __
|
||||||
|
/ __ )____ _/ /_ __ __ / __ )__ ______/ /___/ /_ __
|
||||||
|
/ __ / __ `/ __ \/ / / / / __ / / / / __ / __ / / / /
|
||||||
|
/ /_/ / /_/ / /_/ / /_/ / / /_/ / /_/ / /_/ / /_/ / /_/ /
|
||||||
|
/_____/\__,_/_.___/\__, / /_____/\__,_/\__,_/\__,_/\__, /
|
||||||
|
/____/ /____/
|
40
frontend/public/json/babybuddy.json
Normal file
40
frontend/public/json/babybuddy.json
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"name": "Baby Buddy",
|
||||||
|
"slug": "babybuddy",
|
||||||
|
"categories": [
|
||||||
|
23
|
||||||
|
],
|
||||||
|
"date_created": "2025-05-16",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 80,
|
||||||
|
"documentation": "https://docs.baby-buddy.net/",
|
||||||
|
"website": "https://github.com/babybuddy/babybuddy",
|
||||||
|
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/baby-buddy.svg",
|
||||||
|
"config_path": "/opt/babybuddy/babybuddy/production.py",
|
||||||
|
"description": "Baby Buddy is an open-source web application designed to assist caregivers in tracking various aspects of a baby's daily routine, including sleep, feedings, diaper changes, tummy time, and more. By recording this data, caregivers can better understand and anticipate their baby's needs, reducing guesswork in daily care. The application offers a user-friendly dashboard for data entry and visualization, supports multiple users, and provides features like timers and reminders. Additionally, Baby Buddy can be integrated with platforms like Home Assistant and Grafana for enhanced functionality.",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/babybuddy.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 2,
|
||||||
|
"ram": 2048,
|
||||||
|
"hdd": 5,
|
||||||
|
"os": "debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": "admin",
|
||||||
|
"password": "admin"
|
||||||
|
},
|
||||||
|
"notes": [
|
||||||
|
{
|
||||||
|
"text": "for private SSL setup visit: `https://github.com/babybuddy/babybuddy/blob/master/docs/setup/ssl.md`",
|
||||||
|
"type": "info"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
108
install/babybuddy-install.sh
Normal file
108
install/babybuddy-install.sh
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/babybuddy/babybuddy
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
uwsgi \
|
||||||
|
uwsgi-plugin-python3 \
|
||||||
|
libopenjp2-7-dev \
|
||||||
|
libpq-dev \
|
||||||
|
nginx \
|
||||||
|
python3
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
setup_uv
|
||||||
|
|
||||||
|
msg_info "Installing Babybuddy"
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
mkdir -p /opt/{babybuddy,data}
|
||||||
|
curl -fsSL "https://github.com/babybuddy/babybuddy/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||||
|
tar zxf "$temp_file" --strip-components=1 -C /opt/babybuddy
|
||||||
|
cd /opt/babybuddy
|
||||||
|
$STD uv venv .venv
|
||||||
|
$STD source .venv/bin/activate
|
||||||
|
$STD uv pip install -r requirements.txt
|
||||||
|
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)
|
||||||
|
ALLOWED_HOSTS=$(hostname -I | tr ' ' ',' | sed 's/,$//')",127.0.0.1,localhost"
|
||||||
|
sed -i \
|
||||||
|
-e "s/^SECRET_KEY = \"\"/SECRET_KEY = \"$SECRET_KEY\"/" \
|
||||||
|
-e "s/^ALLOWED_HOSTS = \[\"\"\]/ALLOWED_HOSTS = \[$(echo \"$ALLOWED_HOSTS\" | sed 's/,/\",\"/g')\]/" \
|
||||||
|
babybuddy/settings/production.py
|
||||||
|
|
||||||
|
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
|
||||||
|
$STD python manage.py migrate
|
||||||
|
chown -R www-data:www-data /opt/data
|
||||||
|
chmod 640 /opt/data/db.sqlite3
|
||||||
|
chmod 750 /opt/data
|
||||||
|
msg_ok "Installed Babybuddy"
|
||||||
|
|
||||||
|
msg_info "Configuring uWSGI"
|
||||||
|
cat <<EOF >/etc/uwsgi/apps-available/babybuddy.ini
|
||||||
|
[uwsgi]
|
||||||
|
plugins = python3
|
||||||
|
project = babybuddy
|
||||||
|
base_dir = /opt/babybuddy
|
||||||
|
chdir = %(base_dir)
|
||||||
|
virtualenv = %(base_dir)/.venv
|
||||||
|
module = %(project).wsgi:application
|
||||||
|
env = DJANGO_SETTINGS_MODULE=%(project).settings.production
|
||||||
|
master = True
|
||||||
|
vacuum = True
|
||||||
|
socket = /var/run/uwsgi/app/babybuddy/socket
|
||||||
|
chmod-socket = 660
|
||||||
|
uid = www-data
|
||||||
|
gid = www-data
|
||||||
|
EOF
|
||||||
|
ln -sf /etc/uwsgi/apps-available/babybuddy.ini /etc/uwsgi/apps-enabled/babybuddy.ini
|
||||||
|
service uwsgi restart
|
||||||
|
msg_ok "Configured uWSGI"
|
||||||
|
|
||||||
|
msg_info "Configuring NGINX"
|
||||||
|
cat <<EOF >/etc/nginx/sites-available/babybuddy
|
||||||
|
upstream babybuddy {
|
||||||
|
server unix:///var/run/uwsgi/app/babybuddy/socket;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
uwsgi_pass babybuddy;
|
||||||
|
include uwsgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /media {
|
||||||
|
alias /opt/data/media;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
ln -sf /etc/nginx/sites-available/babybuddy /etc/nginx/sites-enabled/babybuddy
|
||||||
|
rm /etc/nginx/sites-enabled/default
|
||||||
|
systemctl enable -q --now nginx
|
||||||
|
service nginx reload
|
||||||
|
msg_ok "Configured NGINX"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -f "$temp_file"
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
Loading…
Reference in New Issue
Block a user