pineapples 0.3.34 → 0.3.345
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pineapples +13 -13
- data/lib/pineapples.rb +3 -1
- data/lib/pineapples/actions.rb +6 -0
- data/lib/pineapples/actions/base/target.rb +41 -91
- data/lib/pineapples/actions/bundle.rb +16 -0
- data/lib/pineapples/actions/chmod.rb +3 -2
- data/lib/pineapples/actions/copy_file.rb +1 -1
- data/lib/pineapples/actions/empty_directory.rb +1 -1
- data/lib/pineapples/actions/gsub_file.rb +5 -3
- data/lib/pineapples/actions/inside.rb +5 -1
- data/lib/pineapples/actions/rails/erb_converters.rb +11 -4
- data/lib/pineapples/actions/rails/new_hash_syntax_converter.rb +36 -0
- data/lib/pineapples/actions/rails/rails.rb +1 -0
- data/lib/pineapples/actions/remove_file.rb +28 -28
- data/lib/pineapples/actions/shell.rb +43 -9
- data/lib/pineapples/app_generator.rb +154 -38
- data/lib/pineapples/helpers.rb +31 -0
- data/lib/pineapples/parser.rb +42 -37
- data/lib/pineapples/setting.rb +155 -155
- data/lib/pineapples/settings.rb +31 -31
- data/lib/pineapples/templates/.example.env.tt +15 -0
- data/lib/pineapples/templates/.gitignore +3 -0
- data/lib/pineapples/templates/.simplecov.tt +11 -0
- data/lib/pineapples/templates/Gemfile.tt +23 -5
- data/lib/pineapples/templates/Procfile +1 -1
- data/lib/pineapples/templates/Procfile.dev.tt +2 -0
- data/lib/pineapples/templates/app/assets/javascripts/libs.js +4 -2
- data/lib/pineapples/templates/app/assets/stylesheets/application.scss +4 -1
- data/lib/pineapples/templates/app/controllers/application_controller.rb.tt +0 -2
- data/lib/pineapples/templates/app/controllers/auth!=devise!/confirmations_controller.rb +11 -0
- data/lib/pineapples/templates/app/controllers/auth!=devise!/passwords_controller.rb.tt +12 -0
- data/lib/pineapples/templates/app/controllers/auth!=devise!/registrations_controller.rb.tt +25 -0
- data/lib/pineapples/templates/app/controllers/auth!=devise!/sessions_controller.rb.tt +59 -0
- data/lib/pineapples/templates/app/models/user!=needs_user_model!.rb.tt +7 -4
- data/lib/pineapples/templates/app/policies!=pundit!/application_policy.rb +49 -0
- data/lib/pineapples/templates/app/presenters/base_presenter.rb.tt +24 -0
- data/lib/pineapples/templates/app/responders/application_responder.rb +9 -0
- data/lib/pineapples/templates/app/services/service.rb +7 -0
- data/lib/pineapples/templates/app/views/common/_footer.html.erb +3 -3
- data/lib/pineapples/templates/app/views/common/_header.html.erb +5 -5
- data/lib/pineapples/templates/app/views/layouts/application.html.erb.tt +0 -1
- data/lib/pineapples/templates/app/views/pages/home.html.erb +0 -1
- data/lib/pineapples/templates/bin/nginx +4 -0
- data/lib/pineapples/templates/bin/rails +1 -0
- data/lib/pineapples/templates/bin/rspec +19 -0
- data/lib/pineapples/templates/bin/setup +111 -21
- data/lib/pineapples/templates/config.ru.tt +3 -0
- data/lib/pineapples/templates/config/application.rb.tt +3 -3
- data/lib/pineapples/templates/config/boot.rb +5 -5
- data/lib/pineapples/templates/config/database.yml.tt +1 -1
- data/lib/pineapples/templates/config/environments/{development.rb → development.rb.tt} +6 -1
- data/lib/pineapples/templates/config/environments/production.rb +1 -1
- data/lib/pineapples/templates/config/environments/test.rb +2 -2
- data/lib/pineapples/templates/config/i18n-tasks.yml +2 -0
- data/lib/pineapples/templates/config/initializers/{carrierwave.rb → carrierwave!=carrierwave!.rb} +22 -22
- data/lib/pineapples/templates/config/initializers/devise!=devise!.rb.tt +262 -0
- data/lib/pineapples/templates/config/initializers/kaminari.rb +10 -0
- data/lib/pineapples/templates/config/initializers/seed_migrations.rb +15 -0
- data/lib/pineapples/templates/config/initializers/simple_form.rb +165 -0
- data/lib/pineapples/templates/config/locales/devise.en.yml +60 -0
- data/lib/pineapples/templates/config/locales/{en.yml → en.yml.tt} +2 -0
- data/lib/pineapples/templates/config/locales/kaminari.en.yml +17 -0
- data/lib/pineapples/templates/config/locales/simple_form.en.yml +31 -0
- data/lib/pineapples/templates/config/nginx.conf.tt +147 -0
- data/lib/pineapples/templates/config/puma/development.rb.tt +27 -0
- data/lib/pineapples/templates/config/{puma.rb → puma/production.rb} +5 -5
- data/lib/pineapples/templates/config/routes.rb.tt +4 -0
- data/lib/pineapples/templates/config/spring.rb +4 -0
- data/lib/pineapples/templates/lib/devise!=devise!/{ajax_failure.rb → ajax_failure!=ajax_login!.rb} +0 -0
- data/lib/pineapples/templates/lib/logging/custom_rack_logger.rb +7 -9
- data/lib/pineapples/templates/lib/logging/custom_request_logger.rb +46 -48
- data/lib/pineapples/templates/lib/tasks/admin!=user_role_field!.rake +18 -19
- data/lib/pineapples/templates/lib/templates/{erb → erb!=erb!}/scaffold/_form.html.erb +0 -0
- data/lib/pineapples/templates/lib/templates/haml!=haml!/scaffold/_form.html.haml +9 -0
- data/lib/pineapples/templates/lib/templates/slim!=slim!/scaffold/_form.html.slim +9 -0
- data/lib/pineapples/templates/spec/i18n_spec.rb +17 -0
- data/lib/pineapples/templates/spec/rails_helper.rb +30 -0
- data/lib/pineapples/templates/spec/spec_helper.rb +44 -0
- data/lib/pineapples/templates/spec/support/capybara.rb +4 -0
- data/lib/pineapples/templates/spec/support/database_cleaner.rb +27 -0
- data/lib/pineapples/templates/spec/support/email_matchers.rb +17 -0
- data/lib/pineapples/templates/spec/support/factory_girl.rb +14 -0
- data/lib/pineapples/templates/spec/support/job_helpers.rb +8 -0
- data/lib/pineapples/templates/spec/support/matchers.rb +10 -0
- data/lib/pineapples/templates/spec/support/rake_tasks.rb +8 -0
- data/lib/pineapples/templates/spec/support/shoulda_matchers.rb +24 -0
- data/lib/pineapples/version.rb +2 -2
- data/pineapples.gemspec +1 -3
- metadata +46 -12
- data/lib/pineapples/app_builder.rb +0 -70
- data/lib/pineapples/build_tasks/root_files.rb +0 -23
- data/lib/pineapples/templates/app/controllers/auth/confirmations_controller.rb +0 -2
@@ -0,0 +1,165 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
# Wrappers are used by the form builder to generate a
|
4
|
+
# complete input. You can remove any component from the
|
5
|
+
# wrapper, change the order or even add your own to the
|
6
|
+
# stack. The options given below are used to wrap the
|
7
|
+
# whole input.
|
8
|
+
config.wrappers :default, class: :input,
|
9
|
+
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
10
|
+
## Extensions enabled by default
|
11
|
+
# Any of these extensions can be disabled for a
|
12
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
13
|
+
# You can make any of these extensions optional by
|
14
|
+
# renaming `b.use` to `b.optional`.
|
15
|
+
|
16
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
17
|
+
# and required attributes
|
18
|
+
b.use :html5
|
19
|
+
|
20
|
+
# Calculates placeholders automatically from I18n
|
21
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
22
|
+
b.use :placeholder
|
23
|
+
|
24
|
+
## Optional extensions
|
25
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
26
|
+
# to the input. If so, they will retrieve the values from the model
|
27
|
+
# if any exists. If you want to enable any of those
|
28
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
29
|
+
|
30
|
+
# Calculates maxlength from length validations for string inputs
|
31
|
+
b.optional :maxlength
|
32
|
+
|
33
|
+
# Calculates pattern from format validations for string inputs
|
34
|
+
b.optional :pattern
|
35
|
+
|
36
|
+
# Calculates min and max from length validations for numeric inputs
|
37
|
+
b.optional :min_max
|
38
|
+
|
39
|
+
# Calculates readonly automatically from readonly attributes
|
40
|
+
b.optional :readonly
|
41
|
+
|
42
|
+
## Inputs
|
43
|
+
b.use :label_input
|
44
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
45
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
46
|
+
|
47
|
+
## full_messages_for
|
48
|
+
# If you want to display the full error message for the attribute, you can
|
49
|
+
# use the component :full_error, like:
|
50
|
+
#
|
51
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
52
|
+
end
|
53
|
+
|
54
|
+
# The default wrapper to be used by the FormBuilder.
|
55
|
+
config.default_wrapper = :default
|
56
|
+
|
57
|
+
# Define the way to render check boxes / radio buttons with labels.
|
58
|
+
# Defaults to :nested for bootstrap config.
|
59
|
+
# inline: input + label
|
60
|
+
# nested: label > input
|
61
|
+
config.boolean_style = :nested
|
62
|
+
|
63
|
+
# Default class for buttons
|
64
|
+
config.button_class = 'btn'
|
65
|
+
|
66
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
67
|
+
# :first lists the first message for each field.
|
68
|
+
# Use :to_sentence to list all errors for each field.
|
69
|
+
# config.error_method = :first
|
70
|
+
|
71
|
+
# Default tag used for error notification helper.
|
72
|
+
config.error_notification_tag = :div
|
73
|
+
|
74
|
+
# CSS class to add for error notification helper.
|
75
|
+
config.error_notification_class = 'error_notification'
|
76
|
+
|
77
|
+
# ID to add for error notification helper.
|
78
|
+
# config.error_notification_id = nil
|
79
|
+
|
80
|
+
# Series of attempts to detect a default label method for collection.
|
81
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
82
|
+
|
83
|
+
# Series of attempts to detect a default value method for collection.
|
84
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
85
|
+
|
86
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
87
|
+
# config.collection_wrapper_tag = nil
|
88
|
+
|
89
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
90
|
+
# config.collection_wrapper_class = nil
|
91
|
+
|
92
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
93
|
+
# defaulting to :span.
|
94
|
+
# config.item_wrapper_tag = :span
|
95
|
+
|
96
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
97
|
+
# config.item_wrapper_class = nil
|
98
|
+
|
99
|
+
# How the label text should be generated altogether with the required text.
|
100
|
+
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
101
|
+
|
102
|
+
# You can define the class to use on all labels. Default is nil.
|
103
|
+
# config.label_class = nil
|
104
|
+
|
105
|
+
# You can define the default class to be used on forms. Can be overriden
|
106
|
+
# with `html: { :class }`. Defaulting to none.
|
107
|
+
# config.default_form_class = nil
|
108
|
+
|
109
|
+
# You can define which elements should obtain additional classes
|
110
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
111
|
+
|
112
|
+
# Whether attributes are required by default (or not). Default is true.
|
113
|
+
# config.required_by_default = true
|
114
|
+
|
115
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
116
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
117
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
118
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
119
|
+
# change this configuration to true.
|
120
|
+
config.browser_validations = false
|
121
|
+
|
122
|
+
# Collection of methods to detect if a file type was given.
|
123
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
124
|
+
|
125
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
126
|
+
# to match as key, and the input type that will be used when the field name
|
127
|
+
# matches the regexp as value.
|
128
|
+
# config.input_mappings = { /count/ => :integer }
|
129
|
+
|
130
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
131
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
132
|
+
# config.wrapper_mappings = { string: :prepend }
|
133
|
+
|
134
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
135
|
+
# override default inputs.
|
136
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
137
|
+
|
138
|
+
# Default priority for time_zone inputs.
|
139
|
+
# config.time_zone_priority = nil
|
140
|
+
|
141
|
+
# Default priority for country inputs.
|
142
|
+
# config.country_priority = nil
|
143
|
+
|
144
|
+
# When false, do not use translations for labels.
|
145
|
+
# config.translate_labels = true
|
146
|
+
|
147
|
+
# Automatically discover new inputs in Rails' autoload path.
|
148
|
+
# config.inputs_discovery = true
|
149
|
+
|
150
|
+
# Cache SimpleForm inputs discovery
|
151
|
+
# config.cache_discovery = !Rails.env.development?
|
152
|
+
|
153
|
+
# Default class for inputs
|
154
|
+
# config.input_class = nil
|
155
|
+
|
156
|
+
# Define the default class of the input wrapper of the boolean input.
|
157
|
+
config.boolean_label_class = 'checkbox'
|
158
|
+
|
159
|
+
# Defines if the default input wrapper class should be included in radio
|
160
|
+
# collection wrappers.
|
161
|
+
# config.include_default_input_wrapper_class = true
|
162
|
+
|
163
|
+
# Defines which i18n scope will be used in Simple Form.
|
164
|
+
# config.i18n_scope = 'simple_form'
|
165
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your email address has been successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid %{authentication_keys} or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account is locked."
|
15
|
+
not_found_in_database: "Invalid %{authentication_keys} or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your email address before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock instructions"
|
26
|
+
omniauth_callbacks:
|
27
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
28
|
+
success: "Successfully authenticated from %{kind} account."
|
29
|
+
passwords:
|
30
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
31
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
32
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
33
|
+
updated: "Your password has been changed successfully. You are now signed in."
|
34
|
+
updated_not_active: "Your password has been changed successfully."
|
35
|
+
registrations:
|
36
|
+
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
37
|
+
signed_up: "Welcome! You have signed up successfully."
|
38
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
39
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
40
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
41
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
42
|
+
updated: "Your account has been updated successfully."
|
43
|
+
sessions:
|
44
|
+
signed_in: "Signed in successfully."
|
45
|
+
signed_out: "Signed out successfully."
|
46
|
+
already_signed_out: "Signed out successfully."
|
47
|
+
unlocks:
|
48
|
+
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
49
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
50
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
51
|
+
errors:
|
52
|
+
messages:
|
53
|
+
already_confirmed: "was already confirmed, please try signing in"
|
54
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
55
|
+
expired: "has expired, please request a new one"
|
56
|
+
not_found: "not found"
|
57
|
+
not_locked: "was not locked"
|
58
|
+
not_saved:
|
59
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
60
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
en:
|
2
|
+
views:
|
3
|
+
pagination:
|
4
|
+
first: "« First"
|
5
|
+
last: "Last »"
|
6
|
+
previous: "‹ Prev"
|
7
|
+
next: "Next ›"
|
8
|
+
truncate: "…"
|
9
|
+
helpers:
|
10
|
+
page_entries_info:
|
11
|
+
one_page:
|
12
|
+
display_entries:
|
13
|
+
zero: "No %{entry_name} found"
|
14
|
+
one: "Displaying <b>1</b> %{entry_name}"
|
15
|
+
other: "Displaying <b>all %{count}</b> %{entry_name}"
|
16
|
+
more_pages:
|
17
|
+
display_entries: "Displaying %{entry_name} <b>%{first} - %{last}</b> of <b>%{total}</b> in total"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
en:
|
2
|
+
simple_form:
|
3
|
+
"yes": 'Yes'
|
4
|
+
"no": 'No'
|
5
|
+
required:
|
6
|
+
text: 'required'
|
7
|
+
mark: '*'
|
8
|
+
# You can uncomment the line below if you need to overwrite the whole required html.
|
9
|
+
# When using html, text and mark won't be used.
|
10
|
+
# html: '<abbr title="required">*</abbr>'
|
11
|
+
error_notification:
|
12
|
+
default_message: "Please review the problems below:"
|
13
|
+
# Examples
|
14
|
+
# labels:
|
15
|
+
# defaults:
|
16
|
+
# password: 'Password'
|
17
|
+
# user:
|
18
|
+
# new:
|
19
|
+
# email: 'E-mail to sign in.'
|
20
|
+
# edit:
|
21
|
+
# email: 'E-mail.'
|
22
|
+
# hints:
|
23
|
+
# defaults:
|
24
|
+
# username: 'User name to sign in.'
|
25
|
+
# password: 'No special characters, please.'
|
26
|
+
# include_blanks:
|
27
|
+
# defaults:
|
28
|
+
# age: 'Rather not say'
|
29
|
+
# prompts:
|
30
|
+
# defaults:
|
31
|
+
# age: 'Select your age'
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# Local gitignored nginx.conf file to run nginx in foreground mode with foreman for development
|
2
|
+
user www-data;
|
3
|
+
worker_processes auto;
|
4
|
+
|
5
|
+
# Don't run nginx in daemon mode since we are using foreman
|
6
|
+
daemon off;
|
7
|
+
master_process on;
|
8
|
+
|
9
|
+
events {
|
10
|
+
worker_connections 8000;
|
11
|
+
multi_accept on;
|
12
|
+
}
|
13
|
+
|
14
|
+
# Maximum open file descriptors per process;
|
15
|
+
# should be > worker_connections.
|
16
|
+
worker_rlimit_nofile 8192;
|
17
|
+
|
18
|
+
http {
|
19
|
+
upstream puma {
|
20
|
+
server unix:///tmp/sockets/<%= app_name %>-puma.sock;
|
21
|
+
}
|
22
|
+
|
23
|
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
24
|
+
'$status $body_bytes_sent "$http_referer" '
|
25
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
26
|
+
access_log <%= app_root %>/log/nginx.access.log main; #buffer=16kb;
|
27
|
+
error_log <%= app_root %>/log/nginx.error.log;
|
28
|
+
|
29
|
+
server {
|
30
|
+
listen [::]:80 default_server deferred;
|
31
|
+
listen 80 default_server deferred;
|
32
|
+
|
33
|
+
server_name <%= app_name %>.local;
|
34
|
+
|
35
|
+
root <%= app_root %>/public;
|
36
|
+
|
37
|
+
charset utf-8;
|
38
|
+
|
39
|
+
location / {
|
40
|
+
proxy_pass http://puma;
|
41
|
+
proxy_set_header Host $host;
|
42
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
43
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
44
|
+
proxy_set_header X-Real-IP $remote_addr;
|
45
|
+
|
46
|
+
# Log bots in separate log
|
47
|
+
if ($http_user_agent ~* (bot|crawl|\+http:)) {
|
48
|
+
access_log /var/log/nginx/$host.bots.log;
|
49
|
+
}
|
50
|
+
|
51
|
+
###
|
52
|
+
# Cross-domain fonts enabled, see http://davidwalsh.name/cdn-fonts
|
53
|
+
#
|
54
|
+
if ($request_filename ~* ^.?/([^/]?)$) {
|
55
|
+
set $filename $1;
|
56
|
+
}
|
57
|
+
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$) {
|
58
|
+
add_header Access-Control-Allow-Origin *;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
###
|
64
|
+
# Basic settings
|
65
|
+
#
|
66
|
+
sendfile on;
|
67
|
+
tcp_nopush on;
|
68
|
+
types_hash_max_size 2048;
|
69
|
+
include /etc/nginx/mime.types;
|
70
|
+
default_type application/octet-stream;
|
71
|
+
|
72
|
+
###
|
73
|
+
# SSL
|
74
|
+
#
|
75
|
+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
76
|
+
ssl_prefer_server_ciphers on;
|
77
|
+
|
78
|
+
###
|
79
|
+
# Timeouts
|
80
|
+
#
|
81
|
+
keepalive_timeout 65;
|
82
|
+
keepalive_requests 100000;
|
83
|
+
client_header_timeout 20;
|
84
|
+
client_body_timeout 20;
|
85
|
+
send_timeout 30;
|
86
|
+
fastcgi_connect_timeout 15;
|
87
|
+
fastcgi_send_timeout 15;
|
88
|
+
fastcgi_read_timeout 10;
|
89
|
+
|
90
|
+
###
|
91
|
+
# Buffers
|
92
|
+
#
|
93
|
+
client_body_buffer_size 128k;
|
94
|
+
client_max_body_size 10m;
|
95
|
+
client_header_buffer_size 1k;
|
96
|
+
large_client_header_buffers 4 4k;
|
97
|
+
output_buffers 1 32k;
|
98
|
+
postpone_output 1460;
|
99
|
+
|
100
|
+
###
|
101
|
+
# SPDY
|
102
|
+
#
|
103
|
+
# Nginx's spdy module is compiled by default from 1.6
|
104
|
+
# SPDY only works on HTTPS connections
|
105
|
+
|
106
|
+
# Inform browser of SPDY availability
|
107
|
+
add_header Alternate-Protocol 443:npn-spdy/3;
|
108
|
+
|
109
|
+
# Adjust connection keepalive for SPDY clients:
|
110
|
+
spdy_keepalive_timeout 300; # up from 180 secs default
|
111
|
+
|
112
|
+
# enable SPDY header compression
|
113
|
+
spdy_headers_comp 6;
|
114
|
+
|
115
|
+
###
|
116
|
+
# Gzip
|
117
|
+
#
|
118
|
+
gzip on;
|
119
|
+
gzip_vary on;
|
120
|
+
|
121
|
+
gzip_comp_level 6;
|
122
|
+
gzip_min_length 512;
|
123
|
+
gzip_buffers 4 8k;
|
124
|
+
gzip_disable "msie6";
|
125
|
+
gzip_proxied expired no-cache no-store private auth;
|
126
|
+
# Compress data even for clients that are connecting to us via proxies,
|
127
|
+
# identified by the "Via" header (required for CloudFront).
|
128
|
+
# gzip_proxied any;
|
129
|
+
gzip_types application/atom+xml
|
130
|
+
application/javascript
|
131
|
+
application/json
|
132
|
+
application/rss+xml
|
133
|
+
application/x-font-ttf
|
134
|
+
application/x-font-opentype
|
135
|
+
application/x-font-truetype
|
136
|
+
application/x-javascript
|
137
|
+
application/xml
|
138
|
+
font/eot
|
139
|
+
font/opentype
|
140
|
+
font/otf
|
141
|
+
image/bmp
|
142
|
+
image/svg+xml
|
143
|
+
image/x-icon
|
144
|
+
text/css
|
145
|
+
text/javascript
|
146
|
+
text/plain;
|
147
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
workers Integer(ENV.fetch('WEB_CONCURRENCY', 1))
|
2
|
+
threads_count = Integer(ENV.fetch('MAX_THREADS', 3))
|
3
|
+
threads(threads_count, threads_count)
|
4
|
+
daemonize false
|
5
|
+
|
6
|
+
# !Important: Puma can't bind to sockets created in VirtualBox shared folders
|
7
|
+
if !Dir.exist?('/tmp/sockets')
|
8
|
+
require 'fileutils'
|
9
|
+
FileUtils.mkdir('/tmp/sockets')
|
10
|
+
end
|
11
|
+
|
12
|
+
bind 'unix:///tmp/sockets/<%= app_name %>-puma.sock'
|
13
|
+
pidfile 'tmp/pids/puma.pid'
|
14
|
+
state_path 'tmp/pids/puma.state'
|
15
|
+
|
16
|
+
preload_app!
|
17
|
+
|
18
|
+
rackup DefaultRackup
|
19
|
+
environment 'development'
|
20
|
+
|
21
|
+
on_worker_boot do
|
22
|
+
# Worker specific setup for Rails 4.1+
|
23
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
24
|
+
ActiveRecord::Base.establish_connection
|
25
|
+
# puts 'Reconnecting Rails.cache'
|
26
|
+
# Rails.cache.reconnect
|
27
|
+
end
|