* No Dyno Issus
1. Lets create a Digital Ocean Account first!
Digital Ocean: https://cloud.digitalocean.com/registrations/newEnter required details and signup with Digital Ocean!
Card verification is required for signup! You'll be charged some amount for verification and the same will be refunded within few hours. So don't worry.
2. Making an instance in Digital Ocean
Creating a SSH keyDownload PuTTY ; https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Create a new SSH Public key and copy paste it in Instance config page.
Save it as our Private key.
Deploy instance.
3. Connecting to the instance!
- Connecting to instance with our ssh keyhostname : root@IPV4address
- You'll be logged in as a root user!
- Create a new user with sudo privileges ( cause it's better that way)
sudo adduser <newusername>
sudo usermod -aG sudo
<newusername>su - newusername
- Now whenever you login to your instance, change to your user by;
su - newusername
4. Setting up your repository
Configure Marie Bot Repo;Clone the source code of Marie
Source Code : https://github.com/prgofficial/Marie-2.0-English
Create config.py file from sample_config.py
Bot Token : from Bot Father
Owner ID : from Rose ( /id )
Owner username : Any name
Database Uri : Install postgres server in our Instance and get
5. Install and setup a Postgres Server
Connect to your instance, then run;sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
Give sudo permission to user
sudo usermod -aG sudo postgres
Set a new password
sudo passwd postgres
password will be invisible, dont worry!
Login to postgres
su - postgres
Create new user for psql
createuser --interactive --pwprompt
# enter a name for user
# enter a password for user
# give superuser power
you can give any name and password!!
Create a database and assign user
createdb -O <username> <newdbname>
Allow remote access
nano /etc/postgresql/12/main/postgresql.conf
Uncomment, and change the value
#listen_addresses = 'localhost'
this will allow Postgres connections from anyone.
USE CTRL + O and press enter to save the file and CTRL + X to exit the editor
Allow Connections from everyone
nano /etc/postgresql/12/main/pg_hba.conf
Modify this section;
# IPv4 local connections:
host all all 127.0.0.1/32 md5
TO;
# IPv4 local connections:
USE CTRL + O and press enter to save the file and CTRL + X to exit the editor
Allow port 5432
sudo ufw allow 5432/tcp
sudo systemctl restart postgresql
Now, your DB URL will be;
postgres://username:pw@hostname:port/dbname
6. Hosting Marie REPO
Connect to your instance using puttyconnect again using putty or;
Press CTRL + A + D to go back to your user from our current screen
Using screens is a better way to run your programs.
screen -S marie
This will open a new screen inside our main terminal.
Clone your source code to your instance
git clone your_repo_url
Enter your github username and password and hit enter!
Change your current dirrectory
cd reponame
Install required dependencies.
sudo apt install python3-pip
pip3 install -r requirements.txt
Start your BOT !
python3 -m tg_bot
Your BOT is ready to use :)
Now your bot is ready with nearly Unlimited Filters....
:) thank you
Some Usefull commands;
> To detach from current screen
Ctrl + a + d ( hold Ctrl and press a and d sequentially )
> To see all active screens
screen -ls
> To attach to a screen
screen -r number
>To detach from a screen
screen -d number
>To logout from terminal with BOT running in screen
Ctrl + a + d