mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge branch 'feat-db-pools' of github.com:appwrite/appwrite into refactor-scheduler
This commit is contained in:
+1
-1
@@ -206,7 +206,7 @@ $cli
|
||||
unset($models[$key]);
|
||||
}
|
||||
}
|
||||
// var_dump($models);
|
||||
|
||||
$arguments = [new App('UTC'), $services, $routes, $models, $keys[$platform], $authCounts[$platform] ?? 0];
|
||||
foreach (['swagger2', 'open-api3'] as $format) {
|
||||
$formatInstance = match ($format) {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
global $cli;
|
||||
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Validator\Integer;
|
||||
use Utopia\Validator\Text;
|
||||
|
||||
$cli
|
||||
->task('volume-sync')
|
||||
->desc('Runs rsync to sync certificates between the storage mount and traefik.')
|
||||
->param('source', null, new Text(255), 'Source path to sync from.', false)
|
||||
->param('destination', null, new Text(255), 'Destination path to sync to.', false)
|
||||
->param('interval', null, new Integer(true), 'Interval to run rsync', false)
|
||||
->action(function ($source, $destination, $interval) {
|
||||
|
||||
Console::title('RSync V1');
|
||||
Console::success(APP_NAME . ' rsync process v1 has started');
|
||||
|
||||
if (!file_exists($source)) {
|
||||
Console::error('Source directory does not exist. Exiting ... ');
|
||||
Console::exit(0);
|
||||
}
|
||||
|
||||
Console::loop(function () use ($interval, $source, $destination) {
|
||||
$time = DateTime::now();
|
||||
|
||||
Console::info("[{$time}] Executing rsync every {$interval} seconds");
|
||||
Console::info("Syncing between $source and $destination");
|
||||
|
||||
if (!file_exists($source)) {
|
||||
Console::error('Source directory does not exist. Skipping ... ');
|
||||
return;
|
||||
}
|
||||
|
||||
$stdin = "";
|
||||
$stdout = "";
|
||||
$stderr = "";
|
||||
|
||||
Console::execute("rsync -av $source $destination", $stdin, $stdout, $stderr);
|
||||
Console::success($stdout);
|
||||
Console::error($stderr);
|
||||
}, $interval);
|
||||
});
|
||||
Reference in New Issue
Block a user