Skip to content

Commit 796c31e

Browse files
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 <[email protected]>
1 parent 047c2c4 commit 796c31e

File tree

4 files changed

+240
-0
lines changed

4 files changed

+240
-0
lines changed

ct/babybuddy.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/babybuddy/babybuddy
7+
8+
APP="Baby Buddy"
9+
var_tags="${var_tags:-baby}"
10+
var_disk="${var_disk:-5}"
11+
var_cpu="${var_cpu:-2}"
12+
var_ram="${var_ram:-2048}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /opt/babybuddy ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
31+
RELEASE=$(curl -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
32+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/babybuddy_version.txt)" ]]; then
33+
setup_uv
34+
35+
msg_info "Stopping Services"
36+
systemctl stop nginx
37+
systemctl stop uwsgi
38+
msg_ok "Services Stopped"
39+
40+
msg_info "Cleaning old files"
41+
cp babybuddy/settings/production.py /tmp/production.py.bak
42+
find . -mindepth 1 -maxdepth 1 ! -name '.venv' -exec rm -rf {} +
43+
msg_ok "Cleaned old files"
44+
45+
msg_info "Updating ${APP} to v${RELEASE}"
46+
temp_file=$(mktemp)
47+
curl -fsSL "https://github.com/babybuddy/babybuddy/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
48+
cd /opt/babybuddy
49+
tar zxf "$temp_file" --strip-components=1 -C /opt/babybuddy
50+
mv /tmp/production.py.bak babybuddy/settings/production.py
51+
cd /opt/babybuddy
52+
source .venv/bin/activate
53+
$STD uv pip install -r requirements.txt
54+
$STD python manage.py migrate
55+
echo "${RELEASE}" >/opt/${APP}_version.txt
56+
msg_ok "Updated ${APP} to v${RELEASE}"
57+
58+
msg_info "Fixing permissions"
59+
chown -R www-data:www-data /opt/data
60+
chmod 640 /opt/data/db.sqlite3
61+
chmod 750 /opt/data
62+
msg_ok "Permissions fixed"
63+
64+
msg_info "Starting Services"
65+
systemctl start uwsgi
66+
systemctl start nginx
67+
msg_ok "Services Started"
68+
69+
msg_info "Cleaning up"
70+
rm -f "$temp_file"
71+
msg_ok "Cleaned"
72+
msg_ok "Updated Successfully"
73+
else
74+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
75+
fi
76+
exit
77+
}
78+
79+
start
80+
build_container
81+
description
82+
83+
msg_ok "Completed Successfully!\n"
84+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
85+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
86+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

ct/headers/babybuddy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
____ __ ____ __ __
2+
/ __ )____ _/ /_ __ __ / __ )__ ______/ /___/ /_ __
3+
/ __ / __ `/ __ \/ / / / / __ / / / / __ / __ / / / /
4+
/ /_/ / /_/ / /_/ / /_/ / / /_/ / /_/ / /_/ / /_/ / /_/ /
5+
/_____/\__,_/_.___/\__, / /_____/\__,_/\__,_/\__,_/\__, /
6+
/____/ /____/
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Baby Buddy",
3+
"slug": "babybuddy",
4+
"categories": [
5+
23
6+
],
7+
"date_created": "2025-05-16",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://docs.baby-buddy.net/",
13+
"website": "https://github.com/babybuddy/babybuddy",
14+
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/baby-buddy.svg",
15+
"config_path": "/opt/babybuddy/babybuddy/production.py",
16+
"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.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/babybuddy.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 2048,
24+
"hdd": 5,
25+
"os": "debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": "admin",
32+
"password": "admin"
33+
},
34+
"notes": [
35+
{
36+
"text": "for private SSL setup visit: `https://github.com/babybuddy/babybuddy/blob/master/docs/setup/ssl.md`",
37+
"type": "info"
38+
}
39+
]
40+
}

install/babybuddy-install.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/babybuddy/babybuddy
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
uwsgi \
19+
uwsgi-plugin-python3 \
20+
libopenjp2-7-dev \
21+
libpq-dev \
22+
nginx \
23+
python3
24+
msg_ok "Installed Dependencies"
25+
26+
setup_uv
27+
28+
msg_info "Installing Babybuddy"
29+
RELEASE=$(curl -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
30+
temp_file=$(mktemp)
31+
mkdir -p /opt/{babybuddy,data}
32+
curl -fsSL "https://github.com/babybuddy/babybuddy/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
33+
tar zxf "$temp_file" --strip-components=1 -C /opt/babybuddy
34+
cd /opt/babybuddy
35+
$STD uv venv .venv
36+
$STD source .venv/bin/activate
37+
$STD uv pip install -r requirements.txt
38+
cp babybuddy/settings/production.example.py babybuddy/settings/production.py
39+
SECRET_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)
40+
ALLOWED_HOSTS=$(hostname -I | tr ' ' ',' | sed 's/,$//')",127.0.0.1,localhost"
41+
sed -i \
42+
-e "s/^SECRET_KEY = \"\"/SECRET_KEY = \"$SECRET_KEY\"/" \
43+
-e "s/^ALLOWED_HOSTS = \[\"\"\]/ALLOWED_HOSTS = \[$(echo \"$ALLOWED_HOSTS\" | sed 's/,/\",\"/g')\]/" \
44+
babybuddy/settings/production.py
45+
46+
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
47+
$STD python manage.py migrate
48+
chown -R www-data:www-data /opt/data
49+
chmod 640 /opt/data/db.sqlite3
50+
chmod 750 /opt/data
51+
msg_ok "Installed Babybuddy"
52+
53+
msg_info "Configuring uWSGI"
54+
cat <<EOF >/etc/uwsgi/apps-available/babybuddy.ini
55+
[uwsgi]
56+
plugins = python3
57+
project = babybuddy
58+
base_dir = /opt/babybuddy
59+
chdir = %(base_dir)
60+
virtualenv = %(base_dir)/.venv
61+
module = %(project).wsgi:application
62+
env = DJANGO_SETTINGS_MODULE=%(project).settings.production
63+
master = True
64+
vacuum = True
65+
socket = /var/run/uwsgi/app/babybuddy/socket
66+
chmod-socket = 660
67+
uid = www-data
68+
gid = www-data
69+
EOF
70+
ln -sf /etc/uwsgi/apps-available/babybuddy.ini /etc/uwsgi/apps-enabled/babybuddy.ini
71+
service uwsgi restart
72+
msg_ok "Configured uWSGI"
73+
74+
msg_info "Configuring NGINX"
75+
cat <<EOF >/etc/nginx/sites-available/babybuddy
76+
upstream babybuddy {
77+
server unix:///var/run/uwsgi/app/babybuddy/socket;
78+
}
79+
80+
server {
81+
listen 80;
82+
server_name _;
83+
84+
location / {
85+
uwsgi_pass babybuddy;
86+
include uwsgi_params;
87+
}
88+
89+
location /media {
90+
alias /opt/data/media;
91+
}
92+
}
93+
EOF
94+
95+
ln -sf /etc/nginx/sites-available/babybuddy /etc/nginx/sites-enabled/babybuddy
96+
rm /etc/nginx/sites-enabled/default
97+
systemctl enable -q --now nginx
98+
service nginx reload
99+
msg_ok "Configured NGINX"
100+
101+
motd_ssh
102+
customize
103+
104+
msg_info "Cleaning up"
105+
rm -f "$temp_file"
106+
$STD apt-get -y autoremove
107+
$STD apt-get -y autoclean
108+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)