Skip to content

Commit cb6e2c4

Browse files
authored
New Script: Crafty-Controller (#1926)
* add: crafty-controller-script * fix url * fix: requested changes * fix: requested changes * fix: requested changes 2 * fix: remove additional sleep * fix: remove additional sleep * fix: service, remove jre
1 parent 8662be2 commit cb6e2c4

File tree

3 files changed

+226
-0
lines changed

3 files changed

+226
-0
lines changed

ct/crafty-controller.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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
4+
# Author: CrazyWolf13
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
7+
8+
# App Default Values
9+
APP="Crafty-Controller"
10+
var_tags="gaming"
11+
var_cpu="2"
12+
var_ram="4096"
13+
var_disk="16"
14+
var_os="debian"
15+
var_version="12"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -d /opt/crafty-controller ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
36+
RELEASE=$(curl -s "https://gitlab.com/api/v4/projects/20430749/releases" | grep -o '"tag_name":"v[^"]*"' | head -n 1 | sed 's/"tag_name":"v//;s/"//')
37+
if [[ ! -f /opt/crafty-controller_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/crafty-controller_version.txt)" ]]; then
38+
39+
msg_info "Stopping Crafty-Controller"
40+
systemctl stop crafty-controller
41+
msg_ok "Stopped Crafty-Controller"
42+
43+
msg_info "Creating Backup of config"
44+
cp -a /opt/crafty-controller/crafty/crafty-4/app/config/. /opt/crafty-controller/backup
45+
rm /opt/crafty-controller/backup/version.json
46+
rm /opt/crafty-controller/backup/credits.json
47+
rm /opt/crafty-controller/backup/logging.json
48+
rm /opt/crafty-controller/backup/default.json.example
49+
rm /opt/crafty-controller/backup/motd_format.json
50+
msg_ok "Backup Created"
51+
52+
msg_info "Updating Crafty-Controller to v${RELEASE}"
53+
wget -q "https://gitlab.com/crafty-controller/crafty-4/-/archive/v${RELEASE}/crafty-4-v${RELEASE}.zip"
54+
unzip -q crafty-4-v${RELEASE}.zip
55+
cp -a crafty-4-v${RELEASE}/. /opt/crafty-controller/crafty/crafty-4/
56+
rm -rf crafty-4-v${RELEASE}
57+
cd /opt/crafty-controller/crafty/crafty-4
58+
sudo -u crafty bash -c '
59+
source /opt/crafty-controller/crafty/.venv/bin/activate
60+
pip3 install --no-cache-dir -r requirements.txt
61+
' &>/dev/null
62+
echo "${RELEASE}" >"/opt/crafty-controller_version.txt"
63+
msg_ok "Updated Crafty-Controller to v${RELEASE}"
64+
65+
msg_info "Restoring Backup of config"
66+
cp -a /opt/crafty-controller/backup/. /opt/crafty-controller/crafty/crafty-4/app/config
67+
rm -rf /opt/crafty-controller/backup
68+
chown -R crafty:crafty /opt/crafty-controller/
69+
msg_ok "Backup Restored"
70+
71+
msg_info "Starting Crafty-Controller"
72+
systemctl start crafty-controller
73+
msg_ok "Started Crafty-Controller"
74+
75+
msg_ok "Updated Successfully"
76+
exit
77+
else
78+
msg_ok "No update required. Crafty-Controller is already at v${RELEASE}."
79+
fi
80+
}
81+
82+
83+
start
84+
build_container
85+
description
86+
87+
msg_ok "Completed Successfully!\n"
88+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
89+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
90+
echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:8443${CL}"
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts
4+
# Author: CrazyWolf13
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://docs.craftycontrol.com/pages/getting-started/installation/linux/
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 (a lot of patience)"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc \
21+
git \
22+
sed \
23+
lsb-release \
24+
apt-transport-https \
25+
coreutils \
26+
software-properties-common \
27+
openjdk-17-jdk
28+
wget -q https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
29+
$STD sudo dpkg -i jdk-21_linux-x64_bin.deb
30+
rm -f jdk-21_linux-x64_bin.deb
31+
msg_ok "Installed Dependencies"
32+
33+
msg_info "Setup Python3"
34+
$STD apt-get install -y \
35+
python3 \
36+
python3-dev \
37+
python3-pip \
38+
python3-venv
39+
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
40+
msg_ok "Setup Python3"
41+
42+
43+
msg_info "Installing Craty-Controller (Patience)"
44+
useradd crafty -m -s /bin/bash
45+
cd /opt
46+
mkdir -p /opt/crafty-controller/crafty /opt/crafty-controller/server
47+
RELEASE=$(curl -s "https://gitlab.com/api/v4/projects/20430749/releases" | grep -o '"tag_name":"v[^"]*"' | head -n 1 | sed 's/"tag_name":"v//;s/"//')
48+
echo "${RELEASE}" >"/opt/crafty-controller_version.txt"
49+
wget -q "https://gitlab.com/crafty-controller/crafty-4/-/archive/v${RELEASE}/crafty-4-v${RELEASE}.zip"
50+
unzip -q crafty-4-v${RELEASE}.zip
51+
cp -a crafty-4-v${RELEASE}/. /opt/crafty-controller/crafty/crafty-4/
52+
rm -rf crafty-4-v${RELEASE}
53+
54+
cd /opt/crafty-controller/crafty
55+
python3 -m venv .venv
56+
chown -R crafty:crafty /opt/crafty-controller/
57+
$STD sudo -u crafty bash -c '
58+
source /opt/crafty-controller/crafty/.venv/bin/activate
59+
cd /opt/crafty-controller/crafty/crafty-4
60+
pip3 install --no-cache-dir -r requirements.txt
61+
'
62+
msg_ok "Installed Craft-Controller and dependencies"
63+
64+
msg_info "Setting up Crafty-Controller service"
65+
cat > /etc/systemd/system/crafty-controller.service << 'EOF'
66+
[Unit]
67+
Description=Crafty 4
68+
After=network.target
69+
70+
[Service]
71+
Type=simple
72+
User=crafty
73+
WorkingDirectory=/opt/crafty-controller/crafty/crafty-4
74+
Environment=PATH=/opt/crafty-controller/crafty/.venv/bin:$PATH
75+
ExecStart=/opt/crafty-controller/crafty/.venv/bin/python3 main.py -d
76+
Restart=on-failure
77+
78+
[Install]
79+
WantedBy=multi-user.target
80+
EOF
81+
$STD systemctl enable -q --now crafty-controller
82+
sleep 10
83+
{
84+
echo "Crafty-Controller-Credentials"
85+
echo "Username: $(grep -oP '(?<="username": ")[^"]*' /opt/crafty-controller/crafty/crafty-4/app/config/default-creds.txt)"
86+
echo "Password: $(grep -oP '(?<="password": ")[^"]*' /opt/crafty-controller/crafty/crafty-4/app/config/default-creds.txt)"
87+
} >> ~/crafty-controller.creds
88+
msg_ok "Crafty-Controller service started"
89+
90+
motd_ssh
91+
customize
92+
93+
msg_info "Cleaning up"
94+
rm -rf /opt/crafty-4-v${RELEASE}.zip
95+
$STD apt-get -y autoremove
96+
$STD apt-get -y autoclean
97+
msg_ok "Cleaned"

json/crafty-controller.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "Crafty Controller",
3+
"slug": "crafty-controller",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-02-01",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8443,
12+
"documentation": "https://docs.craftycontrol.com/",
13+
"website": "https://craftycontrol.com/",
14+
"logo": "https://gitlab.com/crafty-controller/crafty-4/-/raw/master/app/frontend/static/assets/images/logo_long.svg",
15+
"description": "Crafty Controller is a free and open-source Minecraft launcher and manager that allows users to start and administer Minecraft servers from a user-friendly interface. The interface is run as a self-hosted web server that is accessible to devices on the local network by default and can be port forwarded to provide external access outside of your local network. Crafty is designed to be easy to install and use, requiring only a bit of technical knowledge and a desire to learn to get started. Crafty Controller is still actively being developed by Arcadia Technology and we are continually making major improvements to the software.\n\nCrafty Controller is a feature rich panel that allows you to create and run servers, manage players, run commands, change server settings, view and edit server files, and make backups. With the help of Crafty Controller managing a large number of Minecraft servers on separate versions is easy and intuitive to do.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/crafty-controller.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 4096,
23+
"hdd": 16,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": "admin",
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Show password: `cat ~/crafty-controller.creds`",
36+
"type": "info"
37+
}
38+
]
39+
}

0 commit comments

Comments
 (0)