varlibmysql resolve

This commit is contained in:
fogelito
2023-08-08 17:06:46 +03:00
parent 71b4c483c2
commit f2a337d86e
2 changed files with 6 additions and 8 deletions
+2 -5
View File
@@ -754,7 +754,6 @@ services:
command: sleep infinity
volumes:
- ./backup-data:/backups:rw
- ./restore-data:/varlibmysql:rw
- appwrite-mariadb:/var/lib/mysql:r
networks:
- appwrite
@@ -773,9 +772,8 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
- appwrite-mariadb:/var/lib/mysql:r
- ./backup-data:/backups:rw
- appwrite-mariadb:/var/lib/mysql:r
depends_on:
- redis
environment:
@@ -797,7 +795,7 @@ services:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
- ./backup-data:/backups:rw
- ./restore-data:/varlibmysql:rw
- appwrite-mariadb:/var/lib/mysql:rw
depends_on:
- redis
environment:
@@ -971,5 +969,4 @@ volumes:
appwrite-functions:
appwrite-builds:
#backup-data:
#restore-data:
# appwrite-chronograf:
+4 -3
View File
@@ -16,6 +16,7 @@ use Utopia\Validator\WhiteList;
class Restore extends Action
{
public const BACKUPS_PATH = '/backups';
public const DATADIR = '/var/lib/mysql';
public const PROCESSORS = 4;
protected ?DSN $dsn = null;
protected string $database;
@@ -30,8 +31,7 @@ class Restore extends Action
->param('id', '', new Text(20), 'The backup identification')
->param('cloud', null, new WhiteList(['true', 'false'], true), 'Download backup from cloud or use local directory')
->param('database', null, new Text(10), 'The Database name for example db_fra1_01')
->param('datadir', null, new Text(100), 'The Path where database would be stored')
->callback(fn ($id, $cloud, $project, $datadir) => $this->action($id, $cloud, $project, $datadir));
->callback(fn ($id, $cloud, $project) => $this->action($id, $cloud, $project));
}
public static function getName(): string
@@ -39,11 +39,12 @@ class Restore extends Action
return 'restore';
}
public function action(string $id, string $cloud, string $database, string $datadir): void
public function action(string $id, string $cloud, string $database): void
{
$this->database = $database;
$this->dsn = $this->getDsn($database);
$this->s3 = new DOSpaces('/' . $database . '/full', App::getEnv('_DO_SPACES_ACCESS_KEY'), App::getEnv('_DO_SPACES_SECRET_KEY'), App::getEnv('_DO_SPACES_BUCKET_NAME'), App::getEnv('_DO_SPACES_REGION'));
$datadir = self::DATADIR;
if (is_null($this->dsn)) {
Console::error('No DSN match');