Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Jan 21, 2025
1 parent db176b4 commit 7b9dc42
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 9 deletions.
5 changes: 4 additions & 1 deletion app/Commands/Log/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

/**
Expand Down Expand Up @@ -41,7 +42,9 @@ public function handle(TerminalService $terminal, DockerService $docker_service)
if(empty($service)) return 0;

return $terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'logs',
'--follow',
'--tail=50',
Expand Down
5 changes: 4 additions & 1 deletion app/Commands/Log/LogAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

/**
Expand All @@ -25,7 +26,9 @@ class LogAll extends Command{
public function handle(TerminalService $terminal){

return $terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'logs',
'--follow',
'--tail=50',
Expand Down
5 changes: 4 additions & 1 deletion app/Commands/Pull.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Commands;

use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

class Pull extends Command{
Expand Down Expand Up @@ -32,7 +33,9 @@ public function handle(TerminalService $terminal){
$this->info('Pulling updated images...');

$exit_code = $terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'pull'
]);

Expand Down
9 changes: 7 additions & 2 deletions app/Commands/Rebuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

/**
Expand Down Expand Up @@ -58,13 +59,17 @@ public function handle(TerminalService $terminal, DockerService $docker_service)
$this->info("Rebuilding service: $service_name");

$terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'pull',
$service_name,
]);

$terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'up',
'-d',
'--no-deps',
Expand Down
5 changes: 4 additions & 1 deletion app/Commands/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

/**
Expand Down Expand Up @@ -53,7 +54,9 @@ public function handle(TerminalService $terminal, DockerService $docker_service)
$this->info("Starting shell for container: $service_name");

return $terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'exec',
$service_name,
'/bin/bash',
Expand Down
5 changes: 4 additions & 1 deletion app/Commands/Start.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Exceptions\ContainerException;
use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

class Start extends Command
Expand Down Expand Up @@ -43,7 +44,9 @@ public function handle(DockerService $docker_service, TerminalService $terminal)

$this->task('Starting containers', function () use ($terminal) {
$command = [
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'up',
'-d',
];
Expand Down
5 changes: 4 additions & 1 deletion app/Commands/Stop.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Services\TerminalService;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

class Stop extends Command{
Expand Down Expand Up @@ -33,7 +34,9 @@ public function handle(TerminalService $terminal){
$this->info('Stopping containers...');

$exit_code = $terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'down'
]);

Expand Down
5 changes: 4 additions & 1 deletion app/Traits/ExecutesShellCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Support\Stringable;
use LaravelZero\Framework\Commands\Command;

/**
Expand Down Expand Up @@ -36,7 +37,9 @@ public function handle(DockerService $docker_service, TerminalService $terminal)
$this->info('Log into Shell');

return $terminal->execute([
env('DOCKER_COMPOSE_COMMAND', 'docker compose'),
...((new Stringable(env('DOCKER_COMPOSE_COMMAND', 'docker compose')))
->explode(' ')
->toArray()),
'run',
'--rm',
$target_service,
Expand Down

0 comments on commit 7b9dc42

Please sign in to comment.