diff --git a/Gemfile b/Gemfile index d780bc3d6..39c39d12e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'http://rubygems.org' -ruby '3.2.4' +ruby '~> 3.2.2' gem 'activerecord-session_store' gem 'bootsnap', require: false @@ -97,6 +97,7 @@ gem 'jsbundling-rails' gem 'tailwindcss-rails', '~> 2.4' gem 'base62' # Used for smart annotations +gem 'datadog' gem 'newrelic_rpm' # Permission helper Gem @@ -120,6 +121,7 @@ group :development, :test do gem 'rubocop', require: false gem 'rubocop-performance' gem 'rubocop-rails' + gem 'ruby-lsp' gem 'timecop' end diff --git a/Gemfile.lock b/Gemfile.lock index d579523ab..97d104449 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -285,7 +285,13 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) + datadog (2.0.0) + debase-ruby_core_source (= 3.3.1) + libdatadog (~> 9.0.0.1.0) + libddwaf (~> 1.14.0.0.0) + msgpack date (3.3.4) + debase-ruby_core_source (3.3.1) debug_inspector (1.1.0) deface (1.9.0) actionview (>= 5.2) @@ -409,6 +415,14 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) + libdatadog (9.0.0.1.0) + libdatadog (9.0.0.1.0-x86_64-linux) + libddwaf (1.14.0.0.0) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-arm64-darwin) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-x86_64-linux) + ffi (~> 1.0) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -890,4 +904,4 @@ RUBY VERSION ruby 3.2.4p170 BUNDLED WITH - 2.4.19 + 2.5.11 diff --git a/config/initializers/datadog.rb b/config/initializers/datadog.rb new file mode 100644 index 000000000..8464af135 --- /dev/null +++ b/config/initializers/datadog.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +if ENV['DD_TRACE_ENABLED'] == 'true' + require 'datadog/auto_instrument' + + Datadog.configure do |config| + config.tracing.enabled = ENV['DD_TRACE_ENABLED'] == 'true' + end +end diff --git a/config/initializers/silencer.rb b/config/initializers/silencer.rb index cccc5657b..b55ac588c 100644 --- a/config/initializers/silencer.rb +++ b/config/initializers/silencer.rb @@ -6,9 +6,8 @@ Rails.application.configure do Silencer::Logger, config.log_tags, silence: [ - # Silence WickedPDF rendering in logs - %r{/projects/[0-9]*/reports/generate.pdf}, - '/api/health' + '/api/health', + '/health' ] ) end diff --git a/config/newrelic.yml b/config/newrelic.yml index d9e0fbf4f..9105bec8e 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -9,6 +9,8 @@ # https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration common: &default_settings + agent_enabled: <%= ENV["NEW_RELIC_AGENT_ENABLED"] == 'true' %> + # Required license key associated with your New Relic account. license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %> diff --git a/config/routes.rb b/config/routes.rb index cd0d9ab73..87c2cf744 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,6 +5,8 @@ Rails.application.routes.draw do post 'access_tokens/revoke', to: 'doorkeeper/access_tokens#revoke' + get 'health', to: 'api/api#health' + # Addons constraints UserSubdomain do diff --git a/lib/active_storage/previewer/libreoffice_previewer.rb b/lib/active_storage/previewer/libreoffice_previewer.rb index d2e989b7e..be9a68f88 100644 --- a/lib/active_storage/previewer/libreoffice_previewer.rb +++ b/lib/active_storage/previewer/libreoffice_previewer.rb @@ -21,12 +21,9 @@ module ActiveStorage Rails.logger.info "Starting preparing document preview for file #{blob.filename.sanitized}..." begin - success = system(libreoffice_path, - '--headless', '--invisible', - '-env:UserInstallation=file:///tmp/scinote-libreoffice', - '--convert-to', 'png', - '--outdir', work_dir, - input.path) + success = system( + libreoffice_path, '--headless', '--invisible', '--convert-to', 'png', '--outdir', work_dir, input.path + ) unless success && File.file?(preview_file) raise StandardError, "There was an error generating document preview, blob id: #{blob.id}"