Skip to content

Commit 5d84c93

Browse files
Add homelable (ct) (#13539)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
1 parent f489db2 commit 5d84c93

2 files changed

Lines changed: 181 additions & 0 deletions

File tree

ct/homelable.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/Pouzor/homelable
7+
8+
APP="Homelable"
9+
var_tags="${var_tags:-monitoring;network;visualization}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-8}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
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+
27+
if [[ ! -d /opt/homelable ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
if check_for_gh_release "homelable" "Pouzor/homelable"; then
33+
msg_info "Stopping Service"
34+
systemctl stop homelable
35+
msg_ok "Stopped Service"
36+
37+
msg_info "Backing up Configuration and Data"
38+
cp /opt/homelable/backend/.env /opt/homelable.env.bak
39+
cp -r /opt/homelable/data /opt/homelable_data_bak
40+
msg_ok "Backed up Configuration and Data"
41+
42+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "homelable" "Pouzor/homelable" "tarball" "latest" "/opt/homelable"
43+
44+
msg_info "Updating Python Dependencies"
45+
cd /opt/homelable/backend
46+
$STD uv venv /opt/homelable/backend/.venv
47+
$STD uv pip install --python /opt/homelable/backend/.venv/bin/python -r requirements.txt
48+
msg_ok "Updated Python Dependencies"
49+
50+
msg_info "Rebuilding Frontend"
51+
cd /opt/homelable/frontend
52+
$STD npm ci
53+
$STD npm run build
54+
msg_ok "Rebuilt Frontend"
55+
56+
msg_info "Restoring Configuration and Data"
57+
cp /opt/homelable.env.bak /opt/homelable/backend/.env
58+
cp -r /opt/homelable_data_bak/. /opt/homelable/data/
59+
rm -f /opt/homelable.env.bak
60+
rm -rf /opt/homelable_data_bak
61+
msg_ok "Restored Configuration and Data"
62+
63+
msg_info "Starting Service"
64+
systemctl start homelable
65+
msg_ok "Started Service"
66+
msg_ok "Updated successfully!"
67+
fi
68+
exit
69+
}
70+
71+
start
72+
build_container
73+
description
74+
75+
msg_ok "Completed Successfully!\n"
76+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
77+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
78+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/homelable-install.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/Pouzor/homelable
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 install -y \
18+
nmap \
19+
iputils-ping \
20+
caddy
21+
msg_ok "Installed Dependencies"
22+
23+
UV_PYTHON="3.13" setup_uv
24+
NODE_VERSION="20" setup_nodejs
25+
fetch_and_deploy_gh_release "homelable" "Pouzor/homelable" "tarball" "latest" "/opt/homelable"
26+
27+
msg_info "Setting up Python Backend"
28+
cd /opt/homelable/backend
29+
$STD uv venv /opt/homelable/backend/.venv
30+
$STD uv pip install --python /opt/homelable/backend/.venv/bin/python -r requirements.txt
31+
msg_ok "Set up Python Backend"
32+
33+
msg_info "Configuring Homelable"
34+
mkdir -p /opt/homelable/data
35+
SECRET_KEY=$(openssl rand -hex 32)
36+
BCRYPT_HASH=$(/opt/homelable/backend/.venv/bin/python -c "from passlib.context import CryptContext; print(CryptContext(schemes=['bcrypt']).hash('admin'))")
37+
cat <<EOF >/opt/homelable/backend/.env
38+
SECRET_KEY=${SECRET_KEY}
39+
SQLITE_PATH=/opt/homelable/data/homelab.db
40+
CORS_ORIGINS=["http://localhost:3000","http://${LOCAL_IP}:3000"]
41+
AUTH_USERNAME=admin
42+
AUTH_PASSWORD_HASH='${BCRYPT_HASH}'
43+
SCANNER_RANGES=["192.168.1.0/24"]
44+
STATUS_CHECKER_INTERVAL=60
45+
EOF
46+
msg_ok "Configured Homelable"
47+
48+
msg_info "Building Frontend"
49+
cd /opt/homelable/frontend
50+
$STD npm ci
51+
$STD npm run build
52+
msg_ok "Built Frontend"
53+
54+
msg_info "Creating Service"
55+
cat <<EOF >/etc/systemd/system/homelable.service
56+
[Unit]
57+
Description=Homelable Backend
58+
After=network.target
59+
60+
[Service]
61+
Type=simple
62+
WorkingDirectory=/opt/homelable/backend
63+
EnvironmentFile=/opt/homelable/backend/.env
64+
ExecStart=/opt/homelable/backend/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000
65+
Restart=on-failure
66+
RestartSec=5
67+
68+
[Install]
69+
WantedBy=multi-user.target
70+
EOF
71+
systemctl enable -q --now homelable
72+
msg_ok "Created Service"
73+
74+
msg_info "Configuring Caddy"
75+
cat <<EOF >/etc/caddy/Caddyfile
76+
:3000 {
77+
root * /opt/homelable/frontend/dist
78+
file_server
79+
80+
@websocket path /api/v1/status/ws/*
81+
handle @websocket {
82+
reverse_proxy 127.0.0.1:8000
83+
}
84+
85+
handle /ws/* {
86+
reverse_proxy 127.0.0.1:8000
87+
}
88+
89+
handle /api/* {
90+
reverse_proxy 127.0.0.1:8000
91+
}
92+
93+
handle {
94+
try_files {path} {path}.html /index.html
95+
}
96+
}
97+
EOF
98+
systemctl reload caddy
99+
msg_ok "Configured Caddy"
100+
101+
motd_ssh
102+
customize
103+
cleanup_lxc

0 commit comments

Comments
 (0)