From c49100594cdff7ccb64d35f2a4d4d7f57fb998a9 Mon Sep 17 00:00:00 2001 From: anas Date: Sun, 29 Aug 2021 06:46:05 +0300 Subject: [PATCH] Qbit ready for vps check readme Signed-off-by: anas --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- bot/__init__.py | 6 +++--- config_sample.env | 8 ++++---- docker-compose.yml | 11 +++++++++++ qBittorrent.conf | 5 +++-- 5 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index f92cfe25833..f5f83a9eeb7 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,8 @@ python3 generate_drive_token.py ## Deploying +**IMPORTANT NOTE**: In start.sh you must replace $PORT with 80 or any other port you want to use + - Start Docker daemon (skip if already running): ``` sudo dockerd @@ -209,8 +211,45 @@ sudo docker build . -t mirror-bot ``` - Run the image: ``` -sudo docker run mirrorbot +sudo docker run -p 80:80 mirrorbot +``` +OR + +**NOTE**: If you want to use port other than 80, so change it in docker-compose.yml + +- Using Docker-compose so you can edit and build your image in seconds: +``` +sudo apt install docker-compose +``` +- Build and run Docker image: +``` +sudo docker-compose up +``` +- After edit files with nano for example (nano start.sh): +``` +sudo docker-compose build +sudo docker-compose up +``` +or +``` +sudo docker-compose up --build +``` +- To stop docker run +``` +sudo docker ps +``` +``` +sudo docker stop id +``` +- To clear the container (this will not effect on image): +``` +sudo docker container prune +``` +- To delete the image: +``` +sudo docker image prune -a ``` +## [Video From Tortoolkit Repo](https://youtu.be/c8_TU1sPK08) ## Deploying on Heroku - Deploying on Heroku with Github Workflow diff --git a/bot/__init__.py b/bot/__init__.py index 50da6d0403d..b51737c492f 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -43,9 +43,9 @@ alive = subprocess.Popen(["python3", "alive.py"]) -subprocess.run(["mkdir", "-p", ".config/qBittorrent"]) -subprocess.run(["cp", "qBittorrent.conf", ".config/qBittorrent/qBittorrent.conf"]) -subprocess.run(["qbittorrent-nox", "-d"]) +subprocess.run(["mkdir", "-p", "qBittorrent/config"]) +subprocess.run(["cp", "qBittorrent.conf", "qBittorrent/config/qBittorrent.conf"]) +subprocess.run(["qbittorrent-nox", "-d", "--profile=."]) Interval = [] diff --git a/config_sample.env b/config_sample.env index 34f19bdfbd0..f09024961a5 100644 --- a/config_sample.env +++ b/config_sample.env @@ -18,7 +18,7 @@ SUDO_USERS = "" # Split by space IGNORE_PENDING_REQUESTS = "" USE_SERVICE_ACCOUNTS = "" INDEX_URL = "" -STATUS_LIMIT = "" # Recommend limit status to 4 tasks max +STATUS_LIMIT = "" # Recommend limit status to 4 tasks UPTOBOX_TOKEN = "" MEGA_API_KEY = "" MEGA_EMAIL_ID = "" @@ -30,8 +30,8 @@ SHORTENER = "" SHORTENER_API = "" # qBittorrent IS_VPS = "" # Don't set this to True even if VPS, unless facing error with web server -SERVER_PORT = "80" # Only for VPS -BASE_URL_OF_BOT = "" # Required for Heroku +SERVER_PORT = "80" # Only if IS_VPS is True +BASE_URL_OF_BOT = "" # Web Link, Required for Heroku to avoid sleep or use worker if u don't want to use web(selection) # If you want to use Credentials externally from Index Links, fill these vars with the direct links # These are optional, if you don't know, simply leave them, don't fill anything in them. ACCOUNTS_ZIP_URL = "" @@ -46,7 +46,7 @@ HEROKU_API_KEY = "" HEROKU_APP_NAME = "" # View Link button to open file Index Link in browser instead of direct download link # You can figure out if it's compatible with your Index code or not, open any video from you Index and check if the END of link from browser link bar is ?a=view, if yes make it "True" it will work (Compatible with Bhadoo Index Code) -VIEW_LINK = "False" +VIEW_LINK = "" # Add more buttons (Three buttons are already added of Drive Link, Index Link, and View Link, you can add extra buttons too, these are optional) # If you don't know what are below entries, simply leave them, Don't fill anything in them. BUTTON_FOUR_NAME = "" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000000..863925ecf23 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3.3" + +services: + slam: + build: . + command: bash start.sh + restart: on-failure + ports: + - "80:80" + + diff --git a/qBittorrent.conf b/qBittorrent.conf index 3de5abe40f3..3424ca4e4d2 100644 --- a/qBittorrent.conf +++ b/qBittorrent.conf @@ -24,7 +24,7 @@ Advanced\RecheckOnCompletion=true Advanced\LtTrackerExchange=true Advanced\SuperSeeding=false Bittorrent\MaxConnecs=3000 -Bittorrent\MaxConnecsPerTorrent=300 +Bittorrent\MaxConnecsPerTorrent=500 Bittorrent\DHT=true Bittorrent\DHTPort=6881 Bittorrent\Encryption=0 @@ -32,12 +32,13 @@ Bittorrent\PeX=true Bittorrent\LSD=true Bittorrent\sameDHTPortAsBT=true Bittorrent\uTP=true -Bittorrent\uTP_rate_limited=false +Bittorrent\uTP_rate_limited=true Connection\PortRangeMin=6881 Connection\UPnP=true Downloads\DiskWriteCacheSize=64 Downloads\PreAllocation=true Downloads\UseIncompleteExtension=true +General\PreventFromSuspendWhenDownloading=true Queueing\IgnoreSlowTorrents=true Queueing\MaxActiveDownloads=50 Queueing\MaxActiveTorrents=100