orats 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5764fae3d75aa46b816aa3267b9f04da946ed458
4
- data.tar.gz: ed8c551ef377131ddf6ee19b28fe231813a5bc6e
3
+ metadata.gz: 7a725f12656a6becdd6ae20faf0c0bda7931155d
4
+ data.tar.gz: 244645b83953ef5e8e86cd384fd3c1af29ff48ea
5
5
  SHA512:
6
- metadata.gz: 72b68d0ca30428c544d59d150057cf9fa987cec678c22a80dee8c90b7a0e3afc730d8e06c84e4b51b888e018110d36502e178ab170965a2d2f83c04b78796d9e
7
- data.tar.gz: 2dd3ab36868fd5334f9ba9059b99d250ec063ee8fc64aa027289f640bfacf00d80027918a93194fafbad2410caf2f9a01860455030e136df14754679f13aa17c
6
+ metadata.gz: 22b712f9ff800cb0e0c38849972df8ef4ae3ed787e504a7a8962be3a726530e35bbf16ede4d65f08c6e0f15749f710e6a903de49e46ae0ec9b46b44c2a0bff44
7
+ data.tar.gz: b25aa0727359cdba80242c209c21811232178ef0f12048924e5967f7397dc3e9b9e921338449541d3332c12dabdcde70d77c0d4f824fcce666e39f5f6b9a625b
data/README.md CHANGED
@@ -112,7 +112,6 @@ All of the changes have git commits to go with them. After generating a project
112
112
  - Keep a sitemap up to date using `sitemap_generator`
113
113
  - Add a `pages` controller with `home` action that has points of interest
114
114
  - **Rake tasks**:
115
- - Daily backups using `backup` and `whenever`
116
115
  - Generate favicons for many devices based off a single source png
117
116
  - **Config**:
118
117
  - Extract a bunch of configuration to environment variables
@@ -247,12 +246,14 @@ You can also view the [orats templates](https://github.com/nickjj/orats/tree/mas
247
246
 
248
247
  Both the `new` and `nuke` commands are dependent on having your postgres and redis login information because they need to connection to those databases to perform various tasks.
249
248
 
250
- There are 5 flags to configure for this:
249
+ There are 7 flags to configure for this:
251
250
 
252
251
  - `--pg-location` (defaults to localhost)
252
+ - `--pg-port` (defaults to 5432)
253
253
  - `--pg-username` (defaults to postgres)
254
254
  - `--pg-password` (defaults to an empty string)
255
255
  - `--redis-location` (defaults to localhost)
256
+ - `--redis-port` (defaults to 6379)
256
257
  - `--redis-password` (defaults to an empty string)
257
258
 
258
259
  For most people you will only need to supply the postgres password but still it's annoying to have to type those flags in every time you create a new app or nuke an app. It's really annoying if you develop inside of linux containers like myself which means the location is not localhost.
data/lib/orats/cli.rb CHANGED
@@ -41,9 +41,11 @@ module Orats
41
41
  end
42
42
 
43
43
  option :pg_location, default: 'localhost', aliases: '-l'
44
+ option :pg_port, default: '5432', aliases: '-o'
44
45
  option :pg_username, default: 'postgres', aliases: '-u'
45
46
  option :pg_password, default: '', aliases: '-p'
46
47
  option :redis_location, default: 'localhost', aliases: '-n'
48
+ option :redis_port, default: '6379', aliases: '-r'
47
49
  option :redis_password, default: '', aliases: '-d'
48
50
  option :template, default: '', aliases: '-t'
49
51
  option :custom, default: '', aliases: '-c'
@@ -56,9 +58,11 @@ module Orats
56
58
  end
57
59
 
58
60
  option :pg_location, default: 'localhost', aliases: '-l'
61
+ option :pg_port, default: '5432', aliases: '-o'
59
62
  option :pg_username, default: 'postgres', aliases: '-u'
60
63
  option :pg_password, default: '', aliases: '-p'
61
64
  option :redis_location, default: 'localhost', aliases: '-n'
65
+ option :redis_port, default: '6379', aliases: '-r'
62
66
  option :redis_password, default: '', aliases: '-d'
63
67
  option :skip_data, type: :boolean, default: false, aliases: '-D'
64
68
  option :rc, default: ''
@@ -40,7 +40,6 @@ module Orats
40
40
  def rails_template_actions
41
41
  gsub_postgres_info
42
42
  gsub_redis_info
43
- gsub_app_path
44
43
  gsub_readme
45
44
 
46
45
  bundle_install
@@ -53,27 +52,34 @@ module Orats
53
52
  end
54
53
 
55
54
  def gsub_postgres_info
56
- task 'Update the postgres connection details'
55
+ task 'Update the DATABASE_URL'
57
56
 
58
- gsub_file "#{@target_path}/.env", "DATABASE_HOST: 'localhost'",
59
- "DATABASE_HOST: '#{@options[:pg_location]}'"
60
- gsub_file "#{@target_path}/.env", ": 'postgres'",
61
- ": '#{@options[:pg_username]}'"
62
- gsub_file "#{@target_path}/.env", ": 'supersecrets'",
63
- ": '#{@options[:pg_password]}'"
57
+ unless @options[:pg_password].empty?
58
+ gsub_file "#{@target_path}/.env", 'db_user',
59
+ "db_user:#{@options[:pg_password]}"
60
+ end
61
+
62
+ gsub_file "#{@target_path}/.env", 'db_location',
63
+ @options[:pg_location]
64
+ gsub_file "#{@target_path}/.env", 'db_port', @options[:pg_port]
65
+ gsub_file "#{@target_path}/.env", 'db_user', @options[:pg_username]
64
66
 
65
- commit 'Update the postgres connection details'
67
+ commit 'Update the DATABASE_URL'
66
68
  end
67
69
 
68
70
  def gsub_redis_info
69
- task 'Update the redis connection details'
71
+ task 'Update the CACHE_URL'
72
+
73
+ unless @options[:redis_password].empty?
74
+ gsub_file "#{@target_path}/.env", '//',
75
+ "//#{@options[:redis_password]}@"
76
+ end
70
77
 
71
- gsub_file "#{@target_path}/.env", "HE_PASSWORD: ''",
72
- "HE_PASSWORD: '#{@options[:redis_password]}'"
73
- gsub_file "#{@target_path}/.env", "CACHE_HOST: 'localhost'",
74
- "CACHE_HOST: '#{@options[:redis_location]}'"
78
+ gsub_file "#{@target_path}/.env", 'cache_location',
79
+ @options[:redis_location]
80
+ gsub_file "#{@target_path}/.env", 'cache_port', @options[:redis_port]
75
81
 
76
- commit 'Update the redis connection details'
82
+ commit 'Update the CACHE_URL'
77
83
  end
78
84
 
79
85
  def gsub_app_path
@@ -102,7 +108,7 @@ module Orats
102
108
 
103
109
  def bundle_binstubs
104
110
  task 'Run bundle binstubs for a few gems'
105
- run_from @target_path, 'bundle binstubs whenever puma sidekiq backup'
111
+ run_from @target_path, 'bundle binstubs whenever puma sidekiq'
106
112
 
107
113
  commit 'Add binstubs for the important gems'
108
114
  end
@@ -59,9 +59,10 @@ module Orats
59
59
 
60
60
  def manually_create_postgres_db
61
61
  database = File.basename(@target_path)
62
+ dev_database = "#{database}_development"
62
63
  test_database = "#{database}_test"
63
64
 
64
- createdb(database)
65
+ createdb(dev_database)
65
66
  createdb(test_database)
66
67
  end
67
68
 
@@ -74,9 +75,10 @@ module Orats
74
75
 
75
76
  def manually_delete_postgres_db(name)
76
77
  database = File.basename(name)
78
+ dev_database = "#{database}_development"
77
79
  test_database = "#{database}_test"
78
80
 
79
- dropdb(database)
81
+ dropdb(dev_database)
80
82
  dropdb(test_database)
81
83
  end
82
84
 
@@ -156,14 +156,8 @@ def update_app_config
156
156
  config.action_mailer.default_options = { from: ENV['ACTION_MAILER_DEFAULT_FROM'] }
157
157
  config.action_mailer.default_url_options = { host: ENV['ACTION_MAILER_HOST'] }
158
158
 
159
- redis_store_options = { host: ENV['CACHE_HOST'],
160
- port: ENV['CACHE_PORT'].to_i,
161
- db: ENV['CACHE_DATABASE'].to_i,
162
- namespace: '#{app_name}::cache'
163
- }
164
-
165
- redis_store_options[:password] = ENV['CACHE_PASSWORD'] if ENV['CACHE_PASSWORD'].present?
166
- config.cache_store = :redis_store, redis_store_options
159
+ config.cache_store = :redis_store, ENV['CACHE_URL'],
160
+ { namespace: '#{app_name}::cache' }
167
161
 
168
162
  # run `bundle exec rake time:zones:all` to get a complete list of valid time zone names
169
163
  config.time_zone = ENV['TIME_ZONE'] unless ENV['TIME_ZONE'] == 'UTC'
@@ -310,14 +304,6 @@ def update_routes
310
304
  commit 'Add a concern for pagination and mount sidekiq'
311
305
  end
312
306
 
313
- def add_backup_lib
314
- task __method__
315
-
316
- orats_to_local 'lib/backup/config.rb'
317
- orats_to_local 'lib/backup/models/backup.rb'
318
- commit 'Add backup library'
319
- end
320
-
321
307
  def add_favicon_task
322
308
  task __method__
323
309
 
@@ -325,14 +311,6 @@ def add_favicon_task
325
311
  commit 'Add a favicon generator task'
326
312
  end
327
313
 
328
- def add_backup_task
329
- task __method__
330
-
331
- orats_to_local 'lib/tasks/orats/backup.rake'
332
- gsub_file 'lib/tasks/orats/backup.rake', 'app_name', app_name
333
- commit 'Add an application backup task'
334
- end
335
-
336
314
  def add_helpers
337
315
  task __method__
338
316
 
@@ -525,8 +503,6 @@ add_staging_environment
525
503
  update_development_environment
526
504
  update_production_environment
527
505
  update_routes
528
- add_backup_lib
529
- add_backup_task
530
506
  add_favicon_task
531
507
  add_helpers
532
508
  add_layout
@@ -1,6 +1,5 @@
1
1
  RAILS_ENV: 'development'
2
2
 
3
- PROJECT_PATH: '/tmp/yourapp'
4
3
  TIME_ZONE: 'Eastern Time (US & Canada)'
5
4
  DEFAULT_LOCALE: 'en'
6
5
 
@@ -24,20 +23,14 @@ ACTION_MAILER_HOST: 'localhost:3000'
24
23
  ACTION_MAILER_DEFAULT_FROM: 'info@app_name.com'
25
24
  ACTION_MAILER_DEFAULT_TO: 'me@app_name.com'
26
25
 
27
- DATABASE_NAME: 'app_name'
28
- DATABASE_HOST: 'localhost'
29
- DATABASE_POOL: 25
30
- DATABASE_TIMEOUT: 5000
31
- DATABASE_USERNAME: 'postgres'
32
- DATABASE_PASSWORD: 'supersecrets'
33
-
34
- CACHE_HOST: 'localhost'
35
- CACHE_PORT: 6379
36
- CACHE_DATABASE: 0
37
- CACHE_PASSWORD: ''
26
+ # your database name will automatically be adjusted for its enviroments:
27
+ # development: app_name_development
28
+ # test: app_name_test
29
+ DATABASE_URL: 'postgresql://db_user@db_location:db_port/app_name?encoding=utf8&pool=5&timeout=5000'
30
+ CACHE_URL: 'redis://cache_location:cache_port/0'
38
31
 
39
32
  PUMA_THREADS_MIN: 0
40
33
  PUMA_THREADS_MAX: 1
41
34
  PUMA_WORKERS: 0
42
35
 
43
- SIDEKIQ_CONCURRENCY: 25
36
+ SIDEKIQ_CONCURRENCY: 5
@@ -17,7 +17,6 @@ gem 'sidekiq', '~> 3.2.1'
17
17
  gem 'sinatra', '>= 1.4.5', require: false
18
18
 
19
19
  gem 'whenever', '~> 0.9.2', require: false
20
- gem 'backup', '~> 4.0.1', require: false
21
20
 
22
21
  gem 'sitemap_generator', '~> 5.0.2'
23
22
  gem 'favicon_maker', '~> 1.3'
@@ -1,3 +1,3 @@
1
- web: puma -C config/puma.rb | grep -v --line-buffered ' 304 -'
1
+ web: puma -C config/puma.rb -p 3000 | grep -v --line-buffered ' 304 -'
2
2
  worker: sidekiq -C config/sidekiq.yml
3
- log: tail -f log/development.log | grep -xv --line-buffered '^[[:space:]]*' | grep -v --line-buffered '/assets/'
3
+ log: tail -f log/development.log | grep -xv --line-buffered '^[[:space:]]*' | grep -v --line-buffered '/assets/'
@@ -20,19 +20,6 @@
20
20
 
21
21
  <hr/>
22
22
 
23
- <h3>Custom rake tasks</h3>
24
- <pre>
25
- <code>
26
- # backup the database to S3 or any other location
27
- bundle exec rake orats:backup
28
-
29
- # generate a new set of favicons to the public directory
30
- bundle exec rake orats:favicons
31
- </code>
32
- </pre>
33
-
34
- <hr/>
35
-
36
23
  <h3>Trying to figure out what to do next?</h3>
37
24
 
38
25
  <p>
@@ -43,16 +30,6 @@
43
30
 
44
31
  <hr/>
45
32
 
46
- <h3>Looking to deploy your application?</h3>
47
-
48
- <p>
49
- Visit the wiki guide
50
- for <%= link_to 'get your application on a server ', 'https://github.com/nickjj/orats/wiki/Get-your-application-on-a-server' %>
51
- .
52
- </p>
53
-
54
- <hr/>
55
-
56
33
  <h3>Want to get rid of the pages controller?</h3>
57
34
 
58
35
  <p>
@@ -78,4 +55,4 @@
78
55
  <div class="col-sm-3">
79
56
  <%= image_tag '/apple-touch-icon-228x228-precomposed.png', size: '228x228', alt: 'A ruby image I found on Google' %>
80
57
  </div>
81
- </div>
58
+ </div>
@@ -1,19 +1,6 @@
1
1
  ---
2
- development: &default
3
- adapter: postgresql
4
- database: <%= ENV['DATABASE_NAME'] %>
5
- host: <%= ENV['DATABASE_HOST'] %>
6
- pool: <%= ENV['DATABASE_POOL'] %>
7
- timeout: <%= ENV['DATABASE_TIMEOUT'] %>
8
- username: <%= ENV['DATABASE_USERNAME'] %>
9
- password: <%= ENV['DATABASE_PASSWORD'] %>
2
+ development:
3
+ url: <%= ENV['DATABASE_URL'].gsub('?', '_development?') %>
10
4
 
11
5
  test:
12
- <<: *default
13
- database: <%= ENV['DATABASE_NAME'] %>_test
14
-
15
- staging:
16
- <<: *default
17
-
18
- production:
19
- <<: *default
6
+ url: <%= ENV['DATABASE_URL'].gsub('?', '_test?') %>
@@ -1,9 +1,5 @@
1
- ENV['CACHE_PASSWORD'].present? ? pass_string = ":#{ENV['CACHE_PASSWORD']}@" : pass_string = ''
2
-
3
- redis_host = "#{pass_string}#{ENV['CACHE_HOST']}"
4
-
5
1
  sidekiq_config = {
6
- url: "redis://#{redis_host}:#{ENV['CACHE_PORT']}/#{ENV['CACHE_DATABASE']}",
2
+ url: ENV['CACHE_URL'],
7
3
  namespace: "ns_app::sidekiq_#{Rails.env}"
8
4
  }
9
5
 
@@ -13,4 +9,4 @@ end
13
9
 
14
10
  Sidekiq.configure_client do |config|
15
11
  config.redis = sidekiq_config
16
- end
12
+ end
@@ -3,13 +3,7 @@ environment ENV['RAILS_ENV']
3
3
  threads ENV['PUMA_THREADS_MIN'].to_i, ENV['PUMA_THREADS_MAX'].to_i
4
4
  workers ENV['PUMA_WORKERS'].to_i
5
5
 
6
- pidfile "#{ENV['PROJECT_PATH']}/tmp/puma.pid"
7
-
8
- if ENV['RAILS_ENV'] == 'production'
9
- bind "unix://#{ENV['PROJECT_PATH']}/tmp/puma.sock"
10
- else
11
- port '3000'
12
- end
6
+ pidfile "tmp/puma.pid"
13
7
 
14
8
  # https://github.com/puma/puma/blob/master/examples/config.rb#L125
15
9
  prune_bundler
@@ -22,4 +16,4 @@ on_worker_boot do
22
16
  config_path = File.expand_path('../database.yml', __FILE__)
23
17
  ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
24
18
  ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || YAML.load_file(config_path)[ENV['RAILS_ENV']])
25
- end
19
+ end
@@ -1,7 +1,3 @@
1
- every 1.day, at: '3:00 am' do
2
- rake 'orats:backup'
3
- end
4
-
5
1
  every 1.day, at: '4:00 am' do
6
2
  rake 'sitemap:refresh'
7
- end
3
+ end
@@ -1,5 +1,5 @@
1
1
  ---
2
- :pidfile: <%= ENV['PROJECT_PATH'] %>/tmp/sidekiq.pid
2
+ :pidfile: 'tmp/sidekiq.pid'
3
3
  :concurrency: <%= ENV['SIDEKIQ_CONCURRENCY'].to_i %>
4
4
  :queues:
5
- - default
5
+ - default
data/lib/orats/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # set the version of this gem
2
2
  module Orats
3
- VERSION = '0.8.0'
3
+ VERSION = '0.8.1'
4
4
  end
data/test/test_helper.rb CHANGED
@@ -12,14 +12,16 @@ module Orats
12
12
 
13
13
  TEST_PATH = ENV['TEST_PATH'] || '/tmp/orats'
14
14
  POSTGRES_LOCATION = ENV['POSTGRES_LOCATION'] || 'localhost'
15
+ POSTGRES_PORT = ENV['POSTGRES_PORT'] || '5432'
15
16
  POSTGRES_USERNAME = ENV['POSTGRES_USERNAME'] || 'postgres'
16
17
  POSTGRES_PASSWORD = ENV['POSTGRES_PASSWORD'] || ''
17
18
  REDIS_LOCATION = ENV['REDIS_LOCATION'] || 'localhost'
19
+ REDIS_PORT = ENV['REDIS_PORT'] || '6379'
18
20
  REDIS_PASSWORD = ENV['REDIS_PASSWORD'] || ''
19
21
 
20
- CREDENTIALS = "-l #{POSTGRES_LOCATION} -u #{POSTGRES_USERNAME} " + \
21
- " -p #{POSTGRES_PASSWORD} " + \
22
- " -n #{REDIS_LOCATION} -d #{REDIS_PASSWORD}"
22
+ CREDENTIALS = "-l #{POSTGRES_LOCATION} -o #{POSTGRES_PORT} " + \
23
+ "-u #{POSTGRES_USERNAME} -p #{POSTGRES_PASSWORD} " + \
24
+ "-n #{REDIS_LOCATION} -r #{REDIS_PORT} -d #{REDIS_PASSWORD}"
23
25
 
24
26
  INCLUDES_PATH = File.absolute_path('../../lib/orats/templates/includes',
25
27
  __FILE__)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Janetakis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -137,9 +137,6 @@ files:
137
137
  - lib/orats/templates/includes/new/rails/config/secrets.yml
138
138
  - lib/orats/templates/includes/new/rails/config/sidekiq.yml
139
139
  - lib/orats/templates/includes/new/rails/config/sitemap.rb
140
- - lib/orats/templates/includes/new/rails/lib/backup/config.rb
141
- - lib/orats/templates/includes/new/rails/lib/backup/models/backup.rb
142
- - lib/orats/templates/includes/new/rails/lib/tasks/orats/backup.rake
143
140
  - lib/orats/templates/includes/new/rails/lib/tasks/orats/favicon.rake
144
141
  - lib/orats/templates/includes/new/rails/public/404.html
145
142
  - lib/orats/templates/includes/new/rails/public/422.html
@@ -1,116 +0,0 @@
1
- ##
2
- # Backup v4.x Configuration
3
- #
4
- # Documentation: http://meskyanichi.github.io/backup
5
- # Issue Tracker: https://github.com/meskyanichi/backup/issues
6
-
7
- # Config Options
8
- #
9
- # The options here may be overridden on the command line, but the result
10
- # will depend on the use of --root-path on the command line.
11
- #
12
- # If --root-path is used on the command line, then all paths set here
13
- # will be overridden. If a path (like --tmp-path) is not given along with
14
- # --root-path, that path will use it's default location _relative to --root-path_.
15
- #
16
- # If --root-path is not used on the command line, a path option (like --tmp-path)
17
- # given on the command line will override the tmp_path set here, but all other
18
- # paths set here will be used.
19
- #
20
- # Note that relative paths given on the command line without --root-path
21
- # are relative to the current directory. The root_path set here only applies
22
- # to relative paths set here.
23
- #
24
- # ---
25
- #
26
- # Sets the root path for all relative paths, including default paths.
27
- # May be an absolute path, or relative to the current working directory.
28
-
29
- root_path 'lib/backup'
30
-
31
- # Sets the path where backups are processed until they're stored.
32
- # This must have enough free space to hold apx. 2 backups.
33
- # May be an absolute path, or relative to the current directory or +root_path+.
34
-
35
- tmp_path '../../tmp'
36
-
37
- # Sets the path where backup stores persistent information.
38
- # When Backup's Cycler is used, small YAML files are stored here.
39
- # May be an absolute path, or relative to the current directory or +root_path+.
40
-
41
- data_path '../../tmp/backup/data'
42
-
43
- # Utilities
44
- #
45
- # If you need to use a utility other than the one Backup detects,
46
- # or a utility can not be found in your $PATH.
47
- #
48
- # Utilities.configure do
49
- # tar '/usr/bin/gnutar'
50
- # redis_cli '/opt/redis/redis-cli'
51
- # end
52
-
53
- # Logging
54
- #
55
- # Logging options may be set on the command line, but certain settings
56
- # may only be configured here.
57
- #
58
- # Logger.configure do
59
- # console.quiet = true # Same as command line: --quiet
60
- # logfile.max_bytes = 2_000_000 # Default: 500_000
61
- # syslog.enabled = true # Same as command line: --syslog
62
- # syslog.ident = 'my_app_backup' # Default: 'backup'
63
- # end
64
- #
65
- # Command line options will override those set here.
66
- # For example, the following would override the example settings above
67
- # to disable syslog and enable console output.
68
- # backup perform --trigger my_backup --no-syslog --no-quiet
69
-
70
- # Component Defaults
71
- #
72
- # Set default options to be applied to components in all models.
73
- # Options set within a model will override those set here.
74
- #
75
- # Storage::S3.defaults do |s3|
76
- # s3.access_key_id = "my_access_key_id"
77
- # s3.secret_access_key = "my_secret_access_key"
78
- # end
79
- #
80
- # Notifier::Mail.defaults do |mail|
81
- # mail.from = 'sender@email.com'
82
- # mail.to = 'receiver@email.com'
83
- # mail.address = 'smtp.gmail.com'
84
- # mail.port = 587
85
- # mail.domain = 'your.host.name'
86
- # mail.user_name = 'sender@email.com'
87
- # mail.password = 'my_password'
88
- # mail.authentication = 'plain'
89
- # mail.encryption = :starttls
90
- # end
91
-
92
- # Preconfigured Models
93
- #
94
- # Create custom models with preconfigured components.
95
- # Components added within the model definition will
96
- # +add to+ the preconfigured components.
97
- #
98
- # preconfigure 'MyModel' do
99
- # archive :user_pictures do |archive|
100
- # archive.add '~/pictures'
101
- # end
102
- #
103
- # notify_by Mail do |mail|
104
- # mail.to = 'admin@email.com'
105
- # end
106
- # end
107
- #
108
- # MyModel.new(:john_smith, 'John Smith Backup') do
109
- # archive :user_music do |archive|
110
- # archive.add '~/music'
111
- # end
112
- #
113
- # notify_by Mail do |mail|
114
- # mail.to = 'john.smith@email.com'
115
- # end
116
- # end
@@ -1,55 +0,0 @@
1
- Model.new(:backup, 'Backup for the current RAILS_ENV') do
2
- split_into_chunks_of 10
3
- compress_with Gzip
4
-
5
- database PostgreSQL do |db|
6
- db.sudo_user = ENV['DATABASE_USERNAME']
7
- # To dump all databases, set `db.name = :all` (or leave blank)
8
- db.name = ENV['DATABASE_NAME']
9
- db.username = ENV['DATABASE_USERNAME']
10
- db.password = ENV['DATABASE_PASSWORD']
11
- db.host = ENV['DATABASE_HOST']
12
- db.port = 5432
13
- db.socket = '/var/run/postgresql'
14
- #db.skip_tables = ['skip', 'these', 'tables']
15
- #db.only_tables = ['only', 'these', 'tables']
16
- end
17
-
18
- # uncomment the block below to archive a specific path
19
- # this may be useful if you have user supplied content
20
-
21
- # archive :app_archive do |archive|
22
- # archive.add File.join(ENV['PROJECT_PATH'], 'public', 'system')
23
- # end
24
-
25
- # uncomment the block below and fill in the required information
26
- # to use S3 to store your backups
27
-
28
- # don't want to use S3? check out the other available options:
29
- # http://meskyanichi.github.io/backup/v4/storages/
30
-
31
- # store_with S3 do |s3|
32
- # s3.access_key_id = ENV['S3_ACCESS_KEY_ID']
33
- # s3.secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
34
- # s3.region = ENV['S3_REGION']
35
- # s3.bucket = 'backup'
36
- # s3.path = "/database/#{ENV['RAILS_ENV']}"
37
- # end
38
-
39
- ENV['SMTP_ENCRYPTION'].empty? ? mail_encryption = 'none' : mail_encryption = ENV['SMTP_ENCRYPTION']
40
-
41
- notify_by Mail do |mail|
42
- mail.on_success = false
43
- #mail.on_warning = true
44
- mail.on_failure = true
45
- mail.from = ENV['ACTION_MAILER_DEFAULT_FROM']
46
- mail.to = ENV['ACTION_MAILER_DEFAULT_TO']
47
- mail.address = ENV['SMTP_ADDRESS']
48
- mail.port = ENV['SMTP_PORT'].to_i
49
- mail.domain = ENV['SMTP_DOMAIN']
50
- mail.user_name = ENV['SMTP_USERNAME']
51
- mail.password = ENV['SMTP_PASSWORD']
52
- mail.authentication = ENV['SMTP_AUTH']
53
- mail.encryption = mail_encryption.to_sym
54
- end
55
- end
@@ -1,18 +0,0 @@
1
- namespace :orats do
2
- desc 'Create a backup of your application for a specific environment'
3
- task :backup do
4
- if File.exist?('.env') && File.file?('.env')
5
- require 'dotenv'
6
- Dotenv.load
7
- source_external_env = ''
8
- else
9
- source_external_env = '. /etc/default/app_name &&'
10
- end
11
-
12
- # hack'ish way to run the backup command with elevated privileges, it won't prompt for a password on the production
13
- # server because passwordless sudo has been enabled if you use the ansible setup provided by orats
14
- system 'sudo whoami'
15
-
16
- system "#{source_external_env} backup perform -t backup -c '#{File.join('lib', 'backup', 'config.rb')}' --log-path='#{File.join('log')}'"
17
- end
18
- end