From a47c8545c719f3d68db360a1707a514b94f2e958 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 9 Oct 2018 19:39:46 +0900 Subject: [PATCH 01/11] Bump memory_profiler from 0.9.11 to 0.9.12 (#8937) Bumps [memory_profiler](https://github.com/SamSaffron/memory_profiler) from 0.9.11 to 0.9.12. - [Release notes](https://github.com/SamSaffron/memory_profiler/releases) - [Changelog](https://github.com/SamSaffron/memory_profiler/blob/master/CHANGELOG.md) - [Commits](https://github.com/SamSaffron/memory_profiler/compare/v0.9.11...v0.9.12) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b36c81f2f1..a2a420bd21 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -328,7 +328,7 @@ GEM mimemagic (~> 0.3.2) mario-redis-lock (1.2.1) redis (>= 3.0.5) - memory_profiler (0.9.11) + memory_profiler (0.9.12) method_source (0.9.0) microformats (4.0.7) json From d4b7d7596806b73b29f08143734257e04fee82c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 9 Oct 2018 19:59:34 +0900 Subject: [PATCH 02/11] Bump faker from 1.8.7 to 1.9.1 (#8935) Bumps [faker](https://github.com/stympy/faker) from 1.8.7 to 1.9.1. - [Release notes](https://github.com/stympy/faker/releases) - [Changelog](https://github.com/stympy/faker/blob/master/CHANGELOG.md) - [Commits](https://github.com/stympy/faker/compare/v1.8.7...v1.9.1) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 477edf8d66..d6c1c965a5 100644 --- a/Gemfile +++ b/Gemfile @@ -108,7 +108,7 @@ end group :test do gem 'capybara', '~> 3.9' gem 'climate_control', '~> 0.2' - gem 'faker', '~> 1.8' + gem 'faker', '~> 1.9' gem 'microformats', '~> 4.0' gem 'rails-controller-testing', '~> 1.0' gem 'rspec-sidekiq', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index a2a420bd21..549314cb6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -204,7 +204,7 @@ GEM tzinfo excon (0.62.0) fabrication (2.20.1) - faker (1.8.7) + faker (1.9.1) i18n (>= 0.7) faraday (0.15.0) multipart-post (>= 1.2, < 3) @@ -675,7 +675,7 @@ DEPENDENCIES doorkeeper (~> 5.0) dotenv-rails (~> 2.2, < 2.3) fabrication (~> 2.20) - faker (~> 1.8) + faker (~> 1.9) fast_blank (~> 1.0) fastimage fog-core (~> 2.1) From 7f9dd92a27e937e3cbc42c1e3c8b844c3583c92b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 9 Oct 2018 19:35:14 +0200 Subject: [PATCH 03/11] Track historical space stats in PgHero to determine PostgreSQL growth (#8906) --- app/workers/scheduler/pghero_scheduler.rb | 11 +++++++++++ config/sidekiq.yml | 3 +++ .../20181007025445_create_pghero_space_stats.rb | 13 +++++++++++++ db/schema.rb | 11 ++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 app/workers/scheduler/pghero_scheduler.rb create mode 100644 db/migrate/20181007025445_create_pghero_space_stats.rb diff --git a/app/workers/scheduler/pghero_scheduler.rb b/app/workers/scheduler/pghero_scheduler.rb new file mode 100644 index 0000000000..4453bf2cd0 --- /dev/null +++ b/app/workers/scheduler/pghero_scheduler.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class Scheduler::PgheroScheduler + include Sidekiq::Worker + + sidekiq_options unique: :until_executed, retry: 0 + + def perform + PgHero.capture_space_stats + end +end diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 6a09bb6e9a..c44af5b6c5 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -33,3 +33,6 @@ backup_cleanup_scheduler: cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *' class: Scheduler::BackupCleanupScheduler + pghero_scheduler: + cron: '0 0 * * *' + class: Scheduler::PgheroScheduler diff --git a/db/migrate/20181007025445_create_pghero_space_stats.rb b/db/migrate/20181007025445_create_pghero_space_stats.rb new file mode 100644 index 0000000000..6198a6f846 --- /dev/null +++ b/db/migrate/20181007025445_create_pghero_space_stats.rb @@ -0,0 +1,13 @@ +class CreatePgheroSpaceStats < ActiveRecord::Migration[5.2] + def change + create_table :pghero_space_stats do |t| + t.text :database + t.text :schema + t.text :relation + t.integer :size, limit: 8 + t.timestamp :captured_at + end + + add_index :pghero_space_stats, [:database, :captured_at] + end +end diff --git a/db/schema.rb b/db/schema.rb index 1458bd70fa..bf6ab4e68c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_09_29_222014) do +ActiveRecord::Schema.define(version: 2018_10_07_025445) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -372,6 +372,15 @@ ActiveRecord::Schema.define(version: 2018_09_29_222014) do t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end + create_table "pghero_space_stats", force: :cascade do |t| + t.text "database" + t.text "schema" + t.text "relation" + t.bigint "size" + t.datetime "captured_at" + t.index ["database", "captured_at"], name: "index_pghero_space_stats_on_database_and_captured_at" + end + create_table "preview_cards", force: :cascade do |t| t.string "url", default: "", null: false t.string "title", default: "", null: false From e50cb5f4bd83339049f51dd2e9673be873f16539 Mon Sep 17 00:00:00 2001 From: mayaeh Date: Wed, 10 Oct 2018 02:36:13 +0900 Subject: [PATCH 04/11] Fix that the copy button of verify link did not work. (#8938) --- app/javascript/packs/public.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 22a8643d9c..11dc1bafc5 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -184,7 +184,7 @@ function main() { }); delegate(document, '.input-copy button', 'click', ({ target }) => { - const input = target.parentNode.querySelector('input'); + const input = target.parentNode.querySelector('.input-copy__wrapper input'); input.focus(); input.select(); From 076ceffa846671f05e05ec1fa065470de0bd3dc1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 9 Oct 2018 19:43:05 +0200 Subject: [PATCH 05/11] Bump dotenv-rails from 2.2.2 to 2.5.0 (#8934) Bumps [dotenv-rails](https://github.com/bkeepers/dotenv) from 2.2.2 to 2.5.0. - [Release notes](https://github.com/bkeepers/dotenv/releases) - [Changelog](https://github.com/bkeepers/dotenv/blob/master/Changelog.md) - [Commits](https://github.com/bkeepers/dotenv/compare/v2.2.2...v2.5.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index d6c1c965a5..28712b147d 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'hamlit-rails', '~> 0.2' gem 'pg', '~> 1.1' gem 'makara', '~> 0.4' gem 'pghero', '~> 2.2' -gem 'dotenv-rails', '~> 2.2', '< 2.3' +gem 'dotenv-rails', '~> 2.5' gem 'aws-sdk-s3', '~> 1.21', require: false gem 'fog-core', '~> 2.1' diff --git a/Gemfile.lock b/Gemfile.lock index 549314cb6f..2b05c5a60f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,9 +184,9 @@ GEM unf (>= 0.0.5, < 1.0.0) doorkeeper (5.0.0) railties (>= 4.2) - dotenv (2.2.2) - dotenv-rails (2.2.2) - dotenv (= 2.2.2) + dotenv (2.5.0) + dotenv-rails (2.5.0) + dotenv (= 2.5.0) railties (>= 3.2, < 6.0) elasticsearch (6.0.2) elasticsearch-api (= 6.0.2) @@ -673,7 +673,7 @@ DEPENDENCIES devise-two-factor (~> 3.0) devise_pam_authenticatable2 (~> 9.2) doorkeeper (~> 5.0) - dotenv-rails (~> 2.2, < 2.3) + dotenv-rails (~> 2.5) fabrication (~> 2.20) faker (~> 1.9) fast_blank (~> 1.0) From 46e4a759bbe0e78fdbb4c1573a404bd4b531315a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 9 Oct 2018 19:43:26 +0200 Subject: [PATCH 06/11] Bump capistrano-rails from 1.3.1 to 1.4.0 (#8936) Bumps [capistrano-rails](https://github.com/capistrano/rails) from 1.3.1 to 1.4.0. - [Release notes](https://github.com/capistrano/rails/releases) - [Changelog](https://github.com/capistrano/rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/capistrano/rails/compare/v1.3.1...v1.4.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 28712b147d..fe84966466 100644 --- a/Gemfile +++ b/Gemfile @@ -132,7 +132,7 @@ group :development do gem 'scss_lint', '~> 0.57', require: false gem 'capistrano', '~> 3.11' - gem 'capistrano-rails', '~> 1.3' + gem 'capistrano-rails', '~> 1.4' gem 'capistrano-rbenv', '~> 2.1' gem 'capistrano-yarn', '~> 2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 2b05c5a60f..08d5666a43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,7 +118,7 @@ GEM capistrano-bundler (1.3.0) capistrano (~> 3.1) sshkit (~> 1.2) - capistrano-rails (1.3.1) + capistrano-rails (1.4.0) capistrano (~> 3.1) capistrano-bundler (~> 1.1) capistrano-rbenv (2.1.4) @@ -660,7 +660,7 @@ DEPENDENCIES bullet (~> 5.7) bundler-audit (~> 0.6) capistrano (~> 3.11) - capistrano-rails (~> 1.3) + capistrano-rails (~> 1.4) capistrano-rbenv (~> 2.1) capistrano-yarn (~> 2.0) capybara (~> 3.9) From da7705b2746b36ccbe093d404d3f4c83a9b5e13e Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 10 Oct 2018 01:31:10 +0200 Subject: [PATCH 07/11] Add dns-prefetch if using different host for assets or uploads (#8942) --- app/helpers/application_helper.rb | 16 ++++++++++++++++ app/views/layouts/application.html.haml | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f8e2c0e112..8533b398a4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -81,4 +81,20 @@ module ApplicationHelper output << 'rtl' if locale_direction == 'rtl' output.reject(&:blank?).join(' ') end + + def cdn_host + ENV['CDN_HOST'].presence + end + + def cdn_host? + cdn_host.present? + end + + def storage_host + ENV['S3_ALIAS_HOST'].presence || ENV['S3_CLOUDFRONT_HOST'].presence + end + + def storage_host? + storage_host.present? + end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4368642376..3d63dc0f35 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -3,6 +3,13 @@ %head %meta{ charset: 'utf-8' }/ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }/ + + - if cdn_host? + %link{ rel: 'dns-prefetch', href: cdn_host }/ + + - if storage_host? + %link{ rel: 'dns-prefetch', href: storage_host }/ + %link{ rel: 'icon', href: favicon_path, type: 'image/x-icon' }/ %link{ rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }/ %link{ rel: 'mask-icon', href: '/mask-icon.svg', color: '#2B90D9' }/ From 2459da29c2e117c43c142bc386c2f4baf613cdc9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 10 Oct 2018 02:21:30 +0200 Subject: [PATCH 08/11] Add description meta tag additionally to og:description (#8941) Fix #8685 --- app/views/accounts/_og.html.haml | 6 +++++- app/views/shared/_og.html.haml | 6 +++++- app/views/stream_entries/_og_description.html.haml | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/views/accounts/_og.html.haml b/app/views/accounts/_og.html.haml index a583b39c2c..de948ec6ab 100644 --- a/app/views/accounts/_og.html.haml +++ b/app/views/accounts/_og.html.haml @@ -1,7 +1,11 @@ +- description = account_description(account) + +%meta{ name: 'description', content: description }/ + = opengraph 'og:url', url = opengraph 'og:site_name', site_title = opengraph 'og:title', yield(:page_title).strip -= opengraph 'og:description', account_description(account) += opengraph 'og:description', description = opengraph 'og:image', full_asset_url(account.avatar.url(:original)) = opengraph 'og:image:width', '120' = opengraph 'og:image:height', '120' diff --git a/app/views/shared/_og.html.haml b/app/views/shared/_og.html.haml index 76db511cd8..802d8c41d4 100644 --- a/app/views/shared/_og.html.haml +++ b/app/views/shared/_og.html.haml @@ -1,9 +1,13 @@ - thumbnail = @instance_presenter.thumbnail +- description = strip_tags(@instance_presenter.site_short_description.presence || @instance_presenter.site_description.presence || t('about.about_mastodon_html')) + +%meta{ name: 'description', content: description }/ + = opengraph 'og:site_name', t('about.hosted_on', domain: site_hostname) = opengraph 'og:url', url_for(only_path: false) = opengraph 'og:type', 'website' = opengraph 'og:title', @instance_presenter.site_title -= opengraph 'og:description', strip_tags(@instance_presenter.site_short_description.presence || @instance_presenter.site_description.presence || t('about.about_mastodon_html')) += opengraph 'og:description', description = opengraph 'og:image', full_asset_url(thumbnail&.file&.url || asset_pack_path('preview.jpg', protocol: :request)) = opengraph 'og:image:width', thumbnail ? thumbnail.meta['width'] : '1200' = opengraph 'og:image:height', thumbnail ? thumbnail.meta['height'] : '630' diff --git a/app/views/stream_entries/_og_description.html.haml b/app/views/stream_entries/_og_description.html.haml index 3d122b94ef..a7b18424d2 100644 --- a/app/views/stream_entries/_og_description.html.haml +++ b/app/views/stream_entries/_og_description.html.haml @@ -1 +1,4 @@ -= opengraph 'og:description', status_description(activity) +- description = status_description(activity) + +%meta{ name: 'description', content: description }/ += opengraph 'og:description', description From 47d7381d60e17034284a6b6ee18bd2c34d3827e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 10 Oct 2018 22:09:23 +0900 Subject: [PATCH 09/11] Bump scss_lint from 0.57.0 to 0.57.1 (#8948) Bumps [scss_lint](https://github.com/brigade/scss-lint) from 0.57.0 to 0.57.1. - [Release notes](https://github.com/brigade/scss-lint/releases) - [Changelog](https://github.com/brigade/scss-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/brigade/scss-lint/compare/v0.57.0...v0.57.1) Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 08d5666a43..88da50f6fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -537,14 +537,14 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.4.4) nokogumbo (~> 1.4) - sass (3.5.6) + sass (3.6.0) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - scss_lint (0.57.0) + scss_lint (0.57.1) rake (>= 0.9, < 13) - sass (~> 3.5.5) + sass (~> 3.5, >= 3.5.5) sidekiq (5.2.2) connection_pool (~> 2.2, >= 2.2.2) rack-protection (>= 1.5.0) From 070f817177c0412c440d1373f08254c2d6c478e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 10 Oct 2018 22:09:53 +0900 Subject: [PATCH 10/11] Bump bullet from 5.7.5 to 5.7.6 (#8947) Bumps [bullet](https://github.com/flyerhzm/bullet) from 5.7.5 to 5.7.6. - [Release notes](https://github.com/flyerhzm/bullet/releases) - [Changelog](https://github.com/flyerhzm/bullet/blob/master/CHANGELOG.md) - [Commits](https://github.com/flyerhzm/bullet/compare/5.7.5...5.7.6) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 88da50f6fb..4f4247ecb8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -103,7 +103,7 @@ GEM brakeman (4.3.1) browser (2.5.3) builder (3.2.3) - bullet (5.7.5) + bullet (5.7.6) activesupport (>= 3.0.0) uniform_notifier (~> 1.11.0) bundler-audit (0.6.0) From ac7df62a0441b95ec04fd9111a9394795dd53ff2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 10 Oct 2018 19:36:41 +0200 Subject: [PATCH 11/11] Bump better_errors from 2.4.0 to 2.5.0 (#8946) Bumps [better_errors](https://github.com/BetterErrors/better_errors) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/BetterErrors/better_errors/releases) - [Changelog](https://github.com/BetterErrors/better_errors/blob/master/CHANGELOG.md) - [Commits](https://github.com/BetterErrors/better_errors/compare/v2.4.0...v2.5.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index fe84966466..9cee35e4a5 100644 --- a/Gemfile +++ b/Gemfile @@ -120,7 +120,7 @@ end group :development do gem 'active_record_query_trace', '~> 1.5' gem 'annotate', '~> 2.7' - gem 'better_errors', '~> 2.4' + gem 'better_errors', '~> 2.5' gem 'binding_of_caller', '~> 0.7' gem 'bullet', '~> 5.7' gem 'letter_opener', '~> 1.4' diff --git a/Gemfile.lock b/Gemfile.lock index 4f4247ecb8..8e016adc8b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,7 +92,7 @@ GEM aws-sigv4 (1.0.3) bcrypt (3.1.12) benchmark-ips (2.7.2) - better_errors (2.4.0) + better_errors (2.5.0) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) @@ -652,7 +652,7 @@ DEPENDENCIES addressable (~> 2.5) annotate (~> 2.7) aws-sdk-s3 (~> 1.21) - better_errors (~> 2.4) + better_errors (~> 2.5) binding_of_caller (~> 0.7) bootsnap (~> 1.3) brakeman (~> 4.3)