mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Update cron file, use supervisor.
This commit is contained in:
11
.deploy/docker/cronjob.conf
Normal file
11
.deploy/docker/cronjob.conf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[program:cron]
|
||||||
|
command=/usr/sbin/cron -f -L 15
|
||||||
|
user=root
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_events_enabled=true
|
||||||
|
stderr_events_enabled=true
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
startsecs=10
|
||||||
|
startretries=3
|
@@ -1 +0,0 @@
|
|||||||
* * * * * root /artisan schedule:run >> /var/log/cron.log
|
|
@@ -26,6 +26,4 @@ cat .env.docker | envsubst > .env
|
|||||||
composer dump-autoload
|
composer dump-autoload
|
||||||
php artisan package:discover
|
php artisan package:discover
|
||||||
php artisan firefly:instructions install
|
php artisan firefly:instructions install
|
||||||
service rsyslog start
|
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf --nodaemon
|
||||||
service cron start
|
|
||||||
exec apache2-foreground
|
|
6
.deploy/docker/firefly-iii.conf
Normal file
6
.deploy/docker/firefly-iii.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[program:apache2]
|
||||||
|
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
|
||||||
|
stdout_events_enabled=true
|
||||||
|
stderr_events_enabled=true
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
30
.deploy/docker/supervisord.conf
Normal file
30
.deploy/docker/supervisord.conf
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# supervisor config file
|
||||||
|
# Adapted from the config file distributed with the supervisor package on Debian
|
||||||
|
# Jessie
|
||||||
|
|
||||||
|
# Enable supervisord in non-daemon mode. Disable the logfile as we receive
|
||||||
|
# log messages via stdout/err. Set up the child process log directory in case
|
||||||
|
# the user doesn't set logging to stdout/err.
|
||||||
|
[supervisord]
|
||||||
|
nodaemon = true
|
||||||
|
logfile = NONE
|
||||||
|
pidfile = /var/run/supervisord.pid
|
||||||
|
childlogdir = /var/log/supervisor
|
||||||
|
loglevel=debug
|
||||||
|
|
||||||
|
# Enable supervisorctl via RPC interface over Unix socket
|
||||||
|
[unix_http_server]
|
||||||
|
file = /var/run/supervisor.sock
|
||||||
|
chmod = 0700
|
||||||
|
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
|
[supervisorctl]
|
||||||
|
serverurl = unix:///var/run/supervisor.sock
|
||||||
|
|
||||||
|
|
||||||
|
# Include conf files for child processes
|
||||||
|
# Debian/Ubuntu packages use /etc/supervisor/conf.d
|
||||||
|
[include]
|
||||||
|
files = /etc/supervisor/conf.d/*.conf
|
19
Dockerfile
19
Dockerfile
@@ -20,12 +20,15 @@ RUN apt-get update -y && \
|
|||||||
libedit-dev \
|
libedit-dev \
|
||||||
libtidy-dev \
|
libtidy-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
|
unzip \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
|
nano \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libbz2-dev \
|
libbz2-dev \
|
||||||
gettext-base \
|
gettext-base \
|
||||||
cron \
|
cron \
|
||||||
rsyslog \
|
rsyslog \
|
||||||
|
supervisor \
|
||||||
locales && \
|
locales && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
@@ -50,12 +53,18 @@ RUN cd /tmp && \
|
|||||||
# Make sure that libcurl is using the newer curl libaries
|
# Make sure that libcurl is using the newer curl libaries
|
||||||
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/00-curl.conf && ldconfig
|
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/00-curl.conf && ldconfig
|
||||||
|
|
||||||
# Create the log file to be able to run tail
|
# Mimic the Debian/Ubuntu config file structure for supervisor
|
||||||
RUN touch /var/log/cron.log
|
COPY .deploy/docker/supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
RUN mkdir -p /etc/supervisor/conf.d /var/log/supervisor
|
||||||
|
|
||||||
# Setup cron job
|
# copy Firefly III supervisor conf file.
|
||||||
COPY .deploy/docker/crontab /etc/cron.d/crontab
|
COPY ./.deploy/docker/firefly-iii.conf /etc/supervisor/conf.d/firefly-iii.conf
|
||||||
RUN chmod 0644 /etc/cron.d/crontab
|
|
||||||
|
# copy cron job supervisor conf file.
|
||||||
|
COPY ./.deploy/docker/cronjob.conf /etc/supervisor/conf.d/cronjob.conf
|
||||||
|
|
||||||
|
# test crons added via crontab
|
||||||
|
RUN echo "0 3 * * * cd /var/www/firefly-iii && php artisan firefly:cron >> /dev/stdout 2>&1" | crontab -
|
||||||
|
|
||||||
# Install PHP exentions.
|
# Install PHP exentions.
|
||||||
RUN docker-php-ext-install -j$(nproc) gd intl tidy zip bcmath pdo_mysql bz2 pdo_pgsql
|
RUN docker-php-ext-install -j$(nproc) gd intl tidy zip bcmath pdo_mysql bz2 pdo_pgsql
|
||||||
|
@@ -24,10 +24,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Console;
|
namespace FireflyIII\Console;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use FireflyIII\Jobs\CreateRecurringTransactions;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File to make sure commands work.
|
* File to make sure commands work.
|
||||||
@@ -52,18 +51,21 @@ class Kernel extends ConsoleKernel
|
|||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule): void
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
$schedule->call(function() {
|
$schedule->call(
|
||||||
echo "\n";
|
function () {
|
||||||
echo '------------';
|
Log::error('Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://firefly-iii.readthedocs.io/en/latest/');
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo wordwrap('Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions here:');
|
echo '------------';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo 'https://firefly-iii.readthedocs.io/en/latest/';
|
echo wordwrap('Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions here:');
|
||||||
echo "\n\n";
|
echo "\n";
|
||||||
echo 'Disable this cron job!';
|
echo 'https://firefly-iii.readthedocs.io/en/latest/';
|
||||||
echo "\n";
|
echo "\n\n";
|
||||||
echo '------------';
|
echo 'Disable this cron job!';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
})->everyMinute();
|
echo '------------';
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
)->everyMinute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user