From 8f28c34f937f3eb9192b66d7fa946cdf81751252 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Sun, 13 Feb 2022 09:39:03 +0100 Subject: [PATCH] Only keep 5 releases in production/staging --- config/deploy/config.example.yml | 2 ++ config/deploy/production.rb | 5 +++++ config/deploy/staging.rb | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/config/deploy/config.example.yml b/config/deploy/config.example.yml index 3dfbe9f..59ec8db 100644 --- a/config/deploy/config.example.yml +++ b/config/deploy/config.example.yml @@ -3,6 +3,7 @@ staging: deploy_to: /var/www/my_app_name + keep_releases: 5 servers: - host: staging.example.com @@ -14,6 +15,7 @@ staging: production: deploy_to: /var/www/my_app_name + keep_releases: 5 servers: - host: www.example.com diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 01568e4..718752f 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -13,6 +13,11 @@ end # Default deploy_to directory is /var/www/my_app_name set :deploy_to, config.fetch("deploy_to") +set :branch, "production" + +if config.has_key?(:keep_releases) + set :keep_releases, config.fetch("keep_releases").to_i +end # role-based syntax # ================== diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 87b75aa..ec380ca 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -16,6 +16,10 @@ end set :deploy_to, config.fetch("deploy_to") set :branch, "staging" +if config.has_key?(:keep_releases) + set :keep_releases, config.fetch("keep_releases").to_i +end + # role-based syntax # ==================