A PHP Laravel Telegram Bot
I recommend using systemd to manage laravel queue workers, and systemd-timer to manage laravel schedules.
This is a doc of supervisor + crontab version that laravel recommended.
You can do anything you want.
- All this repo commands are tested on Fedora 37
Make a file tree like this:
/www/server/mariadb/
├── data
└── mysql
└── my.cnf
/www/server/redis/
├── conf
│ └── redis.conf
└── data
Then run:
podman-compose -f docker-compose.yml up -dIf you are using docker, you need to create a bridge network named podman first.
docker network create --driver bridge podman
docker-compose -f docker-compose.yml up -ddnf update --refresh -y
dnf install supervisor podman* cockpit* --refresh -y
systemctl enable --now supervisord.service
systemctl enable --now nginx.service
systemctl enable --now php-fpm.service
systemctl enable --now container-mariadb.service
systemctl enable --now container-redis.service
composer install
./permission.sh
php artisan key:generate
vim .env
supervisor/init.sh
supervisor/reload.sh
supervisor/start.shphp artisan migratephp artisan command:GetWebhookInfophp artisan command:SetWebhookphp artisan command:DeleteWebhookIf you edited anything, you may need to restart queue workers, to make sure they are using the new configuration, or the new codes to be run.
Otherwise, they may update to the latest configurations and codes after 3600 seconds at most.
So you can send the signal to restart queue workers, via the laravel official command:
php artisan queue:restartOr force restart with supervisor(not recommended):
supervisor/restart.shOr you can let bot call the laravel official command:
Send a message to the bot with the command
/restart
