Skip to content

Adding a new method of hosting - service/daemon#380

Open
HostServer001 wants to merge 8 commits intoTgCatUB:betafrom
UselessCodeOrg:beta
Open

Adding a new method of hosting - service/daemon#380
HostServer001 wants to merge 8 commits intoTgCatUB:betafrom
UselessCodeOrg:beta

Conversation

@HostServer001
Copy link
Copy Markdown

@HostServer001 HostServer001 commented Feb 23, 2026

Hello,
I use catuserbot for quite a while now, since Heruko started banning users for deploying userbots the hosting has been difficult.
This led to local hosting, one way was to self host and the other was to use docker . Self host is a painful method , even the documentation mentions that and docker is a resource heavy method which is not suitable for RAM and compute starving PC/Laptop. Hence, we need a option which is not painful as self host and as resource heavy as docker. I think that daemonization is the suitable to fulfill this purpose . It is managed by systemd and has its own venv so not painful as self host and since runs directly on pc/laptop not that resource heavy. In this PR i have added two files , install_as_service.py and _install_checker.py , the former is a script to install the userbot after user has written his .env file and the latter is a script to check if the config variables are okay or not.
This script is designed to minimize user interaction, it is almost a plug and play script.
One downside is that it requires sudo cause we are making a .service file and also installing packages like uv.
But i have tried to make it log every command it runs.

I have also added the gitbook docs for this method along with changing the documentation on config vars which referenced to config.py which is replaced by .env .

Thank you for your time , hope you find this PR valuable and helpful .
I am also willing to help in documentation, as someone requested for help in the telegram channel

TLDR-
Things changed
two new files added for new method of hosting

  • install_as_service.py
  • _install_checker.py
  • added documentation for this method
  • changed the old documentation on config vars which referenced use of config.py file

EDIT-
As i was reviewing my own work, i realized some bugs and security issues that may arrive in future.

  • Added aditional file uv-installer.sh , so script dont need to curl and pipe
  • Changed bad logic in database_setup which was altering the password silently before even checking whether data base exists
  • removed shell = True argument from the subprocess.run , minimizing the risk of command injection

sudo is needed for this command to make the `.service` file and place it in `/etc/systemd/system/` directory.\
Apart from this the script also installs things like uv, progetsql, and requirements.txt .

It is advised to check `install_as_service.py` and `install`_`_`_`checker.py` file before you run them. If you have cloned the repo for correct official source no need to worry.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small install_checker.py markdown fix need

Comment thread install_as_service.py
(["uv", "venv", "--python", "3.11"], {"UV_PYTHON_INSTALL_DIR": "/opt/uv-python"}),
(["uv", "pip", "install", "-r", "requirements.txt"], {"UV_PYTHON_INSTALL_DIR": "/opt/uv-python"}),
(["apt-get", "install", "-y", "postgresql", "postgresql-contrib"], None),
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it without uv or use pip install uv given on their install process instead of copying whole script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants