Skip to content
New issue

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

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

Already on GitHub? # to your account

Shift cron to global service #55

Merged
merged 1 commit into from
Jan 13, 2023
Merged
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 cron-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

if ( ! defined( 'EE_CRON_SCHEDULER' ) ) {
define( 'EE_CRON_SCHEDULER', 'ee-cron-scheduler' );
define( 'EE_CRON_SCHEDULER', 'services_global-cron_1' );
}

$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
Expand Down
8 changes: 1 addition & 7 deletions src/Cron_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ class Cron_Command extends EE_Command {
*/
public function create( $args, $assoc_args ) {

if ( 'running' !== EE_DOCKER::container_status( EE_CRON_SCHEDULER ) ) {
$img_versions = \EE\Utils\get_image_versions();
$cron_scheduler_run_command = 'docker run --name ' . EE_CRON_SCHEDULER . ' --restart=always -d -v ' . EE_ROOT_DIR . '/services/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro easyengine/cron:' . $img_versions['easyengine/cron'];
if ( ! EE_DOCKER::boot_container( EE_CRON_SCHEDULER, $cron_scheduler_run_command ) ) {
EE::error( 'There was some error in starting ' . EE_CRON_SCHEDULER . ' container. Please check logs.' );
}
}
\EE\Service\Utils\init_global_container( GLOBAL_CRON );

EE\Utils\delem_log( 'ee cron add start' );

Expand Down
2 changes: 1 addition & 1 deletion src/helper/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
function update_cron_config() {

$config = generate_cron_config();
file_put_contents( EE_ROOT_DIR . '/services/cron/config.ini', $config );
file_put_contents( EE_SERVICE_DIR . '/cron/conf/config.ini', $config );
\EE_DOCKER::restart_container( EE_CRON_SCHEDULER );
}

Expand Down