Merge branch 'main' into pr/223
* main: Simplify domain language to just "boot" and unscoped config keys Retain a fixed number of containers when pruning Don't assume rolling back in message Check all hosts before rolling back Ensure Traefik service name is consistent Extend traefik delay by 1 second Include traefik access logs Check if we are still getting a 404 Also dump load balancer logs Dump traefik logs when app not booted Fix missing for apt-get Report on container health after failure Fix the integration test healthcheck Allow percentage-based rolling deployments Move `group_limit` & `group_wait` under `boot` Limit rolling deployment to boot operation Allow performing boot & start operations in groups
This commit is contained in:
@@ -2,11 +2,19 @@ require "active_support/duration"
|
||||
require "active_support/core_ext/numeric/time"
|
||||
|
||||
class Mrsk::Commands::Prune < Mrsk::Commands::Base
|
||||
def images(until_hours: 7.days.in_hours.to_i)
|
||||
docker :image, :prune, "--all", "--force", "--filter", "label=service=#{config.service}", "--filter", "until=#{until_hours}h"
|
||||
def images
|
||||
docker :image, :prune, "--all", "--force", "--filter", "label=service=#{config.service}", "--filter", "dangling=true"
|
||||
end
|
||||
|
||||
def containers(until_hours: 3.days.in_hours.to_i)
|
||||
docker :container, :prune, "--force", "--filter", "label=service=#{config.service}", "--filter", "until=#{until_hours}h"
|
||||
def containers(keep_last: 5)
|
||||
pipe \
|
||||
docker(:ps, "-q", "-a", "--filter", "label=service=#{config.service}", *stopped_containers_filters),
|
||||
"tail -n +#{keep_last + 1}",
|
||||
"while read container_id; do docker rm $container_id; done"
|
||||
end
|
||||
|
||||
private
|
||||
def stopped_containers_filters
|
||||
[ "created", "exited", "dead" ].flat_map { |status| ["--filter", "status=#{status}"] }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user