mirror of
https://github.com/jkaninda/laravel-php-fpm.git
synced 2025-12-06 17:09:39 +01:00
Merge branch '8.0' into 8.1
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
FROM php:8.1-fpm
|
FROM php:8.1-fpm
|
||||||
ENV WORKDIR=/var/www/html
|
ENV WORKDIR=/var/www/html
|
||||||
ENV STORAGE_DIR=/var/www/html/storage
|
ENV STORAGE_DIR=${WORKDIR}/storage
|
||||||
ENV LARAVEL_PROCS_NUMBER=2
|
ENV LARAVEL_PROCS_NUMBER=1
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
git \
|
git \
|
||||||
|
|||||||
@@ -165,6 +165,10 @@ volumes:
|
|||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
||||||
```
|
```
|
||||||
|
## Supervisord
|
||||||
|
### Add more supervisor process in
|
||||||
|
> /var/www/html/conf/worker/supervisor.conf
|
||||||
|
|
||||||
|
|
||||||
> P.S. please give a star if you like it :wink:
|
> P.S. please give a star if you like it :wink:
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,9 @@ echo "***********************************************************"
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
## Create PHP-FPM worker process
|
## Create PHP-FPM worker process
|
||||||
TASK=/etc/supervisor/conf.d/worker.conf
|
TASK=/etc/supervisor/conf.d/php-fpm.conf
|
||||||
touch $TASK
|
touch $TASK
|
||||||
cat > "$TASK" <<EOF
|
cat > "$TASK" <<EOF
|
||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
command=/usr/local/sbin/php-fpm
|
command=/usr/local/sbin/php-fpm
|
||||||
numprocs=1
|
numprocs=1
|
||||||
@@ -35,9 +31,6 @@ if [ -f $WORKDIR/artisan ]; then
|
|||||||
TASK=/etc/supervisor/conf.d/laravel-worker.conf
|
TASK=/etc/supervisor/conf.d/laravel-worker.conf
|
||||||
touch $TASK
|
touch $TASK
|
||||||
cat > "$TASK" <<EOF
|
cat > "$TASK" <<EOF
|
||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
[program:Laravel-scheduler]
|
[program:Laravel-scheduler]
|
||||||
process_name=%(program_name)s_%(process_num)02d
|
process_name=%(program_name)s_%(process_num)02d
|
||||||
command=/bin/sh -c "while [ true ]; do (php $WORKDIR/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
|
command=/bin/sh -c "while [ true ]; do (php $WORKDIR/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
|
||||||
@@ -72,10 +65,16 @@ echo "Checking if storage directory exists"
|
|||||||
|
|
||||||
else
|
else
|
||||||
echo "${Red} Directory $STORAGE_DIR does not exist"
|
echo "${Red} Directory $STORAGE_DIR does not exist"
|
||||||
echo "Fixing permissions from $WORKDIR"
|
fi
|
||||||
chown -R www-data:www-data $WORKDIR/storage
|
|
||||||
chmod -R 775 $WORKDIR/storage
|
## Check if the supervisor config file exists
|
||||||
echo "${Green}Permissions fixed"
|
if [ -f /var/www/html/conf/worker/supervisor.conf ]; then
|
||||||
|
echo "Custom supervisor config found"
|
||||||
|
cp /var/www/html/conf/worker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
|
||||||
|
else
|
||||||
|
echo "${Red} Supervisor.conf not found"
|
||||||
|
echo "If you want to add more supervisor configs, create config file in /var/www/html/conf/worker/supervisor.conf"
|
||||||
|
echo "Start supervisor with default config..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user