mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-10 17:59:17 +00:00
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
This commit is contained in:
parent
8662be2e4e
commit
cb6e2c4455
90
ct/crafty-controller.sh
Normal file
90
ct/crafty-controller.sh
Normal file
@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts
|
||||
# Author: CrazyWolf13
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
|
||||
# App Default Values
|
||||
APP="Crafty-Controller"
|
||||
var_tags="gaming"
|
||||
var_cpu="2"
|
||||
var_ram="4096"
|
||||
var_disk="16"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
# App Output & Base Settings
|
||||
header_info "$APP"
|
||||
base_settings
|
||||
|
||||
# Core
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/crafty-controller ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
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/"//')
|
||||
if [[ ! -f /opt/crafty-controller_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/crafty-controller_version.txt)" ]]; then
|
||||
|
||||
msg_info "Stopping Crafty-Controller"
|
||||
systemctl stop crafty-controller
|
||||
msg_ok "Stopped Crafty-Controller"
|
||||
|
||||
msg_info "Creating Backup of config"
|
||||
cp -a /opt/crafty-controller/crafty/crafty-4/app/config/. /opt/crafty-controller/backup
|
||||
rm /opt/crafty-controller/backup/version.json
|
||||
rm /opt/crafty-controller/backup/credits.json
|
||||
rm /opt/crafty-controller/backup/logging.json
|
||||
rm /opt/crafty-controller/backup/default.json.example
|
||||
rm /opt/crafty-controller/backup/motd_format.json
|
||||
msg_ok "Backup Created"
|
||||
|
||||
msg_info "Updating Crafty-Controller to v${RELEASE}"
|
||||
wget -q "https://gitlab.com/crafty-controller/crafty-4/-/archive/v${RELEASE}/crafty-4-v${RELEASE}.zip"
|
||||
unzip -q crafty-4-v${RELEASE}.zip
|
||||
cp -a crafty-4-v${RELEASE}/. /opt/crafty-controller/crafty/crafty-4/
|
||||
rm -rf crafty-4-v${RELEASE}
|
||||
cd /opt/crafty-controller/crafty/crafty-4
|
||||
sudo -u crafty bash -c '
|
||||
source /opt/crafty-controller/crafty/.venv/bin/activate
|
||||
pip3 install --no-cache-dir -r requirements.txt
|
||||
' &>/dev/null
|
||||
echo "${RELEASE}" >"/opt/crafty-controller_version.txt"
|
||||
msg_ok "Updated Crafty-Controller to v${RELEASE}"
|
||||
|
||||
msg_info "Restoring Backup of config"
|
||||
cp -a /opt/crafty-controller/backup/. /opt/crafty-controller/crafty/crafty-4/app/config
|
||||
rm -rf /opt/crafty-controller/backup
|
||||
chown -R crafty:crafty /opt/crafty-controller/
|
||||
msg_ok "Backup Restored"
|
||||
|
||||
msg_info "Starting Crafty-Controller"
|
||||
systemctl start crafty-controller
|
||||
msg_ok "Started Crafty-Controller"
|
||||
|
||||
msg_ok "Updated Successfully"
|
||||
exit
|
||||
else
|
||||
msg_ok "No update required. Crafty-Controller is already at v${RELEASE}."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:8443${CL}"
|
97
install/crafty-controller-install.sh
Normal file
97
install/crafty-controller-install.sh
Normal file
@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts
|
||||
# Author: CrazyWolf13
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://docs.craftycontrol.com/pages/getting-started/installation/linux/
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies (a lot of patience)"
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
git \
|
||||
sed \
|
||||
lsb-release \
|
||||
apt-transport-https \
|
||||
coreutils \
|
||||
software-properties-common \
|
||||
openjdk-17-jdk
|
||||
wget -q https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
|
||||
$STD sudo dpkg -i jdk-21_linux-x64_bin.deb
|
||||
rm -f jdk-21_linux-x64_bin.deb
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setup Python3"
|
||||
$STD apt-get install -y \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
python3-venv
|
||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||
msg_ok "Setup Python3"
|
||||
|
||||
|
||||
msg_info "Installing Craty-Controller (Patience)"
|
||||
useradd crafty -m -s /bin/bash
|
||||
cd /opt
|
||||
mkdir -p /opt/crafty-controller/crafty /opt/crafty-controller/server
|
||||
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/"//')
|
||||
echo "${RELEASE}" >"/opt/crafty-controller_version.txt"
|
||||
wget -q "https://gitlab.com/crafty-controller/crafty-4/-/archive/v${RELEASE}/crafty-4-v${RELEASE}.zip"
|
||||
unzip -q crafty-4-v${RELEASE}.zip
|
||||
cp -a crafty-4-v${RELEASE}/. /opt/crafty-controller/crafty/crafty-4/
|
||||
rm -rf crafty-4-v${RELEASE}
|
||||
|
||||
cd /opt/crafty-controller/crafty
|
||||
python3 -m venv .venv
|
||||
chown -R crafty:crafty /opt/crafty-controller/
|
||||
$STD sudo -u crafty bash -c '
|
||||
source /opt/crafty-controller/crafty/.venv/bin/activate
|
||||
cd /opt/crafty-controller/crafty/crafty-4
|
||||
pip3 install --no-cache-dir -r requirements.txt
|
||||
'
|
||||
msg_ok "Installed Craft-Controller and dependencies"
|
||||
|
||||
msg_info "Setting up Crafty-Controller service"
|
||||
cat > /etc/systemd/system/crafty-controller.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Crafty 4
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=crafty
|
||||
WorkingDirectory=/opt/crafty-controller/crafty/crafty-4
|
||||
Environment=PATH=/opt/crafty-controller/crafty/.venv/bin:$PATH
|
||||
ExecStart=/opt/crafty-controller/crafty/.venv/bin/python3 main.py -d
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
$STD systemctl enable -q --now crafty-controller
|
||||
sleep 10
|
||||
{
|
||||
echo "Crafty-Controller-Credentials"
|
||||
echo "Username: $(grep -oP '(?<="username": ")[^"]*' /opt/crafty-controller/crafty/crafty-4/app/config/default-creds.txt)"
|
||||
echo "Password: $(grep -oP '(?<="password": ")[^"]*' /opt/crafty-controller/crafty/crafty-4/app/config/default-creds.txt)"
|
||||
} >> ~/crafty-controller.creds
|
||||
msg_ok "Crafty-Controller service started"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/crafty-4-v${RELEASE}.zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
39
json/crafty-controller.json
Normal file
39
json/crafty-controller.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "Crafty Controller",
|
||||
"slug": "crafty-controller",
|
||||
"categories": [
|
||||
24
|
||||
],
|
||||
"date_created": "2025-02-01",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 8443,
|
||||
"documentation": "https://docs.craftycontrol.com/",
|
||||
"website": "https://craftycontrol.com/",
|
||||
"logo": "https://gitlab.com/crafty-controller/crafty-4/-/raw/master/app/frontend/static/assets/images/logo_long.svg",
|
||||
"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.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/crafty-controller.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 4096,
|
||||
"hdd": 16,
|
||||
"os": "Debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": "admin",
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Show password: `cat ~/crafty-controller.creds`",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user