Merge pull request #7271 from appwrite/feat-7223-install-without-start
Add a flag to install and upgrade commands to not start Appwrite
This commit is contained in:
commit
ef72e08386
2 changed files with 18 additions and 12 deletions
|
@ -8,6 +8,7 @@ use Appwrite\Docker\Env;
|
||||||
use Appwrite\Utopia\View;
|
use Appwrite\Utopia\View;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
use Utopia\Config\Config;
|
use Utopia\Config\Config;
|
||||||
|
use Utopia\Validator\Boolean;
|
||||||
use Utopia\Validator\Text;
|
use Utopia\Validator\Text;
|
||||||
use Utopia\Platform\Action;
|
use Utopia\Platform\Action;
|
||||||
|
|
||||||
|
@ -24,15 +25,16 @@ class Install extends Action
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->desc('Install Appwrite')
|
->desc('Install Appwrite')
|
||||||
->param('httpPort', '', new Text(4), 'Server HTTP port', true)
|
->param('http-port', '', new Text(4), 'Server HTTP port', true)
|
||||||
->param('httpsPort', '', new Text(4), 'Server HTTPS port', true)
|
->param('https-port', '', new Text(4), 'Server HTTPS port', true)
|
||||||
->param('organization', 'appwrite', new Text(0), 'Docker Registry organization', true)
|
->param('organization', 'appwrite', new Text(0), 'Docker Registry organization', true)
|
||||||
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
|
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
|
||||||
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
|
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
|
||||||
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive));
|
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
|
||||||
|
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive): void
|
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void
|
||||||
{
|
{
|
||||||
$config = Config::getParam('variables');
|
$config = Config::getParam('variables');
|
||||||
$defaultHTTPPort = '80';
|
$defaultHTTPPort = '80';
|
||||||
|
@ -220,9 +222,11 @@ class Install extends Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::log("Running \"docker compose up -d --remove-orphans --renew-anon-volumes\"");
|
$exit = 0;
|
||||||
|
if (!$noStart) {
|
||||||
$exit = Console::execute("$env docker compose --project-directory $this->path up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr);
|
Console::log("Running \"docker compose up -d --remove-orphans --renew-anon-volumes\"");
|
||||||
|
$exit = Console::execute("$env docker compose --project-directory $this->path up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr);
|
||||||
|
}
|
||||||
|
|
||||||
if ($exit !== 0) {
|
if ($exit !== 0) {
|
||||||
$message = 'Failed to install Appwrite dockers';
|
$message = 'Failed to install Appwrite dockers';
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Appwrite\Platform\Tasks;
|
namespace Appwrite\Platform\Tasks;
|
||||||
|
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
|
use Utopia\Validator\Boolean;
|
||||||
use Utopia\Validator\Text;
|
use Utopia\Validator\Text;
|
||||||
|
|
||||||
class Upgrade extends Install
|
class Upgrade extends Install
|
||||||
|
@ -16,15 +17,16 @@ class Upgrade extends Install
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->desc('Upgrade Appwrite')
|
->desc('Upgrade Appwrite')
|
||||||
->param('httpPort', '', new Text(4), 'Server HTTP port', true)
|
->param('http-port', '', new Text(4), 'Server HTTP port', true)
|
||||||
->param('httpsPort', '', new Text(4), 'Server HTTPS port', true)
|
->param('https-port', '', new Text(4), 'Server HTTPS port', true)
|
||||||
->param('organization', 'appwrite', new Text(0), 'Docker Registry organization', true)
|
->param('organization', 'appwrite', new Text(0), 'Docker Registry organization', true)
|
||||||
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
|
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
|
||||||
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
|
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
|
||||||
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive));
|
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
|
||||||
|
->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive): void
|
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void
|
||||||
{
|
{
|
||||||
// Check for previous installation
|
// Check for previous installation
|
||||||
$data = @file_get_contents($this->path . '/docker-compose.yml');
|
$data = @file_get_contents($this->path . '/docker-compose.yml');
|
||||||
|
@ -37,6 +39,6 @@ class Upgrade extends Install
|
||||||
Console::log(' └── docker-compose.yml');
|
Console::log(' └── docker-compose.yml');
|
||||||
Console::exit(1);
|
Console::exit(1);
|
||||||
}
|
}
|
||||||
parent::action($httpPort, $httpsPort, $organization, $image, $interactive);
|
parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue