From 2f5c95d0ec8b14501cf8ec30e903006fb535c131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20B=C3=A9dard-Couture?= Date: Tue, 4 Jun 2024 02:28:39 -0400 Subject: [PATCH] Add Flaresolverr script (#3124) --- ct/flaresolverr.sh | 86 +++++++++++++++++++++++++++++++++ install/flaresolverr-install.sh | 65 +++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 ct/flaresolverr.sh create mode 100644 install/flaresolverr-install.sh diff --git a/ct/flaresolverr.sh b/ct/flaresolverr.sh new file mode 100644 index 00000000..880b2426 --- /dev/null +++ b/ct/flaresolverr.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/remz1337/Proxmox/remz/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ _____ __ + / ____/ /___ _________ / ___/____ / / _____ __________ + / /_ / / __ `/ ___/ _ \\__ \/ __ \/ / | / / _ \/ ___/ ___/ + / __/ / / /_/ / / / __/__/ / /_/ / /| |/ / __/ / / / +/_/ /_/\__,_/_/ \___/____/\____/_/ |___/\___/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="FlareSolverr" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -f /etc/systemd/system/flaresolverr.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + header_info + msg_info "Updating $APP LXC" + systemctl stop flaresolverr + + # install flaresolverr + RELEASE=$(wget -q https://github.com/FlareSolverr/FlareSolverr/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) + wget -q https://github.com/FlareSolverr/FlareSolverr/releases/download/$RELEASE/flaresolverr_linux_x64.tar.gz + tar -xzf flaresolverr_linux_x64.tar.gz -C /opt + rm flaresolverr_linux_x64.tar.gz + + systemctl start flaresolverr + msg_ok "Updated $APP LXC" + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 512 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8191${CL} \n" diff --git a/install/flaresolverr-install.sh b/install/flaresolverr-install.sh new file mode 100644 index 00000000..abc8207a --- /dev/null +++ b/install/flaresolverr-install.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https wget gpg xvfb +msg_ok "Installed Dependencies" + +msg_info "Installing Chrome" +wget -qO- https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg +echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list +$STD apt update +$STD apt install -y google-chrome-stable +msg_ok "Installed Chrome" + +msg_info "Installing FlareSolverr" +RELEASE=$(wget -q https://github.com/FlareSolverr/FlareSolverr/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +$STD wget -q https://github.com/FlareSolverr/FlareSolverr/releases/download/$RELEASE/flaresolverr_linux_x64.tar.gz +$STD tar -xzf flaresolverr_linux_x64.tar.gz -C /opt +$STD rm flaresolverr_linux_x64.tar.gz +msg_ok "Installed FlareSolverr" + +msg_info "Creating Service" +cat </etc/systemd/system/flaresolverr.service +[Unit] +Description=FlareSolverr +After=network.target +[Service] +SyslogIdentifier=flaresolverr +Restart=always +RestartSec=5 +Type=simple +Environment="LOG_LEVEL=info" +Environment="CAPTCHA_SOLVER=none" +WorkingDirectory=/opt/flaresolverr +ExecStart=/opt/flaresolverr/flaresolverr +TimeoutStopSec=30 +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now flaresolverr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get autoremove +$STD apt-get autoclean +msg_ok "Cleaned" \ No newline at end of file