mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
folder backup
This commit is contained in:
@@ -32,7 +32,7 @@ _APP_CONNECTIONS_DB_CONSOLE=db_fra1_01=mariadb://user:password@mariadb:3306/appw
|
||||
_APP_CONNECTIONS_CACHE=redis_fra1_01=redis://redis:6379
|
||||
_APP_CONNECTIONS_QUEUE=redis_fra1_01=redis://redis:6379
|
||||
_APP_CONNECTIONS_PUBSUB=redis_fra1_01=redis://redis:6379
|
||||
_APP_CONNECTIONS_STORAGE=local://localhost
|
||||
_APP_CONNECTIONS_STORAGE=
|
||||
_APP_STORAGE_ANTIVIRUS=disabled
|
||||
_APP_STORAGE_ANTIVIRUS_HOST=clamav
|
||||
_APP_STORAGE_ANTIVIRUS_PORT=3310
|
||||
@@ -66,10 +66,8 @@ _APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000
|
||||
_APP_USAGE_STATS=enabled
|
||||
_APP_USAGE_AGGREGATION_INTERVAL=30
|
||||
_APP_LOGGING_PROVIDER=
|
||||
_APP_LOGGING_CONFIG=
|
||||
_APP_GRAPHQL_MAX_BATCH_SIZE=10
|
||||
_APP_GRAPHQL_MAX_COMPLEXITY=250
|
||||
_APP_GRAPHQL_MAX_DEPTH=3
|
||||
_APP_REGION=default
|
||||
DOCKERHUB_PULL_USERNAME
|
||||
DOCKERHUB_PULL_PASSWORD
|
||||
_APP_BACKUP_HEARTBEAT=
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
- Fix max mimetype size [#4814](https://github.com/appwrite/appwrite/pull/4814)
|
||||
- New usage metrics collection flow [#4770](https://github.com/appwrite/appwrite/pull/4770)
|
||||
- Deprecated influxdb, telegraf containers and removed all of their occurrences from the code.
|
||||
- Removed _APP_INFLUXDB_HOST, _APP_INFLUXDB_PORT, _APP_STATSD_HOST, _APP_STATSD_PORT env variables.
|
||||
- Removed _APP_INFLUXDB_HOST, _APP_INFLUXDB_PORT, _APP_STATSD_HOST, _APP_STATSD_PORT, _APP_USAGE_AGGREGATION_INTERVAL env variables.
|
||||
- Removed usage labels dependency.
|
||||
- Dropped type attribute from stats collection.
|
||||
- Usage metrics are processed via new usage worker.
|
||||
|
||||
@@ -597,6 +597,7 @@ services:
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_CONNECTIONS_STORAGE
|
||||
- _APP_BACKUP_HEARTBEAT
|
||||
|
||||
appwrite-worker-usage:
|
||||
entrypoint: worker-usage
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Appwrite\Platform\Tasks;
|
||||
|
||||
use Utopia\App;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Storage\Device\Local;
|
||||
@@ -28,7 +29,7 @@ class Backup extends Action
|
||||
Console::title('Backup V1');
|
||||
Console::success(APP_NAME . ' backup process v1 has started');
|
||||
|
||||
$jobInitTime = '9:55'; // (hour:minutes)
|
||||
$jobInitTime = '13:10'; // (hour:minutes)
|
||||
$now = new \DateTime();
|
||||
$now->setTimezone(new \DateTimeZone(date_default_timezone_get()));
|
||||
$next = new \DateTime($now->format("Y-m-d $jobInitTime"));
|
||||
@@ -54,7 +55,7 @@ class Backup extends Action
|
||||
|
||||
Console::log('[' . $now->format("Y-m-d H:i:s.v") . '] Delaying for ' . $delay . ' setting loop to [' . $next->format("Y-m-d H:i:s.v") . ']');
|
||||
Console::loop(function () use ($delay, $sleep, $folders, $remote) {
|
||||
|
||||
$success = 0;
|
||||
foreach ($folders as $key => $folder) {
|
||||
$local = new Local($folder);
|
||||
$filename = $key . '-' . date("Y-m-d") . '.tar.gz';
|
||||
@@ -82,6 +83,11 @@ class Backup extends Action
|
||||
}
|
||||
|
||||
$local->transfer($source, $destination, $remote);
|
||||
|
||||
if ($remote->exists($destination)) {
|
||||
$success++;
|
||||
}
|
||||
|
||||
Console::info("Backing up local $source to {$remote->getName()} $destination");
|
||||
/**
|
||||
* Backup folder, long tail cleanup.
|
||||
@@ -99,6 +105,14 @@ class Backup extends Action
|
||||
Console::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* heartbeat url
|
||||
*/
|
||||
$url = App::getEnv('_APP_BACKUP_HEARTBEAT', '');
|
||||
if ($success === count($folders) && $url !== '') {
|
||||
file_get_contents($url);
|
||||
}
|
||||
}, $sleep, $delay);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user