capistrano-wal-e 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 072ffb56e2a0439ff3f8a3cbf3bec5f0fe3cc538
4
- data.tar.gz: 87624c5ef9dea8021aed4429c76346125fdb7dd0
3
+ metadata.gz: 2457e5c70bd35faba8fe885ee1d227f57154e989
4
+ data.tar.gz: 6e72856c895517d2aeaa074ab3caf5083bc6fb91
5
5
  SHA512:
6
- metadata.gz: 1f32bfb5d69ab0233472947cc3f06b7624278221e65bb19482c58163d5d1c3dd7757f5bd00df870f06db97199c5a45842b34b67cb2db0a870c8d74ac6a129987
7
- data.tar.gz: 52acbe72649fefe9fdab03f09e79203ae72a8e191d07df99fbc5aa88db254cf3e96a6a7500a6c5c8d88e2ceb5a857f4a5263cfb4b98ee209535929775052fa2c
6
+ metadata.gz: 24bba8fc8f1ab253b6a04b62a766f139e67b2a5f079da2354d91ee427cfb07ea2d6fee3bf0115505f66cb6f3abbfc657cbeebc0f9dbd34c74b12be9c9b2aef6b
7
+ data.tar.gz: b1fd3a9d70bbb2d8106fdf2d7fca185565228d0de1870f514a6fa75ea474efaf9ecae1967aefa1c0894dffbe976987f3ffd44412216cef5dcf4fca8d71817c8c
data/README.md CHANGED
@@ -1,41 +1,49 @@
1
- # Capistrano::Wal::E
1
+ # Capistrano::UnicornNginx
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capistrano/wal/e`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Capistrano tasks for automatic and sensible WAL-E configuration
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Goals of this plugin:
6
6
 
7
- ## Installation
7
+ * automatic configuration for setting up WAL-E for continuous backups of
8
+ PostgreSQL.
8
9
 
9
- Add this line to your application's Gemfile:
10
+ Specifics:
10
11
 
11
- ```ruby
12
- gem 'capistrano-wal-e'
13
- ```
14
-
15
- And then execute:
12
+ * generates environment variables for WAL-e
13
+ * sets up cronjobs for base backups and deleting old ones
16
14
 
17
- $ bundle
15
+ Almost all the setup has been done by capistrano. There is just one manual step
16
+ that needs to be done.
18
17
 
19
- Or install it yourself as:
18
+ * Uncomment and modify these lines in your postgresql.conf file under /etc/postgresql/9.3/main/
20
19
 
21
- $ gem install capistrano-wal-e
22
-
23
- ## Usage
20
+ ```
21
+ wal_level = archive
22
+ archive_mode = on
23
+ archive_command = 'envdir /etc/wal-e.d/env /usr/local/bin/wal-e wal-push %p'
24
+ archive_timeout = 60
25
+ ```
24
26
 
25
- TODO: Write usage instructions here
27
+ Then restart postgres: `service postgresql restart`.
26
28
 
27
- ## Development
29
+ * Test by making the first snapshot backup:
30
+ ```
31
+ /usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /var/lib/postgresql/9.3/main
28
32
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+ ```
30
34
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+ `capistrano-wal-e` works only with Capistrano 3!
32
36
 
33
- ## Contributing
37
+ ### Installation
34
38
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capistrano-wal-e. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
+ Add this to `Gemfile`:
36
40
 
41
+ group :development do
42
+ gem 'capistrano', '~> 3.2.1'
43
+ gem 'capistrano-wal-e', '~> 0.1.1'
44
+ end
37
45
 
38
- ## License
46
+ And then:
39
47
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+ $ bundle install
41
49
 
@@ -4,36 +4,41 @@ namespace :load do
4
4
  end
5
5
  end
6
6
 
7
- namespace :wal_e do
8
- task :setup_env do
9
- on roles :db do |role|
10
- sudo 'mkdir -p /etc/wal-e.d/env'
11
- sudo_upload! StringIO.new(fetch(:aws_access_key_id)), '/etc/wal-e.d/env/AWS_ACCESS_KEY_ID'
12
- sudo_upload! StringIO.new(fetch(:aws_secret_access_key)), '/etc/wal-e.d/env/AWS_SECRET_ACCESS_KEY'
13
- sudo_upload! StringIO.new(fetch(:aws_region)), '/etc/wal-e.d/env/AWS_REGION'
14
- sudo_upload! StringIO.new("#{fetch(:wale_s3_prefix)}_#{role}"), '/etc/wal-e.d/env/WALE_S3_PREFIX'
15
- sudo 'chown -R root:postgres /etc/wal-e.d'
7
+ namespace :postgresql do
8
+ namespace :wal_e do
9
+ desc 'Setup the WAL-E environment variables'
10
+ task :setup_env do
11
+ on roles :db do |role|
12
+ sudo 'mkdir -p /etc/wal-e.d/env'
13
+ sudo_upload! StringIO.new(fetch(:aws_access_key_id)), '/etc/wal-e.d/env/AWS_ACCESS_KEY_ID'
14
+ sudo_upload! StringIO.new(fetch(:aws_secret_access_key)), '/etc/wal-e.d/env/AWS_SECRET_ACCESS_KEY'
15
+ sudo_upload! StringIO.new(fetch(:aws_region)), '/etc/wal-e.d/env/AWS_REGION'
16
+ sudo_upload! StringIO.new("#{fetch(:wale_s3_prefix)}_#{role}"), '/etc/wal-e.d/env/WALE_S3_PREFIX'
17
+ sudo 'chown -R root:postgres /etc/wal-e.d'
18
+ end
16
19
  end
17
- end
18
20
 
19
- task :setup_cron do
20
- on roles :db do
21
- cron = <<-EOF.gsub(/^\s+/, '')
21
+ desc 'Setup the WAL-E cron jobs for backup and cleanup'
22
+ task :setup_cron do
23
+ on roles :db do
24
+ cron = <<-EOF.gsub(/^\s+/, '')
22
25
  0 3 * * * /usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /var/lib/postgresql/9.3/main
23
26
  0 5 * * * envdir /etc/wal-e.d/env /usr/local/bin/wal-e delete --confirm retain 5
24
- EOF
25
- sudo_upload! StringIO.new(cron), "#{shared_path}/postgres-cron"
26
- sudo "chown -R root:postgres #{shared_path}/postgres-cron"
27
- sudo "-u postgres crontab #{shared_path}/postgres-cron"
27
+ EOF
28
+ sudo_upload! StringIO.new(cron), "#{shared_path}/postgres-cron"
29
+ sudo "chown -R root:postgres #{shared_path}/postgres-cron"
30
+ sudo "-u postgres crontab #{shared_path}/postgres-cron"
31
+ end
28
32
  end
29
- end
30
33
 
31
- task :setup do
32
- invoke 'wal_e:setup_env'
33
- invoke 'wal_e:setup_cron'
34
+ desc 'Setup WAL-E for continuous PostgreSQL backups'
35
+ task :setup do
36
+ invoke 'postgresql:wal_e:setup_env'
37
+ invoke 'postgresql:wal_e:setup_cron'
38
+ end
34
39
  end
35
40
  end
36
41
 
37
42
  task :setup do
38
- invoke 'wal_e:setup'
43
+ invoke 'postgresql:wal_e:setup'
39
44
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module WalE
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-wal-e
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Stranders