Advertisement
Guest User

Untitled

a guest
Feb 13th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. [Unit]
  2. Description=sidekiq
  3. After=syslog.target network.target redis-server.service
  4.  
  5. [Service]
  6. Type=simple
  7. WorkingDirectory=/var/www/show_caster/code
  8. ExecStart=/bin/bash -lc '/usr/local/rvm/gems/ruby-2.2.7/wrappers/bundler exec sidekiq -e production -q default -q mailers -C config/sidekiq.yml -L log/sidekiq.log'
  9. User=sesame
  10. Group=sesame
  11. UMask=0002
  12.  
  13. Environment=MALLOC_ARENA_MAX=2
  14.  
  15. # if we crash, restart
  16. RestartSec=4
  17. #Restart=on-failure
  18. Restart=always
  19.  
  20. # output goes to /var/log/syslog
  21. StandardOutput=syslog
  22. StandardError=syslog
  23.  
  24. class NotificationFilter < Notification
  25.  
  26. # .../...
  27.  
  28. def self.poll_end_reminder_mailing(poll_id)
  29. poll = Poll.find_by(id: poll_id)
  30. return nil if poll.nil?
  31.  
  32. PollMailer.poll_end_reminder_mail(poll).deliver_now!
  33. rescue StandardError => e
  34. # Bugsnag.notify(e)
  35. Rails.logger.error("poll_end_reminder_mailing failure: #{e}")
  36. raise e
  37. end
  38. end
  39.  
  40. def poll_end_reminder_mail(poll)
  41. @url = get_polls_url
  42. @url_login = url_login
  43. @poll = poll
  44. Rails.logger.debug('------ poll_end_reminder_mail -------')
  45. Rails.logger.debug("subject: #{I18n.t('polls.mails.reminder.end_subject')}")
  46. Rails.logger.debug('-----------------------------')
  47. mail(
  48. to: poll.owner.prefered_email,
  49. subject: I18n.t('polls.mails.reminder.end_subject')
  50. )
  51. rescue StandardError => e
  52. Bugsnag.notify(e)
  53. Rails.logger.error("poll_end_reminder_mail failure: #{e}")
  54. end
  55.  
  56. I, [2019-01-15T15:21:05.563191 #543] INFO -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] Performing ReminderPollEndJob from Sidekiq(mailers) with arguments: 21
  57. D, [2019-01-15T15:21:05.567424 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] Poll Load (0.9ms) SELECT "polls".* FROM "polls" WHERE "polls"."id" = $1 ORDER BY expiration_date ASC LIMIT $2 [["id", 21], ["LIMIT", 1]]
  58. D, [2019-01-15T15:21:05.568475 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] NotificationService.poll_end_reminder_mailing
  59. D, [2019-01-15T15:21:05.570448 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] CACHE (0.0ms) SELECT "polls".* FROM "polls" WHERE "polls"."id" = $1 ORDER BY expiration_date ASC LIMIT $2 [["id", 21], ["LIMIT", 1]]
  60. D, [2019-01-15T15:21:05.571754 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] ------ poll_end_reminder_mail -------
  61. D, [2019-01-15T15:21:05.572080 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] subject: You can share poll result with the voters !
  62. D, [2019-01-15T15:21:05.572170 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] -----------------------------
  63. D, [2019-01-15T15:21:05.578484 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
  64. D, [2019-01-15T15:21:05.587189 #543] DEBUG -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] PollMailer#poll_end_reminder_mail: processed outbound mail in 15.7ms
  65. I, [2019-01-15T15:21:05.817170 #543] INFO -- : [ActiveJob] [ReminderPollEndJob] [0bda6e97-fc35-4803-9a54-8a5607393e84] Performed ReminderPollEndJob from Sidekiq(mailers) in 253.32ms
  66.  
  67. 2019-01-15T14:19:26.396Z 543 TID-431lf INFO: See LICENSE and the LGPL-3.0 for licensing details.
  68. 2019-01-15T14:19:26.396Z 543 TID-431lf INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
  69. 2019-01-15T14:19:26.411Z 543 TID-431lf DEBUG: Client Middleware:
  70. 2019-01-15T14:19:26.411Z 543 TID-431lf DEBUG: Server Middleware: Bugsnag::Sidekiq
  71. 2019-01-15T14:19:26.412Z 543 TID-431lf INFO: Starting processing, hit Ctrl-C to stop
  72. 2019-01-15T14:19:26.413Z 543 TID-431lf DEBUG: {:queues=>["mailers"], :labels=>[], :concurrency=>5, :require=>".", :environment=>"production", :timeout=>8, :poll_interval_average=>nil, :average_scheduled_poll_interval=>5, :error_handlers=>[#<Sidekiq::ExceptionHandler::Logger:0x180b438>, #<Proc:0x1bbf214@/var/www/show_caster/code/vendor/bundle/ruby/2.2.0/gems/bugsnag-6.10.0/lib/bugsnag/integrations/sidekiq.rb:52>], :death_handlers=>[], :lifecycle_events=>{:startup=>[], :quiet=>[], :shutdown=>[], :heartbeat=>[]}, :dead_max_jobs=>10000, :dead_timeout_in_seconds=>15552000, :reloader=>#<Sidekiq::Rails::Reloader @app=ShowCaster::Application>, :verbose=>true, :pidfile=>"tmp/pids/sidekiq.pid", :strict=>false, :config_file=>"config/sidekiq.yml", :logfile=>"log/sidekiq.log", :tag=>"code", :identity=>"SESAMES:543:6312f82779d5"}
  73. 2019-01-15T14:20:22.573Z 543 TID-iniex ReminderPollEndJob JID-f0d23068cf072b94820cca98 INFO: start
  74. 2019-01-15T14:20:24.299Z 543 TID-iniex ReminderPollEndJob JID-f0d23068cf072b94820cca98 INFO: done: 1.726 sec
  75.  
  76. [Service]
  77. Type=simple
  78. WorkingDirectory=/var/www/show_caster/code
  79. ExecStart=/bin/bash -lc '/usr/local/rvm/gems/ruby-2.2.7/bin/bundler exec sidekiq -e production -q mailers -C config/sidekiq.yml -L log/sidekiq.log'
  80. Environment=RAILS_ENV=production
  81. Environment=SMTP_SERVER=<your_smtp_server>
  82. Environment=SMTP_EMAIL=<email_adress>
  83. Environment=SMTP_PASSWORD=<password>
  84. User=sesame
  85. Group=sesame
  86. UMask=0002
  87.  
  88. mail(
  89. to: poll.owner.prefered_email,
  90. subject: I18n.t('polls.mails.reminder.end_subject')
  91. ).deliver_now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement