adminos 1.0.0.pre.rc.2 → 1.0.0.pre.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -3
  3. data/README.md +26 -0
  4. data/adminos.gemspec +2 -2
  5. data/app/inputs/cropp_input.rb +13 -1
  6. data/app/inputs/filter_inputs/boolean_input.rb +18 -0
  7. data/app/inputs/filter_inputs/date_range_input.rb +36 -0
  8. data/app/inputs/filter_inputs/numeric_input.rb +40 -0
  9. data/app/inputs/filter_inputs/string_input.rb +40 -0
  10. data/lib/adminos.rb +23 -3
  11. data/lib/adminos/configuration.rb +9 -0
  12. data/lib/adminos/controllers/filters.rb +20 -0
  13. data/lib/adminos/controllers/resource.rb +18 -11
  14. data/lib/adminos/extensions/simple_form.rb +12 -0
  15. data/lib/adminos/features/search/elastic.rb +46 -0
  16. data/lib/adminos/features/search/pg_search.rb +49 -0
  17. data/lib/adminos/filters/forms.rb +55 -0
  18. data/lib/adminos/form_builder.rb +11 -0
  19. data/lib/adminos/helpers/models/searchable.rb +9 -0
  20. data/lib/adminos/helpers/view.rb +35 -0
  21. data/lib/generators/adminos/adminos_generator.rb +10 -7
  22. data/lib/generators/adminos/feedback_generator.rb +39 -0
  23. data/lib/generators/adminos/i18n_generator.rb +16 -4
  24. data/lib/generators/adminos/install_generator.rb +22 -0
  25. data/lib/generators/adminos/profile_generator.rb +34 -0
  26. data/lib/generators/adminos/search_generator.rb +38 -0
  27. data/lib/generators/adminos/two_factor_auth_generator.rb +81 -0
  28. data/lib/generators/templates/adminos/fields.slim +1 -1
  29. data/lib/generators/templates/adminos/locales/locale_fields.slim +7 -4
  30. data/lib/generators/templates/adminos/locales/model.rb.erb +2 -3
  31. data/lib/generators/templates/ci/.gitlab-ci.yml +1 -1
  32. data/lib/generators/templates/feedback/auto/app/controllers/admin/feedbacks_controller.rb +17 -0
  33. data/lib/generators/templates/feedback/auto/app/controllers/feedbacks_controller.rb +11 -0
  34. data/lib/generators/templates/feedback/auto/app/models/feedback.rb +6 -0
  35. data/lib/generators/templates/feedback/auto/app/views/admin/feedbacks/_fields.slim +5 -0
  36. data/lib/generators/templates/feedback/auto/app/views/admin/feedbacks/index.slim +28 -0
  37. data/lib/generators/templates/feedback/feedbacks_migration.rb +13 -0
  38. data/lib/generators/templates/field/locales/locale_fields.slim +1 -1
  39. data/lib/generators/templates/field/locales/model.rb.erb +2 -3
  40. data/lib/generators/templates/i18n/Gemfile +6 -1
  41. data/lib/generators/templates/i18n/auto/app/validators/locale_validator.rb +5 -1
  42. data/lib/generators/templates/i18n/auto/app/views/admin/base/_pills.slim +1 -5
  43. data/lib/generators/templates/i18n/auto/app/views/admin/pages/_locale_fields.slim +5 -5
  44. data/lib/generators/templates/i18n/auto/config/initializers/mobility.rb +92 -0
  45. data/lib/generators/templates/i18n/page.rb +2 -2
  46. data/lib/generators/templates/install/Gemfile +3 -5
  47. data/lib/generators/templates/install/README.md +22 -0
  48. data/lib/generators/templates/install/auto/Capfile +12 -2
  49. data/lib/generators/templates/install/auto/app/views/admin/base/_form.slim +1 -1
  50. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_collection_header.slim +2 -0
  51. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_new.slim +1 -1
  52. data/lib/generators/templates/install/auto/config/deploy/staging.rb +15 -10
  53. data/lib/generators/templates/install/auto/config/deploy/{shared → templates}/database.yml.erb +1 -1
  54. data/lib/generators/templates/install/auto/config/deploy/templates/nginx_conf.erb +96 -0
  55. data/lib/generators/templates/install/auto/config/deploy/templates/puma.rb.erb +52 -0
  56. data/lib/generators/templates/install/auto/config/environments/staging.rb +1 -1
  57. data/lib/generators/templates/install/auto/config/initializers/adminos.rb +3 -0
  58. data/lib/generators/templates/install/auto/config/locales/adminos.ru.yml +18 -0
  59. data/lib/generators/templates/install/auto/config/schedule.rb +0 -0
  60. data/lib/generators/templates/install/auto/config/systemd/puma.service.erb +19 -0
  61. data/lib/generators/templates/install/auto/config/systemd/sidekiq.service.erb +21 -0
  62. data/lib/generators/templates/install/auto/lib/capistrano/{template.rb → smart_templates.rb} +17 -3
  63. data/lib/generators/templates/install/auto/lib/capistrano/tasks/setup_config.cap +27 -20
  64. data/lib/generators/templates/install/deploy.rb.erb +13 -12
  65. data/lib/generators/templates/profile/auto/app/controllers/admin/profiles_controller.rb +26 -0
  66. data/lib/generators/templates/profile/auto/app/views/admin/profiles/edit.slim +17 -0
  67. data/lib/generators/templates/two_facto_auth/Gemfile +1 -0
  68. data/lib/generators/templates/two_facto_auth/auto/app/controllers/concerns/authenticates_with_two_factor.rb +36 -0
  69. data/lib/generators/templates/two_facto_auth/auto/app/controllers/users/sessions_controller.rb +5 -0
  70. data/lib/generators/templates/two_facto_auth/auto/app/views/admin/profiles/_2fa.slim +24 -0
  71. data/lib/generators/templates/two_facto_auth/auto/app/views/devise/sessions/two_factor.slim +15 -0
  72. data/spec/lib/generators/adminos/feedback_generator_rspec.rb +50 -0
  73. data/spec/lib/generators/adminos/install_generator_rspec.rb +6 -7
  74. data/spec/lib/generators/adminos/profile_generator_rspec.rb +33 -0
  75. data/spec/lib/generators/adminos/search_generator.rb +20 -0
  76. data/spec/lib/generators/adminos/two_factor_auth_generator_rspec.rb +61 -0
  77. data/spec/spec_helper.rb +4 -0
  78. data/spec/support/shared/generator.rb +1 -1
  79. metadata +55 -22
  80. data/bin/rspec +0 -29
  81. data/lib/adminos/extensions/globalize_actiontext.rb +0 -28
  82. data/lib/adminos/extensions/globalize_fields.rb +0 -19
  83. data/lib/generators/templates/adminos/locales/migration.rb.erb +0 -18
  84. data/lib/generators/templates/field/locales/migration.rb.erb +0 -13
  85. data/lib/generators/templates/i18n/add_translation_table_to_page.rb +0 -15
  86. data/lib/generators/templates/i18n/auto/config/initializers/globalize_fields.rb +0 -1
  87. data/lib/generators/templates/install/auto/config/deploy/shared/nginx.conf.erb +0 -28
  88. data/lib/generators/templates/install/auto/config/deploy/shared/unicorn.rb.erb +0 -35
  89. data/lib/generators/templates/install/auto/lib/capistrano/substitute_strings.rb +0 -12
  90. data/package-lock.json +0 -3
@@ -13,7 +13,7 @@
13
13
  = f.input :<%= attribute.name %>
14
14
  <% end -%>
15
15
 
16
- <% unless options.seo? -%>
16
+ <% if options.seo? -%>
17
17
  .f__fieldset
18
18
  .f__legend= t 'labels.admin.legend.seo'
19
19
  = f.input :meta_title
@@ -1,10 +1,13 @@
1
1
  .f__fieldset
2
- = f.input :name<%= "\n = f.input :nav_name" if options.type == 'section' %>
2
+ = f.input :name, locale: locale
3
+ <%= "\n = f.input :nav_name, locale: locale" if options.type == 'section' %>
3
4
  <% attributes.each do |attribute| -%>
4
- <%= " = f.input :#{attribute.name}\n" if attribute.locale -%>
5
+ <%= " = f.input :#{attribute.name}, locale: locale\n" if attribute.locale -%>
5
6
  <% end -%>
6
7
 
8
+ <% if options.seo? -%>
7
9
  .f__fieldset
8
10
  .f__legend= t 'labels.admin.legend.seo'
9
- = f.input :meta_title
10
- = f.input :meta_description, as: :string
11
+ = f.input :meta_title, locale: locale
12
+ = f.input :meta_description, as: :string, locale: locale
13
+ <% end -%>
@@ -1,6 +1,5 @@
1
+ extend Mobility
1
2
 
2
- translates :name, <%= attributes.map{|a| ":#{a.name}, " if a.locale }.compact.join %><%= ':nav_name, ' if options.type == 'section' %>:meta_description, :meta_title
3
-
4
- accepts_nested_attributes_for :translations
3
+ translates :name, <%= attributes.map{|a| ":#{a.name}, " if a.locale }.compact.join %><%= ':nav_name, ' if options.type == 'section' %>:meta_description, :meta_title, locale_accessors: true, ransack: true
5
4
 
6
5
  validates_with LocaleValidator
@@ -4,7 +4,7 @@ variables:
4
4
  before_script:
5
5
  - rvm install $(cat .ruby-version)
6
6
  - rvm use $(cat .ruby-version)
7
- - gem install bundler --no-ri --no-rdoc
7
+ - gem install bundler --no-document
8
8
  - bundle config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config
9
9
  - bin/setup
10
10
 
@@ -0,0 +1,17 @@
1
+ class Admin::FeedbacksController < Admin::BaseController
2
+ authorize_resource
3
+
4
+ resource( Feedback,
5
+ collection_scope: [:sorted],
6
+ location: proc { params[:stay_in_place] ?
7
+ edit_polymorphic_path([:admin, resource]) :
8
+ polymorphic_path([:admin, resource.class]) })
9
+
10
+ private
11
+
12
+ alias_method :collection_orig, :collection
13
+ def collection
14
+ @collection ||= collection_orig
15
+ .page(params[:page]).per(settings.per_page)
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ class FeedbacksController < ApplicationController
2
+ def create
3
+ @feedback = Feedback.create(feedback_params)
4
+ end
5
+
6
+ private
7
+
8
+ def feedback_params
9
+ params.require(:feedback).permit(:name, :phone, :email, :message)
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class Feedback < ActiveRecord::Base
2
+
3
+ scope :sorted, -> { order('created_at DESC') }
4
+
5
+ validates :name, :message, presence: true
6
+ end
@@ -0,0 +1,5 @@
1
+ .f__fieldset
2
+ = f.input :name
3
+ = f.input :email
4
+ = f.input :phone
5
+ = f.input :message
@@ -0,0 +1,28 @@
1
+ - collection_title
2
+ = collection_header
3
+
4
+ - if collection.present?
5
+ - list = capture do
6
+ /= render partial: 'objects', object: collection
7
+ .table-list
8
+ table.table.table-hover.table-sm.table--feedback
9
+ tbody
10
+ - collection.each do |object|
11
+ tr
12
+ td.table__details
13
+ = object.name
14
+ span title="#{resource_class.human_attribute_name(:email)}"= link_to object.email, "mailto:#{object.email}"
15
+ span title="#{resource_class.human_attribute_name(:phone)}"= object.phone
16
+ td.table__text
17
+ = simple_format(object.message)
18
+ td.table-list__controls
19
+ = object_link_edit(object)
20
+ td.table-list__check
21
+ = admin_cb(object)
22
+
23
+ - if controller.respond_to?(:batch_action)
24
+ = batch_actions_tag publication: (collection.respond_to?(:set_each_published_on)),
25
+ nav_publication: (collection.respond_to?(:set_nav_published_on)) do
26
+ = list
27
+ - else
28
+ = list
@@ -0,0 +1,13 @@
1
+ class CreateFeedbacks < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :feedbacks do |t|
4
+ t.string :name
5
+
6
+ t.string :email
7
+ t.string :phone
8
+ t.text :message
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  .f__fieldset
2
2
  <% attributes.select(&:locale).each do |attribute| -%>
3
- <%= " = f.input :#{attribute.name}\n" -%>
3
+ <%= " = f.input :#{attribute.name} locale: locale\n" -%>
4
4
  <% end -%>
@@ -1,6 +1,5 @@
1
+ extend Mobility
1
2
 
2
- translates :name, <%= attributes.map{|a| ":#{a.name}" }.compact.join(', ') %>
3
-
4
- accepts_nested_attributes_for :translations
3
+ translates :name, <%= attributes.map{|a| ":#{a.name}" }.compact.join(', ') %>, locale_accessors: true, ransack: true
5
4
 
6
5
  validates_with LocaleValidator
@@ -1 +1,6 @@
1
- gem 'globalize'
1
+ gem 'mobility'
2
+ gem 'mobility-ransack', '~> 0.2.2'
3
+ gem 'devise-i18n'
4
+ gem 'kaminari-i18n'
5
+ gem 'rails-i18n'
6
+ gem 'tolk'
@@ -13,9 +13,13 @@ class LocaleValidator < ActiveModel::Validator
13
13
 
14
14
  def validations(field, record)
15
15
  validate_name = false
16
+
16
17
  I18n.available_locales.each do |locale|
17
- validate_name = true unless record.translation_for(locale).send(field).blank?
18
+ Mobility.with_locale(locale) do
19
+ validate_name = true unless record.send(field).blank?
20
+ end
18
21
  end
22
+
19
23
  validate_name = true if record.send(field).presence
20
24
 
21
25
  record.errors.add(field, 'Укажите Название хотя бы в одной локали') unless validate_name
@@ -12,8 +12,4 @@ ul.nav.nav-tabs.with-togglable-navigation
12
12
  .tab-content
13
13
  - I18n.available_locales.each_with_index do |locale, i|
14
14
  .tab-pane id="pill_#{locale}" class=('active' if locale == :ru)
15
- - if locale == I18n.default_locale
16
- = render 'locale_fields', locale: locale, f: f
17
- - else
18
- = f.globalize_fields_for locale, wrapper: :admin do |g|
19
- = render 'locale_fields', locale: locale, f: g
15
+ = render 'locale_fields', locale: locale, f: f
@@ -1,13 +1,13 @@
1
1
  .f__fieldset
2
- = f.input :name
3
- = f.input :nav_name
2
+ = f.input :name, locale: locale
3
+ = f.input :nav_name, locale: locale
4
4
 
5
- = f.rich_text_area :content
5
+ = f.rich_text_area "content_#{locale}"
6
6
  / = f.input :body
7
7
  /.kaya-please
8
8
  = f.input_field :body, as: :text, id: 'kaya-editor', value: f.object.read_attribute(:body)
9
9
 
10
10
  .f__fieldset
11
11
  .f__legend= t 'labels.admin.legend.seo'
12
- = f.input :meta_title
13
- = f.input :meta_description, as: :string
12
+ = f.input :meta_title, locale: locale
13
+ = f.input :meta_description, as: :string, locale: locale
@@ -0,0 +1,92 @@
1
+ Mobility.configure do |config|
2
+ # Sets the default backend to use in models. This can be overridden in models
3
+ # by passing +backend: ...+ to +translates+.
4
+ config.default_backend = :jsonb
5
+
6
+ # By default, Mobility uses the +translates+ class method in models to
7
+ # describe translated attributes, but you can configure this method to be
8
+ # whatever you like. This may be useful if using Mobility alongside another
9
+ # translation gem which uses the same method name.
10
+ config.accessor_method = :translates
11
+
12
+ # To query on translated attributes, you need to append a scope to your
13
+ # model. The name of this scope is +i18n+ by default, but this can be changed
14
+ # to something else.
15
+ config.query_method = :i18n
16
+
17
+ # Uncomment and remove (or add) items to (from) this list to completely
18
+ # disable/enable plugins globally (so they cannot be used and are never even
19
+ # loaded). Note that if you remove an item from the list, you will not be
20
+ # able to use the plugin at all, and any options for the plugin will be
21
+ # ignored by models. (In most cases, you probably don't want to change this.)
22
+ #
23
+ # config.plugins = %i[
24
+ # query
25
+ # cache
26
+ # dirty
27
+ # fallbacks
28
+ # presence
29
+ # default
30
+ # attribute_methods
31
+ # fallthrough_accessors
32
+ # locale_accessors
33
+ # ]
34
+
35
+ config.plugins += [:ransack]
36
+
37
+ # The translation cache is on by default, but you can turn it off by
38
+ # uncommenting this line. (This may be helpful in debugging.)
39
+ #
40
+ # config.default_options[:cache] = false
41
+
42
+ # Dirty tracking is disabled by default. Uncomment this line to enable it.
43
+ # If you enable this, you should also enable +locale_accessors+ by default
44
+ # (see below).
45
+ #
46
+ # config.default_options[:dirty] = true
47
+
48
+ # No fallbacks are used by default. To define default fallbacks, uncomment
49
+ # and set the default fallback option value here. A "true" value will use
50
+ # whatever is defined by +I18n.fallbacks+ (if defined), or alternatively will
51
+ # fallback to your +I18n.default_locale+.
52
+ #
53
+ # config.default_options[:fallbacks] = true
54
+
55
+ # The Presence plugin converts empty strings to nil when fetching and setting
56
+ # translations. By default it is on, uncomment this line to turn it off.
57
+ #
58
+ # config.default_options[:presence] = false
59
+
60
+ # Set a default value to use if the translation is nil. By default this is
61
+ # off, uncomment and set a default to use it across all models (you probably
62
+ # don't want to do that).
63
+ #
64
+ # config.default_options[:default] = ...
65
+
66
+ # Uncomment to enable locale_accessors by default on models. A true value
67
+ # will use the locales defined either in
68
+ # Rails.application.config.i18n.available_locales or I18n.available_locales.
69
+ # If you want something else, pass an array of locales instead.
70
+ #
71
+ # config.default_options[:locale_accessors] = true
72
+
73
+ # Uncomment to enable fallthrough accessors by default on models. This will
74
+ # allow you to call any method with a suffix like _en or _pt_br, and Mobility
75
+ # will catch the suffix and convert it into a locale in +method_missing+. If
76
+ # you don't need this kind of open-ended fallthrough behavior, it's better
77
+ # to use locale_accessors instead (which define methods) since method_missing
78
+ # is very slow. (You can use both fallthrough and locale accessor plugins
79
+ # together without conflict.)
80
+ #
81
+ # Note: The dirty plugin enables fallthrough_accessors by default.
82
+ #
83
+ # config.default_options[:fallthrough_accessors] = true
84
+
85
+ # You can also include backend-specific default options. For example, if you
86
+ # want to default to using the text-type translation table with the KeyValue
87
+ # backend, you can set that as a default by uncommenting this line, or change
88
+ # it to :string to default to the string-type translation table instead. (For
89
+ # other backends, this option is ignored.)
90
+ #
91
+ # config.default_options[:type] = :text
92
+ end
@@ -1,5 +1,5 @@
1
- translates :name, :nav_name, :body, :meta_description, :meta_title
1
+ extend Mobility
2
2
 
3
- accepts_nested_attributes_for :translations
3
+ translates :name, :nav_name, :body, :meta_description, :meta_title, locale_accessors: true, ransack: true
4
4
 
5
5
  validates_with LocaleValidator
@@ -10,17 +10,14 @@ gem 'webpacker', '~> 3.5'
10
10
  gem "actiontext", github: "rails/actiontext", require: "action_text", ref: "cfe4674d3637c746cdb3c2b5131e2de498775529"
11
11
  gem "image_processing", "~> 1.2" # for Active Storage variants
12
12
 
13
- group :production, :staging do
14
- gem 'unicorn'
15
- end
16
-
17
13
  group :development do
18
14
  # gem 'spring'
19
15
  gem 'capistrano', require: false
20
16
  gem 'capistrano-bundler', require: false
21
17
  gem 'capistrano-rails', require: false
22
18
  gem 'capistrano-rvm', require: false
23
- gem 'capistrano3-unicorn', require: false
19
+ gem 'capistrano3-puma'
20
+ gem 'capistrano-systemd-multiservice', '~> 0.1.0.beta6', require: false
24
21
 
25
22
  gem 'guard'
26
23
  gem 'guard-livereload', '~> 2.5', require: false
@@ -47,6 +44,7 @@ gem 'paper_trail'
47
44
  gem 'postal-rails', '~> 1.0'
48
45
 
49
46
  gem 'scoped_search'
47
+ gem 'pg_search'
50
48
 
51
49
  gem 'omniauth'
52
50
  gem 'omniauth-facebook'
@@ -0,0 +1,22 @@
1
+
2
+ ## Deployment
3
+
4
+ For painless deployment, you should configure several sudo commands for specified deploy user
5
+ to be executed without asking for password via `sudo visudo` command,
6
+ as described in https://capistranorb.com/documentation/getting-started/authentication-and-authorisation/#authorisation
7
+
8
+ Full list of sudo command could be obtained by running commands mentioned below with `--dry-run` option
9
+ (e. g. `bin/cap --dry-run {stage_name} deploy:setup`
10
+
11
+ 1. Set up new deployment in `config/stages/{stage_name}.rb` file
12
+ 1. Set up new deployment (upload configurations):
13
+
14
+ `bin/cap {stage_name} deploy:setup`
15
+
16
+ 1. Deploy new version to `{stage_name}`:
17
+
18
+ `bin/cap {stage_name} deploy`
19
+
20
+ 2. On new deployment (or when systemd templates updated), update & enable systemd services for Puma & Sidekiq:
21
+
22
+ `bin/cap {stage_name} deploy:setup_systemd`
@@ -3,12 +3,22 @@ require 'capistrano/setup'
3
3
 
4
4
  # Include default deployment tasks
5
5
  require 'capistrano/deploy'
6
+ require 'capistrano/scm/git'
6
7
  require 'capistrano/rvm'
7
8
  require 'capistrano/bundler'
8
9
  require 'capistrano/rails'
9
- require 'capistrano3/unicorn'
10
+ require 'capistrano/puma'
10
11
  require 'capistrano-db-tasks'
12
+ require 'whenever/capistrano'
13
+ require 'capistrano/systemd/multiservice'
11
14
 
15
+ install_plugin Capistrano::SCM::Git
16
+ install_plugin Capistrano::Puma
17
+ install_plugin Capistrano::Puma::Nginx
18
+ install_plugin Capistrano::Systemd::MultiService.new_service('puma')
19
+ # install_plugin Capistrano::Systemd::MultiService.new_service('sidekiq')
20
+
21
+ lib_dir = File.join(__dir__, 'lib')
22
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
12
23
  # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
13
24
  Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
14
- Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
@@ -7,7 +7,7 @@
7
7
 
8
8
  = resource_header
9
9
 
10
- = simple_form_for resource_form_object, wrapper: :admin do |f|
10
+ = adminos_form_for resource_form_object, wrapper: :admin do |f|
11
11
  .f
12
12
  .f__wrapper
13
13
  / Родительский элемент
@@ -2,3 +2,5 @@
2
2
  h1= label
3
3
  - if with_button_new
4
4
  = collection_button_new
5
+ = adminos_filters_form_for filters
6
+
@@ -1 +1 @@
1
- = link_to :new, polymorphic_path( [:admin, object.class], action: :new, parent_id: object.id )
1
+ = link_to :new, polymorphic_path( [:admin, object.class], action: :new, parent_id: object.id ), class: 'icon icon--diff -diff', title: t('labels.admin.add_child')
@@ -1,12 +1,17 @@
1
- server "#{fetch(:application)}.staging.molinos.ru", user: 'deployer', roles: %w(web app db), primary: true
2
- set :deploy_user, :deployer
3
- set :server_name, "#{fetch(:application)}.staging.molinos.ru"
4
- set :app_name, fetch(:application)
5
- set :user_home_dir, "/home/#{fetch(:deploy_user)}"
6
- # set :god_port, PLACEHOLDER
1
+ server "#{fetch(:application)}.staging.molinos.ru", user: 'app', roles: %w(web app db), primary: true
2
+
3
+ set :domain, "#{fetch(:application)}.staging.molinos.ru"
7
4
  set :keep_releases, 5
8
5
  set :rails_env, 'staging'
9
- set :unicorn_env, 'staging'
10
- set :branch, :staging
11
- set :unicorn_worker_processes, 1
12
- set :deploy_to, "#{fetch(:user_home_dir)}/#{fetch(:application)}"
6
+ set :branch, :develop
7
+
8
+ set :user, :app
9
+ set :deploy_to, "/home/#{fetch(:user)}/#{fetch(:application)}"
10
+
11
+ # CentOS
12
+ set :nginx_sites_available_path, "#{fetch(:deploy_to)}/shared"
13
+ set :nginx_sites_enabled_path, '/etc/nginx/conf.d'
14
+
15
+ # Ubuntu
16
+ # set :nginx_sites_available_path, "/etc/nginx/sites-available"
17
+ # set :nginx_sites_enabled_path, "/etc/nginx/sites-enabled"
@@ -5,6 +5,6 @@
5
5
  reconnect: false
6
6
  database: <%= "#{fetch(:application)}_#{fetch(:rails_env)}" %>
7
7
  pool: 5
8
- username: <%= "dbu_#{fetch(:deploy_user)}" %>
8
+ username: <%= "dbu_#{fetch(:user)}" %>
9
9
  password:
10
10
  host: