Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble deploying gemstash as a bosh release #189

Open
donghoang89 opened this issue Jun 26, 2018 · 2 comments
Open

Trouble deploying gemstash as a bosh release #189

donghoang89 opened this issue Jun 26, 2018 · 2 comments

Comments

@donghoang89
Copy link

I am trying to build a bosh release for gemstash.

However, I am running into the following issue when I try to push gem to gem stash private registry

         <tr>
           <td>sinatra.error</td>
           <td class="code"><div>#&lt;NameError: uninitialized constant Gemstash::DB::Authorization
Did you mean?  Gemstash::Authorization&gt;</div></td>
         </tr>
         
         <tr>
           <td>sinatra.route</td>
           <td class="code"><div>POST &#x2F;api&#x2F;v1&#x2F;gems</div></td>
         </tr>
         
      </table>
      <div class="clear"></div>
    </div> <!-- /RACK ENV -->

    <p id="explanation">You're seeing this error because you have
enabled the <code>show_exceptions</code> setting.</p>
  </div> <!-- /WRAP -->
  </body>
</html>

If I bosh ssh into the server and start gem stash manually with "./gemstash start", the issue would not occur at all.

I am trying to look for where "Gemstash::Authorization" and "Gemstash::DB::Authorization" are being referred to in the source code. They seem to be at:

ruby-registry/8be6df83-5351-43d2-8a3c-d81da4ba6653:/var/vcap/packages/ruby-registry/bin# grep -r "Gemstash::DB::Authorization" /
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/authorization.rb:      Gemstash::DB::Authorization.insert_or_update(auth_key, permissions)
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/authorization.rb:      record = Gemstash::DB::Authorization[auth_key: auth_key]
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/authorization.rb:      record = Gemstash::DB::Authorization[auth_key: auth_key]
ruby-registry/8be6df83-5351-43d2-8a3c-d81da4ba6653:/var/vcap/packages/ruby-registry/bin# grep -r "Gemstash::Authorization" /
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/api_key_authorization.rb:  # Authorize actions via an API key and Gemstash::Authorization.
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/api_key_authorization.rb:      Gemstash::Authorization.check(@key, permission)
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/cli/authorize.rb:        Gemstash::Authorization.remove(auth_key(false))
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/cli/authorize.rb:          unless Gemstash::Authorization::VALID_PERMISSIONS.include?(arg)
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/cli/authorize.rb:            valid = Gemstash::Authorization::VALID_PERMISSIONS.join(", ")
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/cli/authorize.rb:        Gemstash::Authorization.authorize(auth_key, permissions)
/var/vcap/data/packages/ruby-registry/d2beb2b654958527c2fcec06b2cbaeb6396a273a/lib/ruby/gems/2.5.0/gems/gemstash-1.1.0/lib/gemstash/cli/authorize.rb:          key = SecureRandom.hex(16) while Gemstash::Authorization[key]

DO you have any idea what could have cause gemstash to behave differently when being started with bosh as opposed to being started manually?

@donghoang89
Copy link
Author

When gemstash is started manually

ruby-registry/8be6df83-5351-43d2-8a3c-d81da4ba6653:/var/vcap/packages/ruby-registry/bin# ./gem push --key test_key --host http://10.21.128.48:9292/private rubywarrior-0.1.3.gem 
Pushing gem to http://10.21.128.48:9292/private...

When gemstash is started with bosh

ruby-registry/8be6df83-5351-43d2-8a3c-d81da4ba6653:/var/vcap/packages/ruby-registry/bin# ./gem push --key test_key --host http://10.21.128.48:9292/private rack-2.0.5.gem 
Pushing gem to http://10.21.128.48:9292/private...
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Errno::ENOENT at &#x2F;api&#x2F;v1&#x2F;gems</title>

  <script type="text/javascript">
  //<!--
  function toggle(id) {
    var pre  = document.getElementById("pre-" + id);
    var post = document.getElementById("post-" + id);
    var context = document.getElementById("context-" + id);

    if (pre.style.display == 'block') {
      pre.style.display = 'none';
      post.style.display = 'none';
      context.style.background = "none";
    } else {
      pre.style.display = 'block';
      post.style.display = 'block';
      context.style.background = "#fffed9";
    }
  }

  function toggleBacktrace(){
    var bt = document.getElementById("backtrace");
    var toggler = document.getElementById("expando");

    if (bt.className == 'condensed') {
      bt.className = 'expanded';
      toggler.innerHTML = "(condense)";
    } else {
      bt.className = 'condensed';
      toggler.innerHTML = "(expand)";
    }
  }
  //-->
  </script>
...
...
...
         <tr>
           <td>rack.multiprocess</td>
           <td class="code"><div>false</div></td>
         </tr>
         
         <tr>
           <td>rack.multithread</td>
           <td class="code"><div>true</div></td>
         </tr>
         
         <tr>
           <td>rack.request.cookie_hash</td>
           <td class="code"><div>{}</div></td>
         </tr>
         
         <tr>
           <td>rack.request.query_hash</td>
           <td class="code"><div>{}</div></td>
         </tr>
         
         <tr>
           <td>rack.request.query_string</td>
           <td class="code"><div></div></td>
         </tr>
         
         <tr>
           <td>rack.run_once</td>
           <td class="code"><div>false</div></td>
         </tr>
         
         <tr>
           <td>rack.url_scheme</td>
           <td class="code"><div>http</div></td>
         </tr>
         
         <tr>
           <td>rack.version</td>
           <td class="code"><div>[1, 3]</div></td>
         </tr>
         
         <tr>
           <td>sinatra.accept</td>
           <td class="code"><div>[#&lt;Sinatra::Request::AcceptEntry:0x00007f81107ff1a0 @entry=&quot;*&#x2F;*&quot;, @type=&quot;*&#x2F;*&quot;, @params={}, @q=1.0&gt;]</div></td>
         </tr>
         
         <tr>
           <td>sinatra.error</td>
           <td class="code"><div>#&lt;NameError: uninitialized constant Gemstash::DB::Authorization
Did you mean?  Gemstash::Authorization&gt;</div></td>
         </tr>
         
         <tr>
           <td>sinatra.route</td>
           <td class="code"><div>POST &#x2F;api&#x2F;v1&#x2F;gems</div></td>
         </tr>
         
      </table>
      <div class="clear"></div>
    </div> <!-- /RACK ENV -->

    <p id="explanation">You're seeing this error because you have
enabled the <code>show_exceptions</code> setting.</p>
  </div> <!-- /WRAP -->
  </body>
</html>

@bronzdoc
Copy link
Member

@donghoang89 is this still an issue for you with the latest Gemstash version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants