lib/dokku_installer/postgres.rb in dokku-installer-cli-0.1.0 vs lib/dokku_installer/postgres.rb in dokku-installer-cli-0.1.1
- old
+ new
@@ -15,11 +15,19 @@
end
end
desc "postgres:backups:create", "Create a new PostgreSQL backup"
def postgres_backups_create
- run_command "postgres:backups:create #{app_name}"
+ command = "ssh -t dokku@#{domain} postgres:backups:create #{app_name}"
+ puts "Running #{command}..."
+ result = `#{command}`
+
+ if result.include?("database dumped")
+ puts "Database backup created successfully."
+ else
+ puts "Database backup could not be created."
+ end
end
desc "postgres:backups:disable", "Disable daily PostgreSQL backups"
def postgres_backups_disable
run_command "postgres:backups:disable #{app_name}"
@@ -38,10 +46,12 @@
end
end
desc "postgres:backups:enable", "Enable daily PostgreSQL backups"
def postgres_backups_enable
- run_command "postgres:backups:enable #{app_name}"
+ command = "ssh -t root@#{domain} \"dokku postgres:backups:enable #{app_name} && service cron restart\""
+ puts "Running #{command}..."
+ exec(command)
end
desc "postgres:backups:restore:local <number>", "Restore the numbered PostgreSQL backup locally"
def postgres_backups_restore_local(*args)
# Download the backup file