Skip to content

Commit 65ada6e

Browse files
Warracker (#7977)
* 'Add new script' * Correct application name casing in warracker.sh --------- 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 853eb40 commit 65ada6e

File tree

4 files changed

+228
-0
lines changed

4 files changed

+228
-0
lines changed

ct/headers/warracker

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__
2+
_ ______ _______________ ______/ /_____ _____
3+
| | /| / / __ `/ ___/ ___/ __ `/ ___/ //_/ _ \/ ___/
4+
| |/ |/ / /_/ / / / / / /_/ / /__/ ,< / __/ /
5+
|__/|__/\__,_/_/ /_/ \__,_/\___/_/|_|\___/_/
6+

ct/warracker.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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: BvdBerg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/sassanix/Warracker/
7+
8+
APP="Warracker"
9+
var_tags="${var_tags:-warranty}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-512}"
12+
var_disk="${var_disk:-4}"
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+
if [[ ! -d /opt/warracker ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
31+
if check_for_gh_release "warracker" "sassanix/Warracker"; then
32+
msg_info "Stopping Services"
33+
systemctl stop warrackermigration
34+
systemctl stop warracker
35+
systemctl stop nginx
36+
msg_ok "Stopped Services"
37+
38+
fetch_and_deploy_gh_release "warracker" "sassanix/Warracker" "tarball" "latest" "/opt/warracker"
39+
40+
msg_info "Updating Warracker"
41+
cd /opt/warracker/backend
42+
$STD uv venv .venv
43+
$STD source .venv/bin/activate
44+
$STD uv pip install -r requirements.txt
45+
msg_ok "Updated Warracker"
46+
47+
msg_info "Starting Services"
48+
systemctl start warracker
49+
systemctl start nginx
50+
msg_ok "Started Services"
51+
msg_ok "Updated Successfully"
52+
fi
53+
exit
54+
}
55+
56+
start
57+
build_container
58+
description
59+
60+
msg_ok "Completed Successfully!\n"
61+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
62+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
63+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Warracker",
3+
"slug": "warracker",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2025-09-19",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": null,
13+
"config_path": "/opt/.env",
14+
"website": "https://warracker.com/",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/warracker.webp",
16+
"description": "Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/warracker.sh",
21+
"resources": {
22+
"cpu": 1,
23+
"ram": 512,
24+
"hdd": 4,
25+
"os": "Debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "The first user you register will be the admin user.",
37+
"type": "info"
38+
}
39+
]
40+
}

install/warracker-install.sh

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/sassanix/Warracker/
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+
build-essential \
19+
libpq-dev \
20+
nginx
21+
msg_ok "Installed Dependencies"
22+
23+
PYTHON_VERSION="3.12" setup_uv
24+
PG_VERSION="17" setup_postgresql
25+
26+
msg_info "Setup PostgreSQL"
27+
DB_NAME="warranty_db"
28+
DB_USER="warranty_user"
29+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
30+
DB_ADMIN_USER="warracker_admin"
31+
DB_ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
32+
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
33+
$STD sudo -u postgres psql -c "CREATE USER $DB_ADMIN_USER WITH PASSWORD '$DB_ADMIN_PASS' SUPERUSER;"
34+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME OWNER $DB_ADMIN_USER;"
35+
$STD sudo -u postgres psql -d "$DB_NAME" -c "GRANT USAGE ON SCHEMA public TO $DB_USER;"
36+
$STD sudo -u postgres psql -d "$DB_NAME" -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
37+
$STD sudo -u postgres psql -d "$DB_NAME" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO $DB_USER;"
38+
{
39+
echo "Application Credentials"
40+
echo "DB_NAME: $DB_NAME"
41+
echo "DB_USER: $DB_USER"
42+
echo "DB_PASS: $DB_PASS"
43+
echo "DB_ADMIN_USER: $DB_ADMIN_USER"
44+
echo "DB_ADMIN_PASS: $DB_ADMIN_PASS"
45+
} >>~/warracker.creds
46+
msg_ok "Setup PostgreSQL"
47+
48+
fetch_and_deploy_gh_release "warracker" "sassanix/Warracker" "tarball" "latest" "/opt/warracker"
49+
50+
msg_info "Installing Warracker"
51+
cd /opt/warracker/backend
52+
$STD uv venv .venv
53+
$STD source .venv/bin/activate
54+
$STD uv pip install -r requirements.txt
55+
mv /opt/warracker/env.example /opt/.env
56+
sed -i \
57+
-e "s/your_secure_database_password/$DB_PASS/" \
58+
-e "s/your_secure_admin_password/$DB_ADMIN_PASS/" \
59+
-e "s|^# DB_PORT=5432$|DB_HOST=127.0.0.1|" \
60+
-e "s|your_very_secure_flask_secret_key_change_this_in_production|$(openssl rand -base64 32 | tr -d '\n')|" \
61+
/opt/.env
62+
mkdir -p /data/uploads
63+
msg_ok "Installed Warracker"
64+
65+
msg_info "Configuring Nginx"
66+
mv /opt/warracker/nginx.conf /etc/nginx/sites-available/warracker.conf
67+
sed -i \
68+
-e "s|alias /var/www/html/locales/;|alias /opt/warracker/locales/;|" \
69+
-e "s|/var/www/html|/opt/warracker/frontend|g" \
70+
-e "s/client_max_body_size __NGINX_MAX_BODY_SIZE_CONFIG_VALUE__/client_max_body_size 32M/" \
71+
/etc/nginx/sites-available/warracker.conf
72+
ln -s /etc/nginx/sites-available/warracker.conf /etc/nginx/sites-enabled/warracker.conf
73+
rm /etc/nginx/sites-enabled/default
74+
systemctl restart nginx
75+
76+
msg_ok "Configured Nginx"
77+
78+
msg_info "Creating systemd services"
79+
cat <<EOF >/etc/systemd/system/warrackermigration.service
80+
[Unit]
81+
Description=Warracker Migration Service
82+
After=network.target
83+
84+
[Service]
85+
Type=oneshot
86+
WorkingDirectory=/opt/warracker/backend/migrations
87+
EnvironmentFile=/opt/.env
88+
ExecStart=/opt/warracker/backend/.venv/bin/python apply_migrations.py
89+
90+
[Install]
91+
WantedBy=multi-user.target
92+
EOF
93+
94+
cat <<EOF >/etc/systemd/system/warracker.service
95+
[Unit]
96+
Description=Warracker Service
97+
After=network.target warrackermigration.service
98+
Requires=warrackermigration.service
99+
100+
[Service]
101+
WorkingDirectory=/opt/warracker
102+
EnvironmentFile=/opt/.env
103+
ExecStart=/opt/warracker/backend/.venv/bin/gunicorn --config /opt/warracker/backend/gunicorn_config.py backend:create_app() --bind 127.0.0.1:5000
104+
Restart=always
105+
106+
[Install]
107+
WantedBy=multi-user.target
108+
EOF
109+
systemctl enable -q --now warracker
110+
msg_ok "Started Warracker Services"
111+
112+
motd_ssh
113+
customize
114+
115+
msg_info "Cleaning up"
116+
$STD apt -y autoremove
117+
$STD apt -y autoclean
118+
$STD apt -y clean
119+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)