Sha256: 0c6b0bcea8d77115f81e95318aad5b1a0c89621577d73927efdc3dac86f78eb5
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
# frozen_string_literal: true module Neptuno module Docker # Stop docker containers for Neptuno project class Down < Neptuno::CLI::Base desc 'Docker: Stop docker containers for current project' option :all, type: :boolean, default: false, desc: 'Run on all services' option :volumes, type: :boolean, default: false, desc: 'Remove named volumes' argument :services, type: :array, required: false, desc: 'Optional list of services' def call(services: [], **options) command_services_to('go down', all: options.fetch(:all), services_as_args: services) do |services| services_to_stop = services.intersection(services_with_procs).intersection(running_services) make_service_files(services_to_stop) system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(' ')}") system("cd #{neptuno_path} && docker compose rm -f #{services.join(' ')}") system("cd #{neptuno_path} && docker compose down -v #{services.join(' ')}") if options.fetch(:volumes) if config.fetch('procfile_manager') == 'tmux' services_to_stop.each do |service| system("tmux kill-session -t #{service} 2>/dev/null ") puts "Neptuno killed Tmux session for: #{service}" if `echo $TMUX`.strip.empty? end else system("cd #{neptuno_path} && tmux kill-session -t neptuno") if options.fetch(:all) services_to_stop.each do system("cd #{neptuno_path}/procfiles/#{service} && rm .overmind.sock > /dev/null 2>&1") end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
neptuno-1.4.10 | lib/neptuno/docker/down.rb |