{"action":"created","issue":{"url":"https://api.github.com/repos/SUSE/Portus/issues/376","labels_url":"https://api.github.com/repos/SUSE/Portus/issues/376/labels{/name}","comments_url":"https://api.github.com/repos/SUSE/Portus/issues/376/comments","events_url":"https://api.github.com/repos/SUSE/Portus/issues/376/events","html_url":"https://github.com/SUSE/Portus/issues/376","id":109058990,"number":376,"title":"Portus not able to authenticate itself using portus username","user":{"login":"aleksnikolic","id":2639449,"avatar_url":"https://avatars.githubusercontent.com/u/2639449?v=3","gravatar_id":"","url":"https://api.github.com/users/aleksnikolic","html_url":"https://github.com/aleksnikolic","followers_url":"https://api.github.com/users/aleksnikolic/followers","following_url":"https://api.github.com/users/aleksnikolic/following{/other_user}","gists_url":"https://api.github.com/users/aleksnikolic/gists{/gist_id}","starred_url":"https://api.github.com/users/aleksnikolic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleksnikolic/subscriptions","organizations_url":"https://api.github.com/users/aleksnikolic/orgs","repos_url":"https://api.github.com/users/aleksnikolic/repos","events_url":"https://api.github.com/users/aleksnikolic/events{/privacy}","received_events_url":"https://api.github.com/users/aleksnikolic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mssola","id":767943,"avatar_url":"https://avatars.githubusercontent.com/u/767943?v=3","gravatar_id":"","url":"https://api.github.com/users/mssola","html_url":"https://github.com/mssola","followers_url":"https://api.github.com/users/mssola/followers","following_url":"https://api.github.com/users/mssola/following{/other_user}","gists_url":"https://api.github.com/users/mssola/gists{/gist_id}","starred_url":"https://api.github.com/users/mssola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mssola/subscriptions","organizations_url":"https://api.github.com/users/mssola/orgs","repos_url":"https://api.github.com/users/mssola/repos","events_url":"https://api.github.com/users/mssola/events{/privacy}","received_events_url":"https://api.github.com/users/mssola/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2015-09-30T10:33:44Z","updated_at":"2015-10-07T19:01:36Z","closed_at":null,"body":"Hi @mssola . Opening a new issue as the #338 is now closed.\r\n\r\nI am running the latest portus version from master that includes your yesterday's changes in log verbosity when Portus is not allowed to pull manifest from the registry.\r\n\r\n```ruby\r\nCould not fetch the tag for target {\"mediaType\"=>\"application/vnd.docker.distribution.manifest.v1+json\", \"size\"=>23172, \"digest\"=>\"sha256:74d37aa2f8486bfc81bc3ca3e80978a4826034c4dd5804abc2090948c4fde7d8\", \"length\"=>23172, \"repository\"=>\"aleks/distribution\", \"url\"=>\"https://distribution.testcompany.co.uk/v2/aleks/distribution/manifests/sha256:74d37aa2f8486bfc81bc3ca3e80978a4826034c4dd5804abc2090948c4fde7d8\"}\r\nReason: Cannot obtain authorization token: #<Net::HTTPForbidden:0x007fb08a722940>\r\nCompleted 202 Accepted in 167ms (ActiveRecord: 1.6ms)\r\n```\r\n\r\nI have checked the database and Portus user does exist:\r\n```sql\r\nmysql> select * from users where username = 'portus'\\G;\r\n*************************** 1. row ***************************\r\n                    id: 1\r\n              username: portus\r\n                 email: portus@portus.com\r\n    encrypted_password: $2a$10$P.SZmuTM84m2YIJeTKvBketwsq281r4hhynuh2pSbNswDmxCLaFpy\r\n  reset_password_token: NULL\r\nreset_password_sent_at: NULL\r\n   remember_created_at: NULL\r\n         sign_in_count: 1\r\n    current_sign_in_at: 2015-09-29 15:35:35\r\n       last_sign_in_at: 2015-09-29 15:35:35\r\n    current_sign_in_ip: 172.17.0.2\r\n       last_sign_in_ip: 172.17.0.2\r\n            created_at: 2015-09-29 15:05:45\r\n            updated_at: 2015-09-29 15:35:35\r\n                 admin: 1\r\n               enabled: 1\r\n             ldap_name: NULL\r\n       failed_attempts: 0\r\n             locked_at: NULL\r\n1 row in set (0.00 sec)\r\n```\r\nThe password is correct as I was able to login through remote docker client using username 'portus' and the password define in secrets.yml and I was able to push images to registry. \r\n\r\n```bash\r\naleksandarnikolic~:$ docker login distribution.testcompany.co.uk\r\nUsername (aleks): portus\r\nPassword:\r\nEmail (aleks@testcompany.co.uk): portus@portus.com\r\nWARNING: login credentials saved in /Users/aleksnikolic/.dockercfg.\r\nLogin Succeeded\r\naleksandarnikolic~:$\r\n```\r\n\r\nIs there any manual step that maybe I have missed during setup?  The reason why I haven't used your compose setup script is because I have mysqldb on the remote host. The only manual thing i did is:\r\n```ruby\r\nrake db:create db:migrate db:seed\r\n```\r\n\r\nThe registry config is:\r\n```bash\r\nversion: 0.1\r\nlog:\r\n  fields:\r\n    service: registry\r\nstorage:\r\n    cache:\r\n        layerinfo: inmemory\r\n    filesystem:\r\n        rootdirectory: /data/registry\r\nhttp:\r\n    addr: 0.0.0.0:5000\r\n    debug:\r\n       addr: 0.0.0.0:5001\r\nauth:\r\n  token:\r\n    realm: https://portus.testcompany.co.uk/v2/token\r\n    service: distribution.testcompany.co.uk\r\n    issuer: portus.test.lan\r\n    rootcertbundle: /registry/portus.crt\r\nnotifications:\r\n  endpoints:\r\n    - name: portus\r\n      url: http://portus:3000/v2/webhooks/events\r\n      timeout: 500ms\r\n      threshold: 5\r\n      backoff: 1s\r\n```\r\nMy compose file is:\r\n```bash\r\ndistribution:\r\n     environment:\r\n        -  VIRTUAL_HOST=distribution.testcompany.co.uk\r\n        -  VIRTUAL_PORT=5000\r\n        -  DOCKER_HOST=distribution2.testcompany.co.uk\r\n        -  CLIENT_MAX_BODY_SIZE=0\r\n     image: docker.testcompany.co.uk/distribution:latest\r\n     volumes:\r\n        -  \"/data/registry:/data/registry\"\r\n     expose:\r\n        -  5000\r\n        -  5001\r\n     links:\r\n        - portus\r\nportus:\r\n     environment:\r\n        -  VIRTUAL_HOST=portus.testcompany.co.uk\r\n     image: docker.testcompany.co.uk/portus:latest\r\n     external_links:\r\n        -  mysqldambassador_ambassador_1:db\r\n     expose:\r\n        -  3000\r\n     command: thin start\r\n     volumes:\r\n        -  \"/usr/local/keys/database.yml:/portus/config/database.yml:ro\"\r\n```\r\n\r\nPlease let me know if you need more details."},"comment":{"url":"https://api.github.com/repos/SUSE/Portus/issues/comments/146294762","html_url":"https://github.com/SUSE/Portus/issues/376#issuecomment-146294762","issue_url":"https://api.github.com/repos/SUSE/Portus/issues/376","id":146294762,"user":{"login":"travisghansen","id":225404,"avatar_url":"https://avatars.githubusercontent.com/u/225404?v=3","gravatar_id":"","url":"https://api.github.com/users/travisghansen","html_url":"https://github.com/travisghansen","followers_url":"https://api.github.com/users/travisghansen/followers","following_url":"https://api.github.com/users/travisghansen/following{/other_user}","gists_url":"https://api.github.com/users/travisghansen/gists{/gist_id}","starred_url":"https://api.github.com/users/travisghansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travisghansen/subscriptions","organizations_url":"https://api.github.com/users/travisghansen/orgs","repos_url":"https://api.github.com/users/travisghansen/repos","events_url":"https://api.github.com/users/travisghansen/events{/privacy}","received_events_url":"https://api.github.com/users/travisghansen/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T19:01:36Z","updated_at":"2015-10-07T19:01:36Z","body":"@aleksnikolic are you running this with apache/passenger or using ```bundle exec thin start``` or similar?\r\n\r\nI'm running into this using thin and I believe it's a concurrency issue.  For example *something* is triggering the:\r\n```POST \"/v2/webhooks/events\"```\r\nand when that happens I immediately try to access the portus web interface in my browser (which just sits there waiting).  After the waiting a few moments I get the error on the portus log:\r\n```Reason: Cannot obtain authorization token: #<Net::HTTPGatewayTimeOut:0x0000000518d4b8>```\r\n\r\nAt which point my browser loads the page appropriately.  Subsequently another\r\n```POST \"/v2/webhooks/events\"```\r\ncomes through at which point my browser interface blocks again.  Repeat.\r\n\r\nTaking it a step further, since my browser interface is blocking I'm certain the docker client trying to grab an auth token simultaneously is doing the same thing.\r\n\r\nBasically the app trying to handle 2 requests simultaneously is killing it.  In this particular case:\r\n```POST \"/v2/webhooks/events\"```\r\nwhich eventually triggers a reciprocal\r\n```Started GET \"/v2/token?account=portus&scope=...```\r\n\r\nIf anyone has any tips to overcome this issue I'd be happy to test.  I'm not really a ruby dev so I'm too unfamiliar with some of these components :(\r\n"}}