southbridgeio / redmine_bots

44 stars 11 forks source link

Не запускается getUpdates #36

Open dronmaxman opened 5 years ago

dronmaxman commented 5 years ago

Версия ПО

Environment: Redmine version 3.4.11.stable Ruby version 2.3.3-p222 (2016-11-21) [x86_64-linux-gnu] Rails version 4.2.11.1 Environment production Database adapter Mysql2 SCM: Cvs 1.12.13 Bazaar 2.8.0 Git 2.11.0 Filesystem
Redmine plugins: clipboard_image_paste 1.13 easy_gantt 1.10 progressive_projects_list 3.0.1 projects_show 0.0.3 redmine_activity_report 1.2.10 redmine_banner 0.1.2 redmine_base_deface 1.3.2 redmine_bots 0.3.1 redmine_changeauthor 1.0.1 redmine_checklists 3.1.16 redmine_email_images 0.1.1 redmine_issue_dynamic_edit 0.6.7 redmine_issue_evm 4.0 redmine_issue_tabs 1.1.0 redmine_login_audit 0.3.3 redmine_logs 0.1.1 redmine_move_comments 0.0.2 redmine_multiprojects_issue 3.3.0 redmine_people 1.4.1 redmine_per_project_formatting 0.0.4 redmine_pivot_table 0.0.7 redmine_pretend 2.0.1 redmine_reminder 0.3.0 redmine_send_mails 0.3.23xBeta redmine_sidekiq 2.1.0 redmine_spent_time_required 0.0.1 redmine_stats 0.0.3 redmine_summed_fields 1.0.1 redmine_update_reminder 1.1 redmine_work_time 0.3.4 redmine_workload 1.1.0 sidebar_hide 0.0.8 subtask_columns 0.0.3 that_email_log 0.0.1 timelog_timer 2.0.0

Не могу заставить бота работать в режиме getUpdates. При выполнении команды bundle exec rake redmine_bots:telegram

root@vs-kv-web-rm02:/var/www/html/redmine/plugins# rake redmine_bots:telegram --trace | tee log.file (in /var/www/html/redmine) I, [2019-07-03T14:25:41.292801 #115802] INFO -- : Celluloid 0.17.4 is running in BACKPORTED mode. [ http://git.io/vJf3J ] Invoke redmine_bots:telegram (first_time) Invoke environment (first_time) ** Execute environment rake aborted! ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"] /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/connection_specification.rb:248:in resolve_symbol_connection' /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/connection_specification.rb:211:inresolve_connection' /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/connection_specification.rb:139:in resolve' /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/connection_specification.rb:169:inspec' /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/connection_handling.rb:50:in establish_connection' /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/railtie.rb:122:inblock (2 levels) in ' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/lazy_load_hooks.rb:38:in instance_eval' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/lazy_load_hooks.rb:38:inexecute_hook' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/lazy_load_hooks.rb:28:in block in on_load' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/lazy_load_hooks.rb:27:ineach' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/lazy_load_hooks.rb:27:in on_load' /var/lib/gems/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/railtie.rb:118:inblock in ' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:30:in instance_exec' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:30:inrun' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:55:in block in run_initializers' /usr/lib/ruby/2.3.0/tsort.rb:228:inblock in tsort_each' /usr/lib/ruby/2.3.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component' /usr/lib/ruby/2.3.0/tsort.rb:431:ineach_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:349:in block in each_strongly_connected_component' /usr/lib/ruby/2.3.0/tsort.rb:347:ineach' /usr/lib/ruby/2.3.0/tsort.rb:347:in call' /usr/lib/ruby/2.3.0/tsort.rb:347:ineach_strongly_connected_component' /usr/lib/ruby/2.3.0/tsort.rb:226:in tsort_each' /usr/lib/ruby/2.3.0/tsort.rb:205:intsort_each' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:54:in run_initializers' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/application.rb:352:ininitialize!' /var/www/html/redmine/config/environment.rb:14:in <top (required)>' /var/lib/gems/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:inrequire' /var/lib/gems/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in require' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inblock in require' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in load_dependency' /var/lib/gems/2.3.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/application.rb:328:in require_environment!' /var/lib/gems/2.3.0/gems/railties-4.2.11.1/lib/rails/application.rb:457:inblock in run_tasks_blocks' /usr/lib/ruby/vendor_ruby/rake/task.rb:240:in block in execute' /usr/lib/ruby/vendor_ruby/rake/task.rb:235:ineach' /usr/lib/ruby/vendor_ruby/rake/task.rb:235:in execute' /usr/lib/ruby/vendor_ruby/rake/task.rb:179:inblock in invoke_with_call_chain' /usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' /usr/lib/ruby/vendor_ruby/rake/task.rb:172:ininvoke_with_call_chain' /usr/lib/ruby/vendor_ruby/rake/task.rb:201:in block in invoke_prerequisites' /usr/lib/ruby/vendor_ruby/rake/task.rb:199:ineach' /usr/lib/ruby/vendor_ruby/rake/task.rb:199:in invoke_prerequisites' /usr/lib/ruby/vendor_ruby/rake/task.rb:178:inblock in invoke_with_call_chain' /usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' /usr/lib/ruby/vendor_ruby/rake/task.rb:172:ininvoke_with_call_chain' /usr/lib/ruby/vendor_ruby/rake/task.rb:165:in invoke' /usr/lib/ruby/vendor_ruby/rake/application.rb:150:ininvoke_task' /usr/lib/ruby/vendor_ruby/rake/application.rb:106:in block (2 levels) in top_level' /usr/lib/ruby/vendor_ruby/rake/application.rb:106:ineach' /usr/lib/ruby/vendor_ruby/rake/application.rb:106:in block in top_level' /usr/lib/ruby/vendor_ruby/rake/application.rb:115:inrun_with_threads' /usr/lib/ruby/vendor_ruby/rake/application.rb:100:in top_level' /usr/lib/ruby/vendor_ruby/rake/application.rb:78:inblock in run' /usr/lib/ruby/vendor_ruby/rake/application.rb:176:in standard_exception_handling' /usr/lib/ruby/vendor_ruby/rake/application.rb:75:inrun' /var/lib/gems/2.3.0/gems/rake-12.3.2/exe/rake:27:in <top (required)>' /usr/local/bin/rake:22:inload' /usr/local/bin/rake:22:in `

' Tasks: TOP => redmine_bots:telegram => environment

vladislav-yashin commented 5 years ago

Нужно запускать в production-окружении (RAILS_ENV=production)

dronmaxman commented 5 years ago

Нужно запускать в production-окружении (RAILS_ENV=production)

Да, прошло без ошибок. Как теперь понять что БОТ работает? в логе ничего нет, куда смотреть? Если написать боту, то он ничего не отвечает, просто молчит.

root@vs-kv-web-rm02:/var/www/html/redmine# ls -l /var/www/html/redmine/log/ total 2416 drwxr-xr-x 2 www-data www-data 4096 Jul 2 19:57 chat_telegram -rw-rw-r-- 1 www-data www-data 32 Jun 10 15:52 delete.me -rw-r--r-- 1 www-data www-data 0 Jul 2 19:35 development.log drwxr-xr-x 2 www-data www-data 4096 Jul 2 19:57 intouch -rw-r--r-- 1 www-data www-data 2406731 Jul 3 15:52 production.log drwxr-xr-x 2 www-data www-data 4096 Jul 3 01:25 redmine_2chat drwxr-xr-x 2 www-data www-data 4096 Jul 3 15:45 redmine_bots -rw-r--r-- 1 www-data www-data 31704 Jul 3 15:52 sidekiq.log drwxr-xr-x 2 www-data www-data 4096 Jul 2 19:42 telegram_common root@vs-kv-web-rm02:/var/www/html/redmine# ls -l /var/www/html/redmine/log/redmine_bots/ total 19964 -rw-rw-rwT 1 www-data www-data 67 Jul 3 15:45 bot.log -rw------- 1 www-data www-data 9941277 Jul 3 13:03 tdlib.log -rw------- 1 www-data www-data 10485873 Jul 3 09:47 tdlib.log.old

dronmaxman commented 5 years ago

Нужно запускать в production-окружении (RAILS_ENV=production)

Да, прошло без ошибок. Как теперь понять что БОТ работает? в логе ничего нет, куда смотреть? Если написать боту, то он ничего не отвечает, просто молчит.

root@vs-kv-web-rm02:/var/www/html/redmine# ls -l /var/www/html/redmine/log/ total 2416 drwxr-xr-x 2 www-data www-data 4096 Jul 2 19:57 chat_telegram -rw-rw-r-- 1 www-data www-data 32 Jun 10 15:52 delete.me -rw-r--r-- 1 www-data www-data 0 Jul 2 19:35 development.log drwxr-xr-x 2 www-data www-data 4096 Jul 2 19:57 intouch -rw-r--r-- 1 www-data www-data 2406731 Jul 3 15:52 production.log drwxr-xr-x 2 www-data www-data 4096 Jul 3 01:25 redmine_2chat drwxr-xr-x 2 www-data www-data 4096 Jul 3 15:45 redmine_bots -rw-r--r-- 1 www-data www-data 31704 Jul 3 15:52 sidekiq.log drwxr-xr-x 2 www-data www-data 4096 Jul 2 19:42 telegram_common root@vs-kv-web-rm02:/var/www/html/redmine# ls -l /var/www/html/redmine/log/redmine_bots/ total 19964 -rw-rw-rwT 1 www-data www-data 67 Jul 3 15:45 bot.log -rw------- 1 www-data www-data 9941277 Jul 3 13:03 tdlib.log -rw------- 1 www-data www-data 10485873 Jul 3 09:47 tdlib.log.old

Методом тыка запустил вот так

bundle exec rake redmine_bots:telegram RAILS_ENV=production PID_DIR='/var/www/html/redmine/tmp/pids/'

Прошел регистрацию, появилась связка в базе данных id_te.

dronmaxman commented 5 years ago

Теперь второй вопрос. Не получается авторизовать Телеграмм.
Ввожу номер телефона и получаю ошибку. image

Несколько раз обновляю страницу и снова ошибка Unknown error. Please, see TDlib logs. image

tdlib.log

pr0l commented 4 years ago

Теперь второй вопрос. Не получается авторизовать Телеграмм. Ввожу номер телефона и получаю ошибку. image

Несколько раз обновляю страницу и снова ошибка Unknown error. Please, see TDlib logs. image

tdlib.log

смог авторизоваться?

dronmaxman commented 3 years ago

Немного обновил конфиг сервера.

Environment:
  Redmine version                3.4.11.stable
  Ruby version                   2.4.4-p296 (2018-03-28) [x86_64-linux]
  Rails version                  4.2.11.1
  Environment                    production
  Database adapter               Mysql2

redmine_sidekiq                2.1.0
  redmine_bots                   0.4.1

### GEM
sidekiq (5.2.9)

Да, авторизоваться получилось. Но не могу заставить бота работать. Запускаю через getUpdate получаю

redmine@tvs-kv-web-rm03:~$ bundle exec rake redmine_bots:telegram RAILS_ENV=production PID_DIR='/opt/redmine/tmp/pids/'
[dry-types] Dry::Types.module is deprecated and will be removed in the next major version
Use Dry.Types() instead. Beware, it exports strict types by default, for old behavior use Dry.Types(default: :nominal). See more options in the changelog
/opt/redmine/config/application.rb:5:in `<top (required)>'
`Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` returns a boolean, you should use it instead. To opt-in to the new behavior now you can set Redis.exists_returns_integer =  true. To disable this message and keep the current (boolean) behaviour of 'exists' you can set `Redis.exists_returns_integer = false`, but this option will be removed in 5.0. (/opt/redmine/vendor/bundle/ruby/2.4.0/gems/sidekiq-cron-1.2.0/lib/sidekiq/cron/job.rb:464:in `block in save')
redmine@tvs-kv-web-rm03:~$

при этом бот обрабатывает команды в очереди и снова перестает отвечать.

dronmaxman commented 3 years ago

Так же нашел ошибку в log/redmine_bot/bot.log

I, [2021-10-09T01:22:24.345979 #19527]  INFO -- : Start daemon...
I, [2021-10-09T01:22:24.349735 #19527]  INFO -- : Telegram Bot: Connecting to telegram...
I, [2021-10-09T01:34:00.770316 #21005]  INFO -- : Start daemon...
I, [2021-10-09T01:34:00.773777 #21005]  INFO -- : Telegram Bot: Connecting to telegram...
I, [2021-10-10T15:54:55.118291 #44915]  INFO -- : Start daemon...
I, [2021-10-10T15:54:55.123678 #44915]  INFO -- : Telegram Bot: Connecting to telegram...
D, [2021-10-10T15:54:56.535084 #44915] DEBUG -- : RedmineBots::Telegram::Bot#send_message
D, [2021-10-10T15:54:56.535254 #44915] DEBUG -- : chat_id: 756060824
D, [2021-10-10T15:54:56.535324 #44915] DEBUG -- : message: Чтобы связать аккаунты Redmine и Telegram, пожалуйста, введите команду /connect.

D, [2021-10-10T15:54:56.535387 #44915] DEBUG -- : params: {}
E, [2021-10-10T15:55:01.769638 #44915] ERROR -- : GLOBAL Timeout::Error: Operation timed out after 5001 milliseconds with 0 bytes received
/opt/redmine/plugins/redmine_bots/lib/redmine_bots/telegram/bot/faraday_adapter.rb:43:in `rescue in call'
/opt/redmine/plugins/redmine_bots/lib/redmine_bots/telegram/bot/faraday_adapter.rb:5:in `call'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/faraday-1.8.0/lib/faraday/request/url_encoded.rb:25:in `call'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/faraday-1.8.0/lib/faraday/request/multipart.rb:30:in `call'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/faraday-1.8.0/lib/faraday/rack_builder.rb:154:in `build_response'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/faraday-1.8.0/lib/faraday/connection.rb:516:in `run_request'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/faraday-1.8.0/lib/faraday/connection.rb:281:in `post'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/api.rb:49:in `call'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/api.rb:37:in `method_missing'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:30:in `fetch_updates'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:25:in `listen'
/opt/redmine/plugins/redmine_bots/lib/tasks/telegram.rake:29:in `block (3 levels) in <top (required)>'
/opt/redmine/plugins/redmine_bots/lib/redmine_bots/utils.rb:25:in `daemonize'
/opt/redmine/plugins/redmine_bots/lib/tasks/telegram.rake:26:in `block (2 levels) in <top (required)>'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/opt/redmine/vendor/bundle/ruby/2.4.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/opt/redmine/vendor/bundle/ruby/2.4.0/bin/rake:23:in `load'
/opt/redmine/vendor/bundle/ruby/2.4.0/bin/rake:23:in `<top (required)>'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/opt/redmine/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'