From dec1557ef74d919d4393565f22cb97d6a77465f4 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 24 Jul 2023 09:56:34 -0700 Subject: [PATCH 1/4] move sidekiq dashboard name to standardized "jobs", make accessible within tenants --- app/models/user.rb | 4 ++++ config/routes.rb | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index ed7165aa..d38d9efc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,6 +36,10 @@ def to_s email end + def is_admin + has_role? :admin + end + def is_superadmin has_role? :superadmin end diff --git a/config/routes.rb b/config/routes.rb index f08a9431..757c8620 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,12 +6,12 @@ concern :iiif_search, BlacklightIiifSearch::Routes.new concern :oai_provider, BlacklightOaiProvider::Routes.new - + mount Hyrax::IiifAv::Engine, at: '/' mount Riiif::Engine => 'images', as: :riiif if Hyrax.config.iiif_image_server? - authenticate :user, lambda { |u| u.is_superadmin } do - mount Sidekiq::Web => '/sidekiq' + authenticate :user, lambda { |u| u.is_superadmin || u.is_admin } do + mount Sidekiq::Web => '/jobs' end if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_MULTITENANT', false)) From e8fe6b4e45c5ad611ec2a327fd60b1dcf05ca3e3 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 24 Jul 2023 10:09:49 -0700 Subject: [PATCH 2/4] more complete admin check --- app/models/user.rb | 2 +- docker-compose.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index d38d9efc..7a106bbf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -37,7 +37,7 @@ def to_s end def is_admin - has_role? :admin + has_role? :admin || has_role? :admin, Site.instance end def is_superadmin diff --git a/docker-compose.yml b/docker-compose.yml index af73aec2..2577999a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -134,6 +134,9 @@ services: web: <<: *app + # Uncomment command to access container with out starting Rails. Useful for debugging + # command: sleep infinity + # command: sh -l -c "bundle && bundle exec rails s -b 0.0.0.0" environment: - VIRTUAL_PORT=3000 - VIRTUAL_HOST=.hyku.test From 4d36f443b59778383e198002b8f091e6f6f2b15e Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 24 Jul 2023 10:16:20 -0700 Subject: [PATCH 3/4] better user syntax --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 7a106bbf..769d0fef 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -37,7 +37,7 @@ def to_s end def is_admin - has_role? :admin || has_role? :admin, Site.instance + has_role?(:admin) || has_role?(:admin, Site.instance) end def is_superadmin From 3de43aeb82025d10d4848c84557ba0e209e34d69 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 10 Aug 2023 15:29:10 -0700 Subject: [PATCH 4/4] prod email for hyku --- config/environments/production.rb | 1 + config/initializers/mailboxer.rb | 2 +- ops/production-deploy.tmpl.yaml | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 311b9696..eea9afea 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -61,6 +61,7 @@ config.active_job.queue_adapter = ENV.fetch('HYRAX_ACTIVE_JOB_QUEUE', 'sidekiq') # config.active_job.queue_name_prefix = "hyku_#{Rails.env}" + config.action_mailer.default_options = { from: ENV.fetch('HYKU_CONTACT_EMAIL', 'changeme@example.com') } if ENV['SMTP_ENABLED'].present? && ENV['SMTP_ENABLED'].to_s == 'true' config.action_mailer.smtp_settings = { user_name: ENV['SMTP_USER_NAME'], diff --git a/config/initializers/mailboxer.rb b/config/initializers/mailboxer.rb index 39bcf7b7..823d1a7c 100644 --- a/config/initializers/mailboxer.rb +++ b/config/initializers/mailboxer.rb @@ -4,7 +4,7 @@ config.uses_emails = true #Configures the default from for emails sent for Messages and Notifications - config.default_from = "no-reply@mailboxer.com" + config.default_from = ENV.fetch('HYKU_CONTACT_EMAIL', 'changeme@example.com') #Configures the methods needed by mailboxer config.email_method = :mailboxer_email diff --git a/ops/production-deploy.tmpl.yaml b/ops/production-deploy.tmpl.yaml index 597a035e..04a2f3d5 100644 --- a/ops/production-deploy.tmpl.yaml +++ b/ops/production-deploy.tmpl.yaml @@ -111,7 +111,7 @@ extraEnvVars: &envVars - name: HYKU_BULKRAX_ENABLED value: 'true' - name: HYKU_CONTACT_EMAIL - value: dev-oops@scientist.com + value: noreply@atlamail.org - name: HYKU_DEFAULT_HOST value: "%{tenant}.ir.atla.com" - name: HYKU_FILE_ACL @@ -151,13 +151,13 @@ extraEnvVars: &envVars - name: SMTP_ADDRESS value: email-smtp.us-east-1.amazonaws.com - name: SMTP_DOMAIN - value: atla.com + value: atlamail.org - name: SMTP_ENABLED value: 'true' - name: SMTP_PASSWORD value: $SMTP_PASSWORD - name: SMTP_PORT - value: '465' + value: '587' - name: SMTP_STARTTLS value: 'true' - name: SMTP_TYPE