use redis for queues, sessions and cache (#618)

This commit is contained in:
Saeed Vaziry
2025-06-21 09:48:07 +02:00
committed by GitHub
parent 3196c0d954
commit 7bfa9ef91d
10 changed files with 40 additions and 9 deletions

View File

@ -15,3 +15,6 @@ MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="noreply@${APP_NAME}"
MAIL_FROM_NAME="${APP_NAME}"
REDIS_HOST=redis
REDIS_PORT=6379

View File

@ -15,7 +15,7 @@
|
*/
'default' => env('CACHE_DRIVER', 'file'),
'default' => env('CACHE_DRIVER', 'redis'),
/*
|--------------------------------------------------------------------------

View File

@ -44,19 +44,23 @@
],
'default' => [
'driver' => 'database',
'table' => 'jobs',
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'timeout' => 90,
'retry_after' => 600,
'block_for' => null,
'after_commit' => false,
],
'ssh' => [
'driver' => 'database',
'table' => 'jobs',
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'timeout' => 600,
'retry_after' => 600,
'block_for' => null,
'after_commit' => false,
],
],

View File

@ -18,7 +18,7 @@
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
'driver' => env('SESSION_DRIVER', 'redis'),
/*
|--------------------------------------------------------------------------

View File

@ -16,7 +16,7 @@ public function up(): void
public function down(): void
{
Schema::table('workers', function (Blueprint $table) {
$table->dropColumn('name');
// $table->dropColumn('name');
});
}
};

View File

@ -21,7 +21,18 @@ services:
- '.:/var/www/html'
networks:
- vito
depends_on: { }
depends_on:
- redis
redis:
image: 'redis:alpine'
volumes:
- 'vito-redis:/data'
networks:
- vito
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
retries: 3
timeout: 5s
worker:
build:
context: ./vendor/laravel/sail/runtimes/8.4
@ -43,6 +54,11 @@ services:
- vito
depends_on:
- app
- redis
networks:
vito:
driver: bridge
volumes:
vito-redis:
driver: local
name: vito-redis

View File

@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y
# requirements
RUN apt-get install -y software-properties-common curl zip unzip gcc nginx git \
RUN apt-get install -y software-properties-common curl zip unzip gcc nginx redis-server git \
cron gnupg gosu curl ca-certificates zip unzip supervisor libcap2-bin libpng-dev \
dnsutils librsvg2-bin fswatch wget openssh-client \
&& add-apt-repository ppa:ondrej/php -y \

View File

@ -9,6 +9,7 @@ services:
PASSWORD: "password"
APP_KEY: "base64:UodiJrx3DkcMlizmoimNlDn+yd4q5f2VbkBay19rJwM="
APP_PORT: 8000
APP_URL: "http://localhost:8000"
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:

View File

@ -58,6 +58,7 @@ chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/storage /var/www/html/bootstrap/cache
service php8.4-fpm start
service redis-server start
service nginx start
php /var/www/html/artisan migrate --force

View File

@ -108,6 +108,12 @@ sed -i "s/post_max_size = .*/post_max_size = 1G/" /etc/php/${V_PHP_VERSION}/fpm/
curl -sS https://getcomposer.org/installer -o composer-setup.php
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
# redis
apt install redis-server -y
service redis enable
service redis start
# setup website
export COMPOSER_ALLOW_SUPERUSER=1
export V_REPO="https://github.com/vitodeploy/vito.git"