-
Notifications
You must be signed in to change notification settings - Fork 92
Better backend #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
peresvetjke
wants to merge
14
commits into
hardcode-dev:master
Choose a base branch
from
peresvetjke:better-backend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Better backend #134
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e50719e
Install new relic
4a6aed0
Setup local_production
54ced8b
Finish local_production setup
5e9e805
Add webpack lp
55bfc05
Update newrelic config
00ff7e1
Update newrelic config
4be52d3
Try to start skylight logging
c076ee0
Fix logs
1469386
Config prometheus + grafana
e5acba9
Install rails panel and rack-mini-profiler (which is not working)
ce13ba8
Fix rack-mini-profiler config, fix logs for lp
75ae60b
Add caching; add case study with AB tests
c6e5cd8
Fix
cdd78f9
Fix
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
env: | ||
browser: true | ||
node: true | ||
es6: true | ||
extends: 'eslint:recommended' | ||
globals: | ||
Atomics: readonly | ||
SharedArrayBuffer: readonly | ||
parserOptions: | ||
ecmaFeatures: | ||
jsx: true | ||
ecmaVersion: 2018 | ||
sourceType: module | ||
plugins: | ||
- react | ||
rules: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
web: bin/rails s -p 3000 -e lp | ||
webpacker: ./bin/webpack-dev-server | ||
job: bin/rake jobs:work | ||
prometheus_exporter: bundle exec prometheus_exporter |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Оптимизация | ||
|
||
## Кэширование `_single_story.html.erb` в `_main_stories_feed.html.erb` | ||
|
||
Добавление кэширования по стори позволило ускорить загрузку главной страницы почти в 2 раза. | ||
|
||
### AB | ||
|
||
#### before | ||
|
||
Time per request: 212.047 ms | ||
|
||
https://gist.github.com/peresvetjke/22b0076f71bb49000aa3c3f082889d85 | ||
|
||
#### after | ||
|
||
Time per request: 114.685 ms | ||
|
||
https://gist.github.com/peresvetjke/5b0a328f332dda0c43c7d8466f927bde | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# rubocop:disable Metrics/BlockLength | ||
# | ||
def yarn_integrity_enabled? | ||
ENV.fetch("YARN_INTEGRITY_ENABLED", "false") == "true" | ||
end | ||
|
||
Rails.application.configure do | ||
# Verifies that versions and hashed value of the package contents in the project's package.json | ||
config.webpacker.check_yarn_integrity = yarn_integrity_enabled? | ||
|
||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
||
# In the development environment your application's code is reloaded on | ||
# every request. This slows down response time but is perfect for development | ||
# since you don't have to restart the web server when you make code changes. | ||
config.cache_classes = true | ||
|
||
# Do not eager load code on boot. | ||
config.eager_load = true | ||
|
||
# Show full error reports and disable caching. | ||
config.consider_all_requests_local = true | ||
|
||
# Enable/disable caching. By default caching is disabled. | ||
if Rails.root.join("tmp/caching-dev.txt").exist? | ||
config.action_controller.perform_caching = true | ||
|
||
config.cache_store = :memory_store | ||
config.public_file_server.headers = { | ||
"Cache-Control" => "public, max-age=172800" | ||
} | ||
else | ||
config.action_controller.perform_caching = false | ||
|
||
config.cache_store = :null_store | ||
end | ||
|
||
# Don't care if the mailer can't send. | ||
config.action_mailer.raise_delivery_errors = false | ||
|
||
# Print deprecation notices to the Rails logger. | ||
config.active_support.deprecation = :log | ||
|
||
# Raise an error on page load if there are pending migrations. | ||
config.active_record.migration_error = :page_load | ||
|
||
# Debug mode disables concatenation and preprocessing of assets. | ||
# This option may cause significant delays in view rendering with a large | ||
# number of complex assets. | ||
config.assets.debug = false | ||
|
||
# Asset digests allow you to set far-future HTTP expiration dates on all assets, | ||
# yet still be able to expire them through the digest params. | ||
config.assets.digest = false | ||
|
||
# Supress logger output for asset requests. | ||
config.assets.quiet = true | ||
|
||
# Do not fallback to assets pipeline if a precompiled asset is missed. | ||
config.assets.compile = true | ||
|
||
# Adds additional error checking when serving assets at runtime. | ||
# Checks for improperly declared sprockets dependencies. | ||
# Raises helpful error messages. | ||
config.assets.raise_runtime_errors = true | ||
|
||
config.action_mailer.perform_caching = false | ||
|
||
config.app_domain = "localhost:3000" | ||
|
||
config.action_mailer.default_url_options = { host: "localhost:3000" } | ||
config.action_mailer.delivery_method = :smtp | ||
config.action_mailer.perform_deliveries = true | ||
config.action_mailer.default_url_options = { host: config.app_domain } | ||
config.action_mailer.smtp_settings = { | ||
address: "smtp.gmail.com", | ||
port: "587", | ||
enable_starttls_auto: true, | ||
user_name: '<%= ENV["DEVELOPMENT_EMAIL_USERNAME"] %>', | ||
password: '<%= ENV["DEVELOPMENT_EMAIL_PASSWORD"] %>', | ||
authentication: :plain, | ||
domain: "localhost:3000" | ||
} | ||
|
||
config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews" | ||
|
||
# Raises error for missing translations | ||
# config.action_view.raise_on_missing_translations = true | ||
|
||
config.public_file_server.enabled = true | ||
|
||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker | ||
|
||
# Install the Timber.io logger | ||
send_logs_to_timber = ENV["SEND_LOGS_TO_TIMBER"] || "false" # <---- set to false to stop sending dev logs to Timber.io | ||
log_device = send_logs_to_timber == "true" ? Timber::LogDevices::HTTP.new(ENV["TIMBER"]) : STDOUT | ||
logger = Timber::Logger.new(log_device) | ||
logger.level = config.log_level | ||
config.logger = ActiveSupport::TaggedLogging.new(logger) | ||
end | ||
|
||
# rubocop:enable Metrics/BlockLength |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if Rails.env != "test" | ||
require 'prometheus_exporter/middleware' | ||
|
||
# This reports stats per request like HTTP status and timings | ||
Rails.application.middleware.unshift PrometheusExporter::Middleware | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
if %w[development lp].include?(Rails.env) | ||
require "rack-mini-profiler" | ||
|
||
# The initializer was required late, so initialize it manually. | ||
Rack::MiniProfilerRails.initialize!(Rails.application) | ||
Rack::MiniProfiler.config.authorization_mode = :allow_all if Rails.env.lp? | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍