Skip to content

Commit cd40beb

Browse files
authored
New Script: ByteStash (#2680)
* Add ByteStash script * Update bytestash-install.sh
1 parent e1df6b0 commit cd40beb

File tree

3 files changed

+193
-0
lines changed

3 files changed

+193
-0
lines changed

ct/bytestash.sh

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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/jordan-dalby/ByteStash
7+
8+
APP="ByteStash"
9+
var_tags="code"
10+
var_disk="4"
11+
var_cpu="1"
12+
var_ram="1024"
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/bytestash ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
RELEASE=$(curl -s https://api.github.com/repos/jordan-dalby/ByteStash/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 Services"
33+
systemctl stop bytestash-backend
34+
systemctl stop bytestash-frontend
35+
msg_ok "Services Stopped"
36+
37+
msg_info "Updating ${APP} to ${RELEASE}"
38+
temp_file=$(mktemp)
39+
wget -q "https://github.com/jordan-dalby/ByteStash/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
40+
tar zxf $temp_file
41+
rm -rf /opt/bytestash/server/node_modules
42+
rm -rf /opt/bytestash/client/node_modules
43+
cp -rf ByteStash-${RELEASE}/* /opt/bytestash
44+
cd /opt/bytestash/server
45+
$STD npm install
46+
cd /opt/bytestash/client
47+
$STD npm install
48+
echo "${RELEASE}" >/opt/${APP}_version.txt
49+
msg_ok "Updated ${APP}"
50+
51+
msg_info "Starting Services"
52+
systemctl start bytestash-backend
53+
systemctl start bytestash-frontend
54+
msg_ok "Started Services"
55+
56+
msg_info "Cleaning Up"
57+
rm -f $temp_file
58+
msg_ok "Cleaned"
59+
msg_ok "Updated Successfully"
60+
else
61+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
62+
fi
63+
exit
64+
}
65+
66+
start
67+
build_container
68+
description
69+
70+
msg_ok "Completed Successfully!\n"
71+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
72+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
73+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/bytestash-install.sh

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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/jordan-dalby/ByteStash
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+
gnupg
22+
msg_ok "Installed Dependencies"
23+
24+
msg_info "Setting up Node.js Repository"
25+
mkdir -p /etc/apt/keyrings
26+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
27+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
28+
msg_ok "Set up Node.js Repository"
29+
30+
msg_info "Installing Node.js"
31+
$STD apt-get update
32+
$STD apt-get install -y nodejs
33+
msg_ok "Installed Node.js"
34+
35+
msg_info "Installing ByteStash"
36+
temp_file=$(mktemp)
37+
RELEASE=$(curl -s https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
38+
wget -q "https://github.com/jordan-dalby/ByteStash/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
39+
tar zxf $temp_file
40+
mv ByteStash-${RELEASE} /opt/bytestash
41+
cd /opt/bytestash/server
42+
$STD npm install
43+
cd /opt/bytestash/client
44+
$STD npm install
45+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
46+
msg_ok "Installed ByteStash"
47+
48+
msg_info "Creating Service"
49+
cat <<EOF >/etc/systemd/system/bytestash-backend.service
50+
[Unit]
51+
Description=ByteStash Backend Service
52+
After=network.target
53+
54+
[Service]
55+
WorkingDirectory=/opt/bytestash/server
56+
ExecStart=/usr/bin/node src/app.js
57+
Restart=always
58+
59+
[Install]
60+
WantedBy=multi-user.target
61+
EOF
62+
cat <<EOF >/etc/systemd/system/bytestash-frontend.service
63+
[Unit]
64+
Description=ByteStash Frontend Service
65+
After=network.target bytestash-backend.service
66+
67+
[Service]
68+
WorkingDirectory=/opt/bytestash/client
69+
ExecStart=/usr/bin/npx vite --host
70+
Restart=always
71+
72+
[Install]
73+
WantedBy=multi-user.target
74+
EOF
75+
systemctl enable -q --now bytestash-backend
76+
systemctl enable -q --now bytestash-frontend
77+
msg_ok "Created Service"
78+
79+
motd_ssh
80+
customize
81+
82+
msg_info "Cleaning up"
83+
rm -f $temp_file
84+
$STD apt-get -y autoremove
85+
$STD apt-get -y autoclean
86+
msg_ok "Cleaned"

json/bytestash.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "ByteStash",
3+
"slug": "bytestash",
4+
"categories": [
5+
20
6+
],
7+
"date_created": "2024-12-20",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://github.com/jordan-dalby/ByteStash/wiki",
13+
"website": "https://github.com/jordan-dalby/ByteStash",
14+
"logo": "https://raw.githubusercontent.com/jordan-dalby/ByteStash/refs/heads/main/client/public/logo192.png",
15+
"description": "ByteStash is a self-hosted web application designed to store, organise, and manage your code snippets efficiently. With support for creating, editing, and filtering snippets, ByteStash helps you keep track of your code in one secure place.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/bytestash.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 1024,
23+
"hdd": 4,
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)