Skip to content

Instantly share code, notes, and snippets.

@allomov
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allomov/d0033ef822133e9afad7 to your computer and use it in GitHub Desktop.
Save allomov/d0033ef822133e9afad7 to your computer and use it in GitHub Desktop.
Shows how to prevent DEA from removing containers from crashed apps.

DANGER: this should be done in the test DEA installation.

🚫 this script/changes will remove all Warden containers from your DEA

diff --git a/lib/container/container.rb b/lib/container/container.rb
index b7efde8..1ff5c4f 100644
--- a/lib/container/container.rb
+++ b/lib/container/container.rb
@@ -102,7 +102,7 @@ class Container
def destroy!
with_em do
begin
- call_with_retry(:app, ::Warden::Protocol::DestroyRequest.new(handle: handle))
+ # call_with_retry(:app, ::Warden::Protocol::DestroyRequest.new(handle: handle))
rescue ::EM::Warden::Client::Error => error
logger.warn("Error destroying container: #{error.message}")
end
diff --git a/lib/dea/starting/instance_registry.rb b/lib/dea/starting/instance_registry.rb
index 4ae5418..0aa97c2 100644
--- a/lib/dea/starting/instance_registry.rb
+++ b/lib/dea/starting/instance_registry.rb
@@ -28,10 +28,10 @@ module Dea
def start_reaper
EM.add_periodic_timer(CRASHES_REAPER_INTERVAL_SECS) do
- reap_orphaned_crashes
- reap_crashes
- reap_crashes_under_disk_pressure
- reap_stopping
+ # reap_orphaned_crashes
+ # reap_crashes
+ # reap_crashes_under_disk_pressure
+ # reap_stopping
end
end
diff --git a/lib/dea/task.rb b/lib/dea/task.rb
index fcb7629..d4a93ad 100644
--- a/lib/dea/task.rb
+++ b/lib/dea/task.rb
@@ -65,7 +65,7 @@ module Dea
request = ::Warden::Protocol::DestroyRequest.new(handle: container.handle)
begin
- container.call_with_retry(:app, request)
+ # container.call_with_retry(:app, request)
rescue ::EM::Warden::Client::Error => error
logger.warn("task.destroy.failed", error: error, backtrace: error.backtrace)
end
sudo apt-get update
sudo apt-get install git
vi ~/leave-crashed-apps.diff # put diff data there
# go to DEA package and patch it
cd /var/vcap/jobs/dea_next/packages/dea_next
sudo git init
sudo echo "go" > .gitignore
sudo git add --all
sudo git commit -m "initial state of DEA code"
sudo git apply ~/leave-crashed-apps.diff
# restart DAE
sudo /var/vcap/bosh/bin/monit -I restart dea_next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment