/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if (!$this->verifyNotInstalled()) {
return -1;
}
$this->clearCaches();
$config = base_path('.env');
if (!file_exists($config)) {
copy(base_path('.env.example'), $config);
Config::set('app.key', 'SomeRandomString');
}
$this->line('');
$this->info('***********************');
$this->info(' Welcome to Deployer ');
$this->info('***********************');
$this->line('');
if (!$this->checkRequirements()) {
return -1;
}
$this->line('Please answer the following questions:');
$this->line('');
$config = ['db' => $this->getDatabaseInformation(), 'app' => $this->getInstallInformation(), 'mail' => $this->getEmailInformation()];
$admin = $this->getAdminInformation();
$config['jwt']['secret'] = $this->generateJWTKey();
$this->writeEnvFile($config);
$this->generateKey();
$this->migrate($this->getLaravel()->environment() === 'local');
$this->repository->updateById($admin, 1);
$this->clearCaches();
$this->optimize();
$this->line('');
$this->info('Success! Deployer is now installed');
$this->line('');
$this->header('Next steps');
$this->line('');
$this->line('Example configuration files can be found in the "examples" directory');
$this->line('');
$this->comment('1. Set up your web server, see either "nginx.conf" or "apache.conf"');
$this->line('');
$this->comment('2. Setup the cronjobs, see "crontab"');
$this->line('');
$this->comment('3. Setup the socket server & queue runner, see "supervisor.conf" for an example commands');
$this->line('');
$this->comment('4. Ensure that "storage" and "public/upload" are writable by the webserver');
$this->line('');
$this->comment('5. Visit ' . $config['app']['url'] . ' and login with the details you provided to get started');
$this->line('');
}