Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/support laravel 10 #30

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Laravel 5 - 9.x Task Scheduler with Elastic Beanstalk
# Laravel 5 - 10.x Task Scheduler with Elastic Beanstalk

*Ensure one instance in an Elastic Beanstalk environment is running Laravel's Scheduler*

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "foxxmd/laravel-elasticbeanstalk-cron",
"name": "cyber-duck/laravel-elasticbeanstalk-cron",
"description": "Ensure only one Laravel instance is running CRON jobs in an EB environment",
"type": "library",
"license": "MIT",
Expand All @@ -10,8 +10,8 @@
}
],
"require": {
"illuminate/support": "5 - 9",
"illuminate/console": "5 - 9",
"illuminate/support": "5 - 10",
"illuminate/console": "5 - 10",
"aws/aws-sdk-php": "^3.26",
"lstrojny/functional-php": "^1.17"
},
Expand Down
4 changes: 2 additions & 2 deletions src/.platform/hooks/postdeploy/02scheduler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mkdir -p /home/webapp ; chown -R webapp:webapp /home/webapp

# Adds a cron entry that checks for leader selection every 5 minutes
sudo -u webapp bash -c ". /opt/elasticbeanstalk/deployment/envvars ; /usr/bin/php artisan system:start:leaderselection"
sudo -u webapp bash -c "/usr/bin/php artisan system:start:leaderselection"

# Does an initial leader selection check
sudo -u webapp bash -c ". /opt/elasticbeanstalk/deployment/envvars ; /usr/bin/php artisan aws:configure:leader"
sudo -u webapp bash -c "/usr/bin/php artisan aws:configure:leader"
2 changes: 1 addition & 1 deletion src/Console/System/SetupLeaderSelectionCRONCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function handle()
// (this link is for AL1, AL2 need a workaround to get the same envvars file, see .platform folder)
file_put_contents(
'/tmp/crontab.txt',
$output . "*/$interval * * * * . /opt/elasticbeanstalk/deployment/envvars &&" .
$output . "*/$interval * * * * " .
" /usr/bin/php $path aws:configure:leader >> /dev/null 2>&1" . PHP_EOL
);

Expand Down
2 changes: 1 addition & 1 deletion src/Console/System/SetupSchedulerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function handle()
// using opt..envvars makes sure that environmental variables are loaded before we run artisan
// http://georgebohnisch.com/laravel-task-scheduling-working-aws-elastic-beanstalk-cron/
// (this link is for AL1, AL2 need a workaround to get the same envvars file, see .platform folder)
file_put_contents('/tmp/crontab.txt', $output . '* * * * * . /opt/elasticbeanstalk/deployment/envvars && /usr/bin/php ' . $path . ' schedule:run >> /dev/null 2>&1' . PHP_EOL);
file_put_contents('/tmp/crontab.txt', $output . '* * * * * /usr/bin/php ' . $path . ' schedule:run >> /dev/null 2>&1' . PHP_EOL);
echo exec('crontab /tmp/crontab.txt');
}

Expand Down