Skip to content

Commit a97a56b

Browse files
tremor021bvdberg01
andauthored
New Script: VictoriaMetrics (#2565)
* Add VictoriaMetrics script * fix file name * Update json/victoriametrics.json Co-authored-by: bvdberg01 <[email protected]> * Update ct/victoriametrics.sh Co-authored-by: bvdberg01 <[email protected]> * Update victoriametrics.sh --------- Co-authored-by: bvdberg01 <[email protected]>
1 parent de2e785 commit a97a56b

File tree

3 files changed

+163
-0
lines changed

3 files changed

+163
-0
lines changed

ct/victoriametrics.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/VictoriaMetrics/VictoriaMetrics
7+
8+
APP="VictoriaMetrics"
9+
var_tags="database"
10+
var_cpu="2"
11+
var_ram="2048"
12+
var_disk="16"
13+
var_os="debian"
14+
var_version="12"
15+
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/victoriametrics ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
RELEASE=$(curl -s https://api.github.com/repos/VictoriaMetrics/VictoriaMetrics/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
31+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
32+
msg_info "Stopping $APP"
33+
systemctl stop victoriametrics
34+
msg_ok "Stopped $APP"
35+
36+
msg_info "Updating ${APP} to v${RELEASE}"
37+
temp_dir=$(mktemp -d)
38+
cd $temp_dir
39+
wget -q https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v${RELEASE}/victoria-metrics-linux-amd64-v${RELEASE}.tar.gz
40+
wget -q https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v${RELEASE}/vmutils-linux-amd64-v${RELEASE}.tar.gz
41+
find /opt/victoriametrics -maxdepth 1 -type f -executable -delete
42+
tar -xf victoria-metrics-linux-amd64-v${RELEASE}.tar.gz -C /opt/victoriametrics
43+
tar -xf vmutils-linux-amd64-v${RELEASE}.tar.gz -C /opt/victoriametrics
44+
chmod +x /opt/victoriametrics/*
45+
echo "${RELEASE}" >/opt/${APP}_version.txt
46+
msg_ok "Updated $APP to v${RELEASE}"
47+
48+
msg_info "Starting $APP"
49+
systemctl start victoriametrics
50+
msg_ok "Started $APP"
51+
52+
msg_info "Cleaning Up"
53+
rm -rf $temp_dir
54+
msg_ok "Cleaned"
55+
msg_ok "Updated Successfully"
56+
else
57+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
58+
fi
59+
exit
60+
}
61+
62+
start
63+
build_container
64+
description
65+
66+
msg_ok "Completed Successfully!\n"
67+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
68+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
69+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8428/vmui${CL}"

install/victoriametrics-install.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/VictoriaMetrics/VictoriaMetrics
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+
sudo \
19+
curl \
20+
mc
21+
msg_ok "Installed Dependencies"
22+
23+
msg_info "Setup VictoriaMetrics"
24+
temp_dir=$(mktemp -d)
25+
cd $temp_dir
26+
mkdir -p /opt/victoriametrics/data
27+
RELEASE=$(curl -s https://api.github.com/repos/VictoriaMetrics/VictoriaMetrics/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
28+
wget -q https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v${RELEASE}/victoria-metrics-linux-amd64-v${RELEASE}.tar.gz
29+
wget -q https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v${RELEASE}/vmutils-linux-amd64-v${RELEASE}.tar.gz
30+
tar -xf victoria-metrics-linux-amd64-v${RELEASE}.tar.gz -C /opt/victoriametrics
31+
tar -xf vmutils-linux-amd64-v${RELEASE}.tar.gz -C /opt/victoriametrics
32+
chmod +x /opt/victoriametrics/*
33+
msg_ok "Setup VictoriaMetrics"
34+
35+
msg_info "Creating Service"
36+
cat <<EOF >/etc/systemd/system/victoriametrics.service
37+
[Unit]
38+
Description=VictoriaMetrics Service
39+
40+
[Service]
41+
Type=simple
42+
Restart=always
43+
User=root
44+
WorkingDirectory=/opt/victoriametrics
45+
ExecStart=/opt/victoriametrics/victoria-metrics-prod --storageDataPath="/opt/victoriametrics/data"
46+
47+
[Install]
48+
WantedBy=multi-user.target
49+
EOF
50+
systemctl enable -q --now victoriametrics
51+
msg_ok "Created Service"
52+
53+
motd_ssh
54+
customize
55+
56+
msg_info "Cleaning up"
57+
rm -rf $temp_dir
58+
$STD apt-get -y autoremove
59+
$STD apt-get -y autoclean
60+
msg_ok "Cleaned"

json/victoriametrics.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "VictoriaMetrics",
3+
"slug": "victoria",
4+
"categories": [
5+
8
6+
],
7+
"date_created": "2025-02-23",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8428,
12+
"documentation": "https://docs.victoriametrics.com/",
13+
"website": "https://victoriametrics.com/",
14+
"logo": "https://marketplace-assets.digitalocean.com/logos/victoriametrics-victoriametricss.png",
15+
"description": "VictoriaMetrics is a fast, cost-saving, and scalable solution for monitoring and managing time series data. It delivers high performance and reliability, making it an ideal choice for businesses of all sizes.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/victoriametrics.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 2048,
23+
"hdd": 16,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)