diff --git a/extra tuts/Atombest speed.md b/extra tuts/Atombest speed.md new file mode 100644 index 0000000000..97e2c8441a --- /dev/null +++ b/extra tuts/Atombest speed.md @@ -0,0 +1,90 @@ +### 1\. Install Redis and PHP Extension + +Start by installing Redis and the PHP extension to enable your PHP code to communicate with Redis. + +**On Debian/Ubuntu:** + +```bash +sudo apt update +sudo apt install redis-server php-redis +``` + +Restart your PHP service (e.g., PHP-FPM) to load the extension: + +```bash +sudo systemctl restart php8.2-fpm +``` + +----- + +### 2\. Configure the `.env` File + +Modify the following lines in your `.env` file to tell Laravel to use Redis. + +```env +CACHE_DRIVER=redis +QUEUE_CONNECTION=redis +SESSION_DRIVER=redis + +REDIS_CLIENT=phpredis +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 +``` + +----- + +### 3\. Install and Configure Supervisor + +Supervisor is needed to manage your queue workers and automatically restart them on crashes. + +```bash +sudo apt install supervisor +``` + +Create the configuration file for your worker: + +```bash +sudo nano /etc/supervisor/conf.d/atomcms-worker.conf +``` + +Paste the following code into the file and save it. Make sure you use the `atomcms` path. + +```ini +[program:atomcms-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /var/www/atomcms/artisan queue:work redis --sleep=3 --tries=3 --max-jobs=500 +autostart=true +autorestart=true +user=www-data +numprocs=8 +redirect_stderr=true +stdout_logfile=/var/www/atomcms/storage/logs/worker.log +stopwaitsecs=3600 +``` + +----- + +### 4\. Finalize and Test + +Ensure that the logs directory and your entire project have the correct permissions for the `www-data` user. + +```bash +sudo chown -R www-data:www-data /var/www/atomcms +``` + +Load the Supervisor configuration and start the workers. + +```bash +sudo supervisorctl reread +sudo supervisorctl update +sudo supervisorctl start atomcms-worker:* +``` + +You can check the status of your workers with: + +```bash +sudo supervisorctl status +``` + +If you see `RUNNING`, your setup is correct, and your application is optimally configured. \ No newline at end of file