mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-14 05:06:37 +00:00
Re-merge setup:initialize and regular setup.
This commit is contained in:
parent
963e803924
commit
3d386e529e
|
@ -22,7 +22,6 @@ return function (App\Event\BuildConsoleCommands $event) {
|
||||||
'azuracast:account:reset-password' => Command\Users\ResetPasswordCommand::class,
|
'azuracast:account:reset-password' => Command\Users\ResetPasswordCommand::class,
|
||||||
'azuracast:account:set-administrator' => Command\Users\SetAdministratorCommand::class,
|
'azuracast:account:set-administrator' => Command\Users\SetAdministratorCommand::class,
|
||||||
'azuracast:cache:clear' => Command\ClearCacheCommand::class,
|
'azuracast:cache:clear' => Command\ClearCacheCommand::class,
|
||||||
'azuracast:setup:initialize' => Command\InitializeCommand::class,
|
|
||||||
'azuracast:config:migrate' => Command\MigrateConfigCommand::class,
|
'azuracast:config:migrate' => Command\MigrateConfigCommand::class,
|
||||||
'azuracast:setup:migrate' => Command\MigrateDbCommand::class,
|
'azuracast:setup:migrate' => Command\MigrateDbCommand::class,
|
||||||
'azuracast:setup:fixtures' => Command\SetupFixturesCommand::class,
|
'azuracast:setup:fixtures' => Command\SetupFixturesCommand::class,
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Console\Command;
|
|
||||||
|
|
||||||
use App\Entity;
|
|
||||||
use App\Environment;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
||||||
|
|
||||||
#[AsCommand(
|
|
||||||
name: 'azuracast:setup:initialize',
|
|
||||||
description: 'Ensure key settings are initialized within AzuraCast.',
|
|
||||||
)]
|
|
||||||
final class InitializeCommand extends CommandAbstract
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
||||||
{
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
|
||||||
|
|
||||||
$io->title(__('Initialize AzuraCast'));
|
|
||||||
$io->writeln(__('Initializing essential settings...'));
|
|
||||||
|
|
||||||
$io->listing(
|
|
||||||
[
|
|
||||||
sprintf(
|
|
||||||
__('Environment: %s'),
|
|
||||||
$this->environment->getAppEnvironmentEnum()->getName()
|
|
||||||
),
|
|
||||||
sprintf(
|
|
||||||
__('Installation Method: %s'),
|
|
||||||
$this->environment->isDocker() ? 'Docker' : 'Ansible'
|
|
||||||
),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
$io->section(__('Running Database Migrations'));
|
|
||||||
|
|
||||||
$this->runCommand(
|
|
||||||
$output,
|
|
||||||
'azuracast:setup:migrate'
|
|
||||||
);
|
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
$io->section(__('Generating Database Proxy Classes'));
|
|
||||||
|
|
||||||
$this->runCommand($output, 'orm:generate-proxies');
|
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
$io->section(__('Reload System Data'));
|
|
||||||
|
|
||||||
$this->runCommand($output, 'cache:clear');
|
|
||||||
|
|
||||||
// Ensure default storage locations exist.
|
|
||||||
$this->storageLocationRepo->createDefaultStorageLocations();
|
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
$io->success(
|
|
||||||
[
|
|
||||||
__('AzuraCast is now initialized.'),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,6 +23,7 @@ final class SetupCommand extends CommandAbstract
|
||||||
private readonly Environment $environment,
|
private readonly Environment $environment,
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||||
private readonly AzuraCastCentral $acCentral,
|
private readonly AzuraCastCentral $acCentral,
|
||||||
|
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +32,8 @@ final class SetupCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
$this->addOption('update', null, InputOption::VALUE_NONE)
|
$this->addOption('update', null, InputOption::VALUE_NONE)
|
||||||
->addOption('load-fixtures', null, InputOption::VALUE_NONE)
|
->addOption('load-fixtures', null, InputOption::VALUE_NONE)
|
||||||
->addOption('release', null, InputOption::VALUE_NONE);
|
->addOption('release', null, InputOption::VALUE_NONE)
|
||||||
|
->addOption('init', null, InputOption::VALUE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
@ -40,20 +42,57 @@ final class SetupCommand extends CommandAbstract
|
||||||
|
|
||||||
$update = (bool)$input->getOption('update');
|
$update = (bool)$input->getOption('update');
|
||||||
$loadFixtures = (bool)$input->getOption('load-fixtures');
|
$loadFixtures = (bool)$input->getOption('load-fixtures');
|
||||||
|
$isInit = (bool)$input->getOption('init');
|
||||||
|
|
||||||
$io->title(__('AzuraCast Setup'));
|
if ($isInit) {
|
||||||
$io->writeln(__('Welcome to AzuraCast. Please wait while some key dependencies of AzuraCast are set up...'));
|
$update = true;
|
||||||
|
$loadFixtures = false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->runCommand($output, 'azuracast:setup:initialize');
|
if (!$update && !$this->environment->isProduction()) {
|
||||||
|
$loadFixtures = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($loadFixtures || (!$this->environment->isProduction() && !$update)) {
|
// Header display
|
||||||
|
if ($isInit) {
|
||||||
|
$io->title(__('AzuraCast Initializing...'));
|
||||||
|
} else {
|
||||||
|
$io->title(__('AzuraCast Setup'));
|
||||||
|
$io->writeln(
|
||||||
|
__('Welcome to AzuraCast. Please wait while some key dependencies of AzuraCast are set up...')
|
||||||
|
);
|
||||||
$io->newLine();
|
$io->newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
$io->section(__('Running Database Migrations'));
|
||||||
|
|
||||||
|
$this->runCommand(
|
||||||
|
$output,
|
||||||
|
'azuracast:setup:migrate'
|
||||||
|
);
|
||||||
|
|
||||||
|
$io->newLine();
|
||||||
|
$io->section(__('Generating Database Proxy Classes'));
|
||||||
|
|
||||||
|
$this->runCommand($output, 'orm:generate-proxies');
|
||||||
|
|
||||||
|
$io->newLine();
|
||||||
|
$io->section(__('Reload System Data'));
|
||||||
|
|
||||||
|
$this->runCommand($output, 'cache:clear');
|
||||||
|
|
||||||
|
// Ensure default storage locations exist.
|
||||||
|
$this->storageLocationRepo->createDefaultStorageLocations();
|
||||||
|
|
||||||
|
$io->newLine();
|
||||||
|
|
||||||
|
if ($loadFixtures) {
|
||||||
$io->section(__('Installing Data Fixtures'));
|
$io->section(__('Installing Data Fixtures'));
|
||||||
|
|
||||||
$this->runCommand($output, 'azuracast:setup:fixtures');
|
$this->runCommand($output, 'azuracast:setup:fixtures');
|
||||||
|
$io->newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
$io->section(__('Refreshing All Stations'));
|
$io->section(__('Refreshing All Stations'));
|
||||||
|
|
||||||
$this->runCommand($output, 'azuracast:station-queues:clear');
|
$this->runCommand($output, 'azuracast:station-queues:clear');
|
||||||
|
@ -69,6 +108,10 @@ final class SetupCommand extends CommandAbstract
|
||||||
$restartArgs
|
$restartArgs
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($isInit) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Update system setting logging when updates were last run.
|
// Update system setting logging when updates were last run.
|
||||||
$settings = $this->settingsRepo->readSettings();
|
$settings = $this->settingsRepo->readSettings();
|
||||||
$settings->updateUpdateLastRun();
|
$settings->updateUpdateLastRun();
|
||||||
|
|
|
@ -11,7 +11,7 @@ dockerize -template "/etc/php/${PHP_VERSION}/fpm/05-azuracast.ini.tmpl:/etc/php/
|
||||||
gosu azuracast php /var/azuracast/www/bin/uptime_wait || exit 1
|
gosu azuracast php /var/azuracast/www/bin/uptime_wait || exit 1
|
||||||
|
|
||||||
# Initialize before running FPM
|
# Initialize before running FPM
|
||||||
gosu azuracast azuracast_cli azuracast:setup:initialize || exit 1
|
gosu azuracast azuracast_cli azuracast:setup --init || exit 1
|
||||||
|
|
||||||
# Run initial Acme check
|
# Run initial Acme check
|
||||||
gosu azuracast azuracast_cli azuracast:acme:get-certificate || true
|
gosu azuracast azuracast_cli azuracast:acme:get-certificate || true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user