Skip to content

Commit 80053c1

Browse files
tremor021MickLesk
andauthored
New Script: Excalidraw (#2285)
* add excalidraw script * made suggested fixes * more fixes * some more fixes * even more fixes * fix debian --------- Co-authored-by: CanbiZ <[email protected]>
1 parent 067c962 commit 80053c1

File tree

3 files changed

+181
-0
lines changed

3 files changed

+181
-0
lines changed

ct/excalidraw.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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/excalidraw/excalidraw
7+
8+
APP="Excalidraw"
9+
TAGS="diagrams"
10+
var_cpu="2"
11+
var_ram="3072"
12+
var_disk="6"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
base_settings
19+
20+
variables
21+
color
22+
catch_errors
23+
24+
function update_script() {
25+
header_info
26+
check_container_storage
27+
check_container_resources
28+
29+
if [[ ! -d /opt/excalidraw ]]; then
30+
msg_error "No ${APP} Installation Found!"
31+
exit
32+
fi
33+
34+
RELEASE=$(curl -s https://api.github.com/repos/excalidraw/excalidraw/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
35+
if [[ "${RELEASE}" != "$(cat /opt/excalidraw_version.txt)" ]] || [[ ! -f /opt/excalidraw_version.txt ]]; then
36+
msg_info "Stopping $APP"
37+
systemctl stop excalidraw
38+
msg_ok "Stopped $APP"
39+
40+
msg_info "Updating $APP to v${RELEASE}"
41+
cd /tmp
42+
temp_file=$(mktemp)
43+
wget -q "https://github.com/excalidraw/excalidraw/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
44+
tar xzf $temp_file
45+
rm -rf /opt/excalidraw
46+
mv excalidraw-${RELEASE} /opt/excalidraw
47+
cd /opt/excalidraw
48+
yarn &> /dev/null
49+
msg_ok "Updated $APP to v${RELEASE}"
50+
51+
msg_info "Starting $APP"
52+
systemctl start excalidraw
53+
msg_ok "Started $APP"
54+
55+
msg_info "Cleaning Up"
56+
rm -rf $temp_file
57+
msg_ok "Cleanup Completed"
58+
59+
echo "${RELEASE}" >/opt/excalidraw_version.txt
60+
msg_ok "Update Successful"
61+
else
62+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
63+
fi
64+
exit
65+
}
66+
67+
start
68+
build_container
69+
description
70+
71+
msg_ok "Completed Successfully!\n"
72+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
73+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
74+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/excalidraw-install.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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/excalidraw/excalidraw
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+
curl \
19+
sudo \
20+
mc \
21+
gnupg \
22+
xdg-utils
23+
msg_ok "Installed Dependencies"
24+
25+
msg_info "Setup Node.js Repository"
26+
mkdir -p /etc/apt/keyrings
27+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
28+
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
29+
msg_ok "Setup Node.js Repository"
30+
31+
msg_info "Setup Node.js"
32+
$STD apt-get update
33+
$STD apt-get install -y nodejs
34+
$STD npm install -g yarn
35+
msg_ok "Setup Node.js"
36+
37+
msg_info "Setup Excalidraw"
38+
temp_file=$(mktemp)
39+
RELEASE=$(curl -s https://api.github.com/repos/excalidraw/excalidraw/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
40+
wget -q "https://github.com/excalidraw/excalidraw/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
41+
tar xzf $temp_file
42+
mv excalidraw-${RELEASE} /opt/excalidraw
43+
cd /opt/excalidraw
44+
$STD yarn
45+
echo "${RELEASE}" >/opt/excalidraw_version.txt
46+
msg_ok "Setup Excalidraw"
47+
48+
msg_info "Creating Service"
49+
cat <<EOF >/etc/systemd/system/excalidraw.service
50+
[Unit]
51+
Description=Excalidraw Service
52+
After=network.target
53+
54+
[Service]
55+
Type=simple
56+
WorkingDirectory=/opt/excalidraw
57+
ExecStart=/usr/bin/yarn start --host
58+
Restart=always
59+
60+
[Install]
61+
WantedBy=multi-user.target
62+
EOF
63+
systemctl enable -q --now excalidraw
64+
msg_ok "Created Service"
65+
66+
motd_ssh
67+
customize
68+
69+
msg_info "Cleaning up"
70+
rm -f $temp_file
71+
$STD apt-get -y autoremove
72+
$STD apt-get -y autoclean
73+
msg_ok "Cleaned"

json/excalidraw.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Excalidraw",
3+
"slug": "excalidraw",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2025-02-12",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://docs.excalidraw.com/docs",
13+
"website": "https://excalidraw.com/",
14+
"logo": "https://docs.excalidraw.com/img/logo.svg",
15+
"description": "An open source virtual hand-drawn style whiteboard. Collaborative and end-to-end encrypted.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/excalidraw.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 3072,
23+
"hdd": 6,
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)