OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Commands;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use LaravelZero\Framework\Commands\Command;
  5. use App\Facades\Install;
  6. /**
  7. * Install LetsEncrypt
  8. *
  9. * @author Björn Hase, Tentakelfabrik
  10. * @license http://opensource.org/licenses/MIT The MIT License
  11. * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
  12. *
  13. */
  14. class LetsEncryptInstallCommand extends Command
  15. {
  16. /**
  17. * The signature of the command.
  18. *
  19. * @var string
  20. */
  21. protected $signature = 'lets-encrypt:install';
  22. /**
  23. * The description of the command.
  24. *
  25. * @var string
  26. */
  27. protected $description = 'Install LetsEncrypt for nginx';
  28. /**
  29. * Execute the console command.
  30. *
  31. * @return mixed
  32. */
  33. public function handle()
  34. {
  35. $this->info('LetsEncrypt installing...');
  36. $output = [];
  37. exec('apt update 2>&1', $output);
  38. exec('apt install -y software-properties-common 2>&1', $output);
  39. // @TODO apt add a Warning for no good, in a later version output will be scanned for helpfull infos
  40. $this->line(implode("\n", Install::filterAptMessages($output)));
  41. $output = [];
  42. exec('add-apt-repository -y universe 2>&1', $output);
  43. exec('add-apt-repository -y ppa:certbot/certbot 2>&1', $output);
  44. // @TODO apt add a Warning for no good, in a later version output will be scanned for helpfull infos
  45. $this->line(implode("\n", Install::filterAptMessages($output)));
  46. $output = [];
  47. exec('apt update 2>&1', $output);
  48. exec('apt install -y certbot python3-certbot-nginx 2>&1', $output);
  49. // @TODO apt add a Warning for no good, in a later version output will be scanned for helpfull infos
  50. $this->line(implode("\n", Install::filterAptMessages($output)));
  51. if (Install::isReady('certbot')) {
  52. $this->info('LetsEncrypt installing...Success! \o/');
  53. } else {
  54. $this->error("Failed! Please check log-file!");
  55. }
  56. }
  57. }