mtprotoproxy
mtprotoproxy copied to clipboard
How to run proxy on powerful server?
if I want to run the proxy on an 8cpu 16gig ram, does it need a custom setting? Is it possible to set workers and is it necessary?
As said here you just need to run multiple instances of proxy. In your case I think 8 instances is ok.
Plus you can increase TO_CLT_BUFSIZE
and TO_TG_BUFSIZE
in config.py
@HirbodBehnam would you please explain how can I run multiple instances of proxy?
I would say, the best solution would be to use systemd templates. You can read detailed explanation here https://www.stevenrombauts.be/2019/01/run-multiple-instances-of-the-same-systemd-unit/
But in short, what you can do is (examples are for ubuntu 18):
sudo apt install python3-cryptography
sudo git clone -b stable https://github.com/alexbers/mtprotoproxy.git /opt/mtproto_proxy
# edit config:
sudo nano /opt/mtproto_proxy/config.py
Then create following 2 files:
/etc/systemd/system/[email protected] (note @
in filename! it's essential):
[Unit]
Description=Mtproto proxy worker %I
PartOf=mtproto-proxy.target
[Service]
Type=simple
ExecStart=/opt/mtproto_proxy/mtprotoproxy.py
/etc/systemd/system/mtproto-proxy.target :
[Unit]
Description=Mtproto proxy
# repeat "[email protected]" as many times with unique NNN as many workers you need
[email protected] [email protected] [email protected]
[Install]
WantedBy=multi-user.target
then apply changes, enable restart on reboot and start proxy workers:
sudo systemctl daemon-reload
sudo systemctl enable mtproto-proxy.target
sudo systemctl start mtproto-proxy.target
Another option is to use Erlang proxy, which can work on all cores automatically
@pouryare
Sure!
I depends if your server is Windows or Linux
If it is Windows:
It's quite simple; Just run multiple "cmd"s and on each run mtprotoproxy.py
.
If it is Linux:
I personally like tmux
. At first install tmux via your package manager. Then just type in: tmux
; A screen should popup with a green bar at bottom. Go at the path that you have downloaded proxy. Then there, run the proxy. (For example in Centos7 you gotta type python3.6 mtprotoproxy.py
). After you see that the script is running, press Ctrl + B
and then press D
. If you do it correctly that screen should be closed right now. Re-do these steps to run more instances. But there is a problem that if you reboot the server you have to do all these steps again.
Another option is to do this with systemd
. Read More Or what just @seriyps said 😆. This is a good way to do it.
Also you can try supervisor as this issue says