tyage / slack-patron

Log and view all Slack messages.
MIT License
169 stars 41 forks source link

http://localhost:9292/にアクセスしてもNotFound #50

Closed janus53 closed 8 years ago

janus53 commented 8 years ago

セットアップの手順を読み、初期設定は終わったと思うのですが

http://localhost:9292/

へアクセスすると

Not Found: /

とだけ表示されます

$ bundle exec rackup

を実行している端末には

[2016-03-31 ::] INFO WEBrick 1.3.1 [2016-03-31 ::] INFO ruby 2.1.2 (2014-05-08) [x8664-linux-gnu] [2016-03-31 ::*] INFO WEBrick::HTTPServer#start: pid=2765 port=9292 _...* - - [31/Mar/2016:::\ +0900] "GET / HTTP/1.1" 404 - 0.0014 .**._._ - - [31/Mar/2016:::\ +0900] "GET / HTTP/1.1" 404 - 0.0053

というログが表示されています

事前にアーカイブしたzipファイルを

$ bundle exec ruby app/import.rb PATH_TO_BACKUP_FILE

で読み込ませております (mongodbの方には上記コマンドで読み込まれたと思われるユーザやチャンネルが登録されていました)

config.yml 内のtoken、secretは修正しています (上記で読み込ませたアーカイブのtermに対応したtokenを https://api.slack.com/web#authentication で取得して設定しています)

当方の環境は

$ cat /etc/redhat-release CentOS release 6.7 (Final) $ ruby --version ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux-gnu] $ mongod --version db version v2.6.12 $ redis-server --version Redis server v=3.0.7 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=5ece30e075eed8d2 $ node --version v0.10.42

となります

janus53 commented 8 years ago

追加です

$ bundle exec rackup -v Rack 1.3 (Release: 1.6.4)

$ bundle exec rackup -d nil Exception LoadError' at /usr/lib64/ruby/gems/2.1.0/gems/sidekiq-3.5.3/lib/sidekiq/core_ext.rb:2 - cannot load such file -- active_support/core_ext/class/attribute ExceptionLoadError' at /usr/lib64/ruby/gems/2.1.0/gems/sidekiq-3.5.3/lib/sidekiq/core_ext.rb:52 - cannot load such file -- active_support/core_ext/hash/keys Exception LoadError' at /usr/lib64/ruby/gems/2.1.0/gems/sidekiq-3.5.3/lib/sidekiq/core_ext.rb:89 - cannot load such file -- active_support/core_ext/string/inflections Using Ext extension for JSON. ExceptionNameError' at /usr/lib64/ruby/2.1.0/psych/class_loader.rb:67 - uninitialized constant BigDecimal Exception NameError' at /usr/lib64/ruby/2.1.0/psych/core_ext.rb:16 - methodto_yaml' not defined in Object Exception NameError' at /usr/lib64/ruby/2.1.0/psych/core_ext.rb:29 - methodyaml_as' not defined in Module Exception NameError' at /usr/lib64/ruby/2.1.0/psych/deprecated.rb:81 - undefined methodto_yaml_properties' for class Object' D, [2016-04-04T16:52:50.569935 #324] DEBUG -- : MONGODB | Adding localhost:27017 to the cluster. D, [2016-04-04T16:52:50.586387 #324] DEBUG -- : MONGODB | localhost:27017 | slack_logger.createIndexes | STARTED | {"createIndexes"=>"users", "indexes"=>[{:key=>{:id=>1}, :unique=>true, :name=>"id_1"}]} D, [2016-04-04T16:52:50.587149 #324] DEBUG -- : MONGODB | localhost:27017 | slack_logger.createIndexes | SUCCEEDED | 0.0005795139999999999s D, [2016-04-04T16:52:50.587977 #324] DEBUG -- : MONGODB | localhost:27017 | slack_logger.createIndexes | STARTED | {"createIndexes"=>"channels", "indexes"=>[{:key=>{:id=>1}, :unique=>true, :name=>"id_1"}]} D, [2016-04-04T16:52:50.588605 #324] DEBUG -- : MONGODB | localhost:27017 | slack_logger.createIndexes | SUCCEEDED | 0.0005273519999999999s D, [2016-04-04T16:52:50.589282 #324] DEBUG -- : MONGODB | localhost:27017 | slack_logger.createIndexes | STARTED | {"createIndexes"=>"messages", "indexes"=>[{:key=>{:ts=>1}, :unique=>true, :name=>"ts_1"}]} D, [2016-04-04T16:52:50.590007 #324] DEBUG -- : MONGODB | localhost:27017 | slack_logger.createIndexes | SUCCEEDED | 0.000585046s ExceptionLoadError' at /usr/lib64/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler/thin.rb:1 - cannot load such file -- thin Exception LoadError' at /usr/lib64/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler.rb:78 - cannot load such file -- rack/handler/puma ExceptionNameError' at /usr/lib64/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler.rb:22 - wrong constant name puma Exception `LoadError' at /usr/lib64/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler.rb:26 - cannot load such file -- rack/handler/puma

<Rack::ContentLength:0x0000000109dd18

@app=

<Rack::Chunked:0x0000000109dd90

@app=

<Rack::CommonLogger:0x0000000109de08

 @app=
  #<Rack::ShowExceptions:0x000000021ac6b8
   @app=
    #<Rack::Lint:0x000000021ac730
     @app=
      #<Rack::TempfileReaper:0x000000021ac780
       @app=
        #<Rack::URLMap:0x000000022b4b78
         @mapping=
          [[nil, "/sidekiq", /^\/+sidekiq(.*)/n, Sidekiq::Web],
           [nil, "", /^(.*)/n, Sinatra::Application]]>>,
     @content_length=nil>,
   @template=
    #<ERB:0x000000021ac690
     @enc=#<Encoding:UTF-8>,
     @filename=nil,
     @safe_level=nil,
     @src=
      "#coding:UTF-8\n_erbout = ''; _erbout.concat \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Transitional//EN\\\" \\\"http://www.w3.org/TR/html4/loose.dtd\\\">\\n<html lang=\\\"en\\\">\\n<head>\\n  <meta http-equiv=\\\"content-type\\\" content=\\\"text/html; charset=utf-8\\\" />\\n  <meta name=\\\"robots\\\" content=\\\"NONE,NOARCHIVE\\\" />\\n  <title>\"\n\n\n\n\n; _erbout.concat((h exception.class ).to_s); _erbout.concat \" at \"; _erbout.concat((h path ).to_s); _erbout.concat \"</title>\\n  <style type=\\\"text/css\\\">\\n    html * { padding:0; margin:0; }\\n    body * { padding:10px 20px; }\\n    body * * { padding:0; }\\n    body { font:small sans-serif; }\\n    body>div { border-bottom:1px solid #ddd; }\\n    h1 { font-weight:normal; }\\n    h2 { margin-bottom:.8em; }\\n    h2 span { font-size:80%; color:#666; font-weight:normal; }\\n    h3 { margin:1em 0 .5em 0; }\\n    h4 { margin:0 0 .5em 0; font-weight: normal; }\\n    table {\\n        border:1px solid #ccc; border-collapse: collapse; background:white; }\\n    tbody td, tbody th { vertical-align:top; padding:2px 3px; }\\n    thead th {\\n        padding:1px 6px 1px 3px; background:#fefefe; text-align:left;\\n        font-weight:normal; font-size:11px; border:1px solid #ddd; }\\n    tbody th { text-align:right; color:#666; padding-right:.5em; }\\n    table.vars { margin:5px 0 2px 40px; }\\n    table.vars td, table.req td { font-family:monospace; }\\n    table td.code { width:100%;}\\n    table td.code div { overflow:hidden; }\\n    table.source th { color:#666; }\\n    table.source td {\\n        font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }\\n    ul.traceback { list-style-type:none; }\\n    ul.traceback li.frame { margin-bottom:1em; }\\n    div.context { margin: 10px 0; }\\n    div.context ol {\\n        padding-left:30px; margin:0 10px; list-style-position: inside; }\\n    div.context ol li {\\n        font-family:monospace; white-space:pre; color:#666; cursor:pointer; }\\n    div.context ol.context-line li { color:black; background-color:#ccc; }\\n    div.context ol.context-line li span { float: right; }\\n    div.commands { margin-left: 40px; }\\n    div.commands a { color:black; text-decoration:none; }\\n    #summary { background: #ffc; }\\n    #summary h2 { font-weight: normal; color: #666; }\\n    #summary ul#quicklinks { list-style-type: none; margin-bottom: 2em; }\\n    #summary ul#quicklinks li { float: left; padding: 0 1em; }\\n    #summary ul#quicklinks>li+li { border-left: 1px #666 solid; }\\n    #explanation { background:#eee; }\\n    #template, #template-not-exist { background:#f6f6f6; }\\n    #template-not-exist ul { margin: 0 0 0 20px; }\\n    #traceback { background:#eee; }\\n    #requestinfo { background:#f6f6f6; padding-left:120px; }\\n    #summary table { border:none; background:transparent; }\\n    #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }\\n    #requestinfo h3 { margin-bottom:-1em; }\\n    .error { background: #ffc; }\\n    .specific { color:#cc3300; font-weight:bold; }\\n  </style>\\n  <script type=\\\"text/javascript\\\">\\n  //<!--\\n    function getElementsByClassName(oElm, strTagName, strClassName){\\n        // Written by Jonathan Snook, http://www.snook.ca/jon;\\n        // Add-ons by Robert Nyman, http://www.robertnyman.com\\n        var arrElements = (strTagName == \\\"*\\\" && document.all)? document.all :\\n        oElm.getElementsByTagName(strTagName);\\n        var arrReturnElements = new Array();\\n        strClassName = strClassName.replace(/\\\\-/g, \\\"\\\\\\\\-\\\");\\n        var oRegExp = new RegExp(\\\"(^|\\\\\\\\s)\\\" + strClassName + \\\"(\\\\\\\\s|$$)\\\");\\n        var oElement;\\n        for(var i=0; i<arrElements.length; i++){\\n            oElement = arrElements[i];\\n            if(oRegExp.test(oElement.className)){\\n                arrReturnElements.push(oElement);\\n            }\\n        }\\n        return (arrReturnElements)\\n    }\\n    function hideAll(elems) {\\n      for (var e = 0; e < elems.length; e++) {\\n        elems[e].style.display = 'none';\\n      }\\n    }\\n    window.onload = function() {\\n      hideAll(getElementsByClassName(document, 'table', 'vars'));\\n      hideAll(getElementsByClassName(document, 'ol', 'pre-context'));\\n      hideAll(getElementsByClassName(document, 'ol', 'post-context'));\\n    }\\n    function toggle() {\\n      for (var i = 0; i < arguments.length; i++) {\\n        var e = document.getElementById(arguments[i]);\\n        if (e) {\\n          e.style.display = e.style.display == 'none' ? 'block' : 'none';\\n        }\\n      }\\n      return false;\\n    }\\n    function varToggle(link, id) {\\n      toggle('v' + id);\\n      var s = link.getElementsByTagName('span')[0];\\n      var uarr = String.fromCharCode(0x25b6);\\n      var darr = String.fromCharCode(0x25bc);\\n      s.innerHTML = s.innerHTML == uarr ? darr : uarr;\\n      return false;\\n    }\\n    //-->\\n  </script>\\n</head>\\n<body>\\n\\n<div id=\\\"summary\\\">\\n  <h1>\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n; _erbout.concat((h exception.class ).to_s); _erbout.concat \" at \"; _erbout.concat((h path ).to_s); _erbout.concat \"</h1>\\n  <h2>\"\n; _erbout.concat((h exception.message ).to_s); _erbout.concat \"</h2>\\n  <table><tr>\\n    <th>Ruby</th>\\n    <td>\\n\"\n\n\n\n;  if first = frames.first ; _erbout.concat \"\\n      <code>\"\n; _erbout.concat((h first.filename ).to_s); _erbout.concat \"</code>: in <code>\"; _erbout.concat((h first.function ).to_s); _erbout.concat \"</code>, line \"; _erbout.concat((h frames.first.lineno ).to_s); _erbout.concat \"\\n\"\n;  else ; _erbout.concat \"\\n      unknown location\\n\"\n\n;  end ; _erbout.concat \"\\n    </td>\\n  </tr><tr>\\n    <th>Web</th>\\n    <td><code>\"\n\n\n\n; _erbout.concat((h req.request_method ).to_s); _erbout.concat \" \"; _erbout.concat((h(req.host + path)).to_s); _erbout.concat \"</code></td>\\n  </tr></table>\\n\\n  <h3>Jump to:</h3>\\n  <ul id=\\\"quicklinks\\\">\\n    <li><a href=\\\"#get-info\\\">GET</a></li>\\n    <li><a href=\\\"#post-info\\\">POST</a></li>\\n    <li><a href=\\\"#cookie-info\\\">Cookies</a></li>\\n    <li><a href=\\\"#env-info\\\">ENV</a></li>\\n  </ul>\\n</div>\\n\\n<div id=\\\"traceback\\\">\\n  <h2>Traceback <span>(innermost first)</span></h2>\\n  <ul class=\\\"traceback\\\">\\n\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n;  frames.each { |frame| ; _erbout.concat \"\\n      <li class=\\\"frame\\\">\\n        <code>\"\n\n; _erbout.concat((h frame.filename ).to_s); _erbout.concat \"</code>: in <code>\"; _erbout.concat((h frame.function ).to_s); _erbout.concat \"</code>\\n\\n          \"\n\n;  if frame.context_line ; _erbout.concat \"\\n          <div class=\\\"context\\\" id=\\\"c\"\n; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"\\\">\\n              \"\n;  if frame.pre_context ; _erbout.concat \"\\n              <ol start=\\\"\"\n; _erbout.concat((h frame.pre_context_lineno+1 ).to_s); _erbout.concat \"\\\" class=\\\"pre-context\\\" id=\\\"pre\"; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"\\\">\\n                \"\n;  frame.pre_context.each { |line| ; _erbout.concat \"\\n                <li onclick=\\\"toggle('pre\"\n; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"', 'post\"; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"')\\\">\"; _erbout.concat((h line ).to_s); _erbout.concat \"</li>\\n                \"\n;  } ; _erbout.concat \"\\n              </ol>\\n              \"\n\n;  end ; _erbout.concat \"\\n\\n            <ol start=\\\"\"\n\n; _erbout.concat((h frame.lineno ).to_s); _erbout.concat \"\\\" class=\\\"context-line\\\">\\n              <li onclick=\\\"toggle('pre\"\n; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"', 'post\"; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"')\\\">\"; _erbout.concat((h frame.context_line ).to_s); _erbout.concat \"<span>...</span></li></ol>\\n\\n              \"\n\n;  if frame.post_context ; _erbout.concat \"\\n              <ol start='\"\n; _erbout.concat((h frame.lineno+1 ).to_s); _erbout.concat \"' class=\\\"post-context\\\" id=\\\"post\"; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"\\\">\\n                \"\n;  frame.post_context.each { |line| ; _erbout.concat \"\\n                <li onclick=\\\"toggle('pre\"\n; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"', 'post\"; _erbout.concat((h frame.object_id ).to_s); _erbout.concat \"')\\\">\"; _erbout.concat((h line ).to_s); _erbout.concat \"</li>\\n                \"\n;  } ; _erbout.concat \"\\n              </ol>\\n              \"\n\n;  end ; _erbout.concat \"\\n          </div>\\n          \"\n\n;  end ; _erbout.concat \"\\n      </li>\\n\"\n\n;  } ; _erbout.concat \"\\n  </ul>\\n</div>\\n\\n<div id=\\\"requestinfo\\\">\\n  <h2>Request information</h2>\\n\\n  <h3 id=\\\"get-info\\\">GET</h3>\\n  \"\n\n\n\n\n\n\n\n;  if req.GET and not req.GET.empty? ; _erbout.concat \"\\n    <table class=\\\"req\\\">\\n      <thead>\\n        <tr>\\n          <th>Variable</th>\\n          <th>Value</th>\\n        </tr>\\n      </thead>\\n      <tbody>\\n          \"\n\n\n\n\n\n\n\n\n;  req.GET.sort_by { |k, v| k.to_s }.each { |key, val| ; _erbout.concat \"\\n          <tr>\\n            <td>\"\n\n; _erbout.concat((h key ).to_s); _erbout.concat \"</td>\\n            <td class=\\\"code\\\"><div>\"\n; _erbout.concat((h val.inspect ).to_s); _erbout.concat \"</div></td>\\n          </tr>\\n          \"\n\n;  } ; _erbout.concat \"\\n      </tbody>\\n    </table>\\n  \"\n\n\n;  else ; _erbout.concat \"\\n    <p>No GET data.</p>\\n  \"\n\n;  end ; _erbout.concat \"\\n\\n  <h3 id=\\\"post-info\\\">POST</h3>\\n  \"\n\n\n;  if req.POST and not req.POST.empty? ; _erbout.concat \"\\n    <table class=\\\"req\\\">\\n      <thead>\\n        <tr>\\n          <th>Variable</th>\\n          <th>Value</th>\\n        </tr>\\n      </thead>\\n      <tbody>\\n          \"\n\n\n\n\n\n\n\n\n;  req.POST.sort_by { |k, v| k.to_s }.each { |key, val| ; _erbout.concat \"\\n          <tr>\\n            <td>\"\n\n; _erbout.concat((h key ).to_s); _erbout.concat \"</td>\\n            <td class=\\\"code\\\"><div>\"\n; _erbout.concat((h val.inspect ).to_s); _erbout.concat \"</div></td>\\n          </tr>\\n          \"\n\n;  } ; _erbout.concat \"\\n      </tbody>\\n    </table>\\n  \"\n\n\n;  else ; _erbout.concat \"\\n    <p>No POST data.</p>\\n  \"\n\n;  end ; _erbout.concat \"\\n\\n\\n  <h3 id=\\\"cookie-info\\\">COOKIES</h3>\\n  \"\n\n\n\n;  unless req.cookies.empty? ; _erbout.concat \"\\n    <table class=\\\"req\\\">\\n      <thead>\\n        <tr>\\n          <th>Variable</th>\\n          <th>Value</th>\\n        </tr>\\n      </thead>\\n      <tbody>\\n        \"\n\n\n\n\n\n\n\n\n;  req.cookies.each { |key, val| ; _erbout.concat \"\\n          <tr>\\n            <td>\"\n\n; _erbout.concat((h key ).to_s); _erbout.concat \"</td>\\n            <td class=\\\"code\\\"><div>\"\n; _erbout.concat((h val.inspect ).to_s); _erbout.concat \"</div></td>\\n          </tr>\\n        \"\n\n;  } ; _erbout.concat \"\\n      </tbody>\\n    </table>\\n  \"\n\n\n;  else ; _erbout.concat \"\\n    <p>No cookie data.</p>\\n  \"\n\n;  end ; _erbout.concat \"\\n\\n  <h3 id=\\\"env-info\\\">Rack ENV</h3>\\n    <table class=\\\"req\\\">\\n      <thead>\\n        <tr>\\n          <th>Variable</th>\\n          <th>Value</th>\\n        </tr>\\n      </thead>\\n      <tbody>\\n          \"\n\n\n\n\n\n\n\n\n\n\n;  env.sort_by { |k, v| k.to_s }.each { |key, val| ; _erbout.concat \"\\n          <tr>\\n            <td>\"\n\n; _erbout.concat((h key ).to_s); _erbout.concat \"</td>\\n            <td class=\\\"code\\\"><div>\"\n; _erbout.concat((h val ).to_s); _erbout.concat \"</div></td>\\n          </tr>\\n          \"\n\n;  } ; _erbout.concat \"\\n      </tbody>\\n    </table>\\n\\n</div>\\n\\n<div id=\\\"explanation\\\">\\n  <p>\\n    You're seeing this error because you use <code>Rack::ShowExceptions</code>.\\n  </p>\\n</div>\\n\\n</body>\\n</html>\\n\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n; _erbout.force_encoding(__ENCODING__)">>,
 @logger=#<IO:<STDERR>>>>>

<Rack::URLMap:0x000000022b4b78

@mapping= [[nil, "/sidekiq", /^\/+sidekiq(.)/n, Sidekiq::Web], [nil, "", /^(.)/n, Sinatra::Application]]> [2016-04-04 16:52:50] INFO WEBrick 1.3.1 [2016-04-04 16:52:50] INFO ruby 2.1.2 (2014-05-08) [x86_64-linux-gnu] [2016-04-04 16:52:50] INFO WEBrick::HTTPServer#start: pid=324 port=9292 ... - - [04/Apr/2016:16:52:59 +0900] "GET /sidekiq HTTP/1.1" 404 - 0.0015 ... - - [04/Apr/2016:16:53:00 +0900] "GET /favicon.ico HTTP/1.1" 404 - 0.0006 ExceptionWEBrick::HTTPStatus::EOFError' at /usr/lib64/ruby/2.1.0/webrick/httpserver.rb:79 - WEBrick::HTTPStatus::EOFError ExceptionWEBrick::HTTPStatus::EOFError' at /usr/lib64/ruby/2.1.0/webrick/httpserver.rb:79 - WEBrick::HTTPStatus::EOFError

となり http://localhost:9292/sidekiq でもNotFoundの状態はかわりませんでした

tyage commented 8 years ago

何度か試してみたのですがこちらでうまく再現できませんでした.

その後変化はありましたでしょうか

janus53 commented 8 years ago

そうですか再現できないのですね こちらはあれから動かしていないので進展はありません

URL mapping側での問題の可能性がある状態で http://localhost:9292/sidekiq へのアクセスも問題がある場合他に何か思い当たるような原因はございませんでしょうか?

tyage commented 8 years ago

config.ru を以下の内容に書き換えてサーバを起動するといかがでしょうか?

require './app/viewer'

run Sinatra::Application
janus53 commented 8 years ago

config.ruを書き換え再起動後アクセスしてみたところ下記URLにアップした画像のようなページが表示されるようになりました https://imgur.com/delete/sTKmjDybZgkrPOX

tyage commented 8 years ago

起動直後に表示されるページはそれで問題ないかと思います.