Setting Up and Running Your Python Filter Bot on a HostingUp VPS
-
Access Your VPS:
- Check your email for SSH access information.
- If you do not receive it, raise a support ticket or join the Telegram support group.
-
Update Your VPS Server:
- Run the following commands to update your server:
sudo apt update sudo apt upgrade
- Run the following commands to update your server:
-
Install Python3 and pip:
- Install Python3 and pip using the command:
sudo apt install python3-pip
- Install Python3 and pip using the command:
-
Clone Your Repository:
- Clone your repository to your VPS:
git clone YOUR-REPO-URL
- Replace
YOUR-REPO-URL
with the actual URL of your repository.
- Clone your repository to your VPS:
-
Navigate to Your Repository Folder:
- Change into your repository directory:
cd YOUR-FOLDER-NAME
- Replace
YOUR-FOLDER-NAME
with the name of your cloned repository folder.
- Change into your repository directory:
-
Set Up a Virtual Environment (for Ubuntu 24):
- Install the
python3-virtualenv
package:sudo apt install python3-virtualenv
- Create a virtual environment named
env
:virtualenv env
- Activate the virtual environment:
source env/bin/activate
- Install the
-
Install Required Python Packages:
- Install the dependencies listed in your
requirements.txt
file:pip3 install -r requirements.txt
- Install the dependencies listed in your
-
Run Your Bot 24/7:
-
Start your bot in the background using
nohup
:nohup python3 bot.py
-
Your bot is now running.
-
-
How to Close the Bot:
- To stop the bot, first find the PID (Process ID) of the running bot:
ps -ef | grep python3
- Locate the PID of the
python3 bot.py
process and then kill it:kill -9 PID
- Replace
PID
with the actual Process ID of your bot.
- To stop the bot, first find the PID (Process ID) of the running bot:
-
Additional Resources:
- For more information, watch this video: Video Tutorial
Automatically Set Up Your Server and Deploy Your Bot Running 24/7 with a Single Command
To streamline the deployment of your bot using a single command, choose the appropriate deployment script based on your procfile
configuration:
-
For
python bot.py
orpython3 bot.py
:Use the following command:
curl -sL https://script.hostingup.in/python_bot_py.sh | sed 's/\r$//' | bash -s -- https://github.com/your-username/your-repo.git
- Replace
https://github.com/your-username/your-repo.git
with your actual GitHub repository URL. - This command downloads and executes the
python_bot_py.sh
script, suitable for repositories configured to runbot.py
.
- Replace
-
For
python main.py
orpython3 main.py
:Use this alternative command:
curl -sL https://script.hostingup.in/python_main_py.sh | sed 's/\r$//' | bash -s -- https://github.com/your-username/your-repo.git
- Replace
https://github.com/your-username/your-repo.git
with the URL of your GitHub repository. - This command utilizes the
python_main_py.sh
script, intended for repositories that executemain.py
.
- Replace
Stop Your Bot
For bot.py
or python3 bot.py
:
curl -sL https://script.hostingup.in/close_botpy.sh | sed 's/\r$//' | bash
For main.py
or python3 main.py
:
curl -sL https://script.hostingup.in/close_mainpy.sh | sed 's/\r$//' | bash
Important Notes:
- Ensure you use the correct script (
python_bot_py.sh
orpython_main_py.sh
) based on the script specified in yourprocfile
. - Double-check that your GitHub repository URL is correct to facilitate smooth deployment.
By following these instructions, you can deploy your bot efficiently with a single command tailored to your configuration.