Update install
This commit is contained in:
parent
be9a7e2fb9
commit
4b1aa41aec
@ -24,34 +24,40 @@ function update_script() {
|
|||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
if ! command -v clawdbot >/dev/null 2>&1; then
|
if [[ ! -d /opt/clawdbot ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Stopping Service"
|
if check_for_gh_release "clawdbot" "clawdbot/clawdbot"; then
|
||||||
systemctl stop clawdbot
|
msg_info "Stopping Service"
|
||||||
msg_ok "Stopped Service"
|
systemctl stop clawdbot
|
||||||
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Backing up Data"
|
msg_info "Backing up Data"
|
||||||
cp -r /opt/clawdbot/data /opt/clawdbot_data_backup 2>/dev/null || true
|
cp -r /opt/clawdbot/data /opt/clawdbot_data_backup 2>/dev/null || true
|
||||||
cp -r /root/.clawdbot /root/.clawdbot_backup 2>/dev/null || true
|
cp -r /root/.clawdbot /root/.clawdbot_backup 2>/dev/null || true
|
||||||
msg_ok "Backed up Data"
|
msg_ok "Backed up Data"
|
||||||
|
|
||||||
msg_info "Updating Clawdbot"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "clawdbot" "clawdbot/clawdbot"
|
||||||
$STD npm install -g clawdbot@latest
|
|
||||||
msg_ok "Updated Clawdbot"
|
|
||||||
|
|
||||||
msg_info "Restoring Data"
|
msg_info "Rebuilding Clawdbot"
|
||||||
cp -r /opt/clawdbot_data_backup/. /opt/clawdbot/data 2>/dev/null || true
|
cd /opt/clawdbot
|
||||||
cp -r /root/.clawdbot_backup/. /root/.clawdbot 2>/dev/null || true
|
$STD pnpm install --frozen-lockfile
|
||||||
rm -rf /opt/clawdbot_data_backup /root/.clawdbot_backup
|
$STD pnpm ui:build
|
||||||
msg_ok "Restored Data"
|
msg_ok "Rebuilt Clawdbot"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Restoring Data"
|
||||||
systemctl start clawdbot
|
cp -r /opt/clawdbot_data_backup/. /opt/clawdbot/data 2>/dev/null || true
|
||||||
msg_ok "Started Service"
|
cp -r /root/.clawdbot_backup/. /root/.clawdbot 2>/dev/null || true
|
||||||
msg_ok "Updated successfully!"
|
rm -rf /opt/clawdbot_data_backup /root/.clawdbot_backup
|
||||||
|
msg_ok "Restored Data"
|
||||||
|
|
||||||
|
msg_info "Starting Service"
|
||||||
|
systemctl start clawdbot
|
||||||
|
msg_ok "Started Service"
|
||||||
|
msg_ok "Updated successfully!"
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,5 +68,5 @@ description
|
|||||||
msg_ok "Completed Successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:18791${CL}"
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"type": "ct",
|
"type": "ct",
|
||||||
"updateable": true,
|
"updateable": true,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": 80,
|
"interface_port": 18791,
|
||||||
"documentation": "https://docs.clawd.bot/",
|
"documentation": "https://docs.clawd.bot/",
|
||||||
"website": "https://clawd.bot/",
|
"website": "https://clawd.bot/",
|
||||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/clawdbot.webp",
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/clawdbot.webp",
|
||||||
|
|||||||
@ -16,41 +16,22 @@ update_os
|
|||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
git \
|
git
|
||||||
nginx
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
NODE_VERSION="24" NODE_MODULE="clawdbot@latest" setup_nodejs
|
fetch_and_deploy_gh_release "clawdbot" "clawdbot/clawdbot"
|
||||||
import_local_ip
|
|
||||||
|
|
||||||
|
pnpm_version=$(grep -oP '"packageManager":\s*"pnpm@\K[^"]+' /opt/clawdbot/package.json 2>/dev/null || echo "latest")
|
||||||
|
NODE_VERSION="24" NODE_MODULE="pnpm@${pnpm_version}" setup_nodejs
|
||||||
|
|
||||||
msg_info "Configuring Nginx"
|
msg_info "Installing Clawdbot Dependencies"
|
||||||
cat <<EOF >/etc/nginx/sites-available/clawdbot
|
cd /opt/clawdbot
|
||||||
server {
|
$STD pnpm install --frozen-lockfile
|
||||||
listen 80;
|
msg_ok "Installed Dependencies"
|
||||||
server_name _;
|
|
||||||
|
|
||||||
location / {
|
msg_info "Building Clawdbot UI"
|
||||||
proxy_pass http://127.0.0.1:18791;
|
$STD pnpm ui:build
|
||||||
proxy_http_version 1.1;
|
msg_ok "Built Clawdbot UI"
|
||||||
proxy_set_header Upgrade \$http_upgrade;
|
|
||||||
proxy_set_header Connection 'upgrade';
|
|
||||||
proxy_set_header Host \$host;
|
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
||||||
proxy_cache_bypass \$http_upgrade;
|
|
||||||
proxy_buffering off;
|
|
||||||
proxy_read_timeout 86400s;
|
|
||||||
proxy_send_timeout 86400s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
ln -sf /etc/nginx/sites-available/clawdbot /etc/nginx/sites-enabled/clawdbot
|
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
|
||||||
$STD nginx -t
|
|
||||||
$STD systemctl enable -q --now nginx
|
|
||||||
msg_ok "Configured Nginx"
|
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user