Zaqar-Server Issue

asked 2015-12-29 03:32:43 -0500

Neerja Narayan gravatar image

updated 2016-01-11 03:27:17 -0500

Bipin gravatar image

Hey I'm a newbie to Zaqar. I am currently working on Devstack liberty release.

When I run,

zaqar-server -v

2015-12-29 12:09:40.010 1084 WARNING oslo_config.cfg [-] Option "verbose" from group "DEFAULT" is deprecated for removal.  Its value may be silently ignored in the future.

2015-12-29 12:09:40.011 1084 DEBUG zaqar.bootstrap [-] Loading transport driver: websocket transport /opt/stack/zaqar/zaqar/bootstrap.py:105

2015-12-29 12:09:40.011 1084 DEBUG zaqar.bootstrap [-] Loading API handler api /opt/stack/zaqar/zaqar/bootstrap.py:66

2015-12-29 12:09:40.012 1084 DEBUG zaqar.bootstrap [-] Loading storage driver storage /opt/stack/zaqar/zaqar/bootstrap.py:73

2015-12-29 12:09:40.012 1084 DEBUG zaqar.bootstrap [-] Storage pooling enabled storage /opt/stack/zaqar/zaqar/bootstrap.py:75

2015-12-29 12:09:40.012 1084 DEBUG zaqar.bootstrap [-] Loading proxy cache driver cache /opt/stack/zaqar/zaqar/bootstrap.py:94

2015-12-29 12:09:40.013 1084 DEBUG zaqar.bootstrap [-] Loading storage control driver control /opt/stack/zaqar/zaqar/bootstrap.py:88

2015-12-29 12:09:40.053 1084 DEBUG zaqar.bootstrap [-] Loading storage pipeline storage /opt/stack/zaqar/zaqar/bootstrap.py:82

<LogRecord: trollius, 10, /usr/local/lib/python2.7/dist-packages/trollius/selector_events.py, 72, "Using selector: %s">

2015-12-29 12:09:40.175 1084 DEBUG trollius [-] Using selector: EpollSelector __init__ /usr/local/lib/python2.7/dist-packages/trollius/selector_events.py:72

2015-12-29 12:09:40.184 1084 INFO zaqar.transport.websocket.driver [-] Serving on host 10.20.33.6:9000

Summary

Zaqar-server is using the websocket driver and serving on 10.20.33.6:9000

While using the curl command for creating a queue.

curl -i -X PUT http://10.20.33.6:9000/v1/queues/sample -H "X-Auth-Token: 43b746c69bf94a7881749fdeb6aa8a6d" -H "Content-type: application/json" -d '{"metadata": "My Queue"}'

Output:

HTTP/1.1 405 HTTP method 'PUT' not allowed

While using curl command for listing queues,

curl -i -X GET http://10.20.33.6:9000/v1/queues -H "X-Auth-Token: 43b746c69bf94a7881749fdeb6aa8a6d"

Output:

HTTP/1.1 200 OK
Server: AutobahnPython/0.11.0
Content-Type: text/html; charset=UTF-8
Content-Length: 820


<!DOCTYPE html>
<html>
   <head>

      <style>
         body {
            color: #fff;
            background-color: #027eae;
            font-family: "Segoe UI", "Lucida Grande", "Helvetica Neue", Helvetica, Arial, sans-serif;
            font-size: 16px;
         }

         a, a:visited, a:hover {
            color: #fff;
         }

   </head>
   <body>
      <h1>AutobahnPython 0.11.0</h1>
      <p>
         I am not Web server, but a <b>WebSocket Endpoint</b>.
      </p>
      <p>
         You can talk to me using the <a href="http://tools.ietf.org/html/rfc6455">WebSocket</a> protocol.
      </p>
      <p>
         For more information, please see:
         <ul>
            <li><a href="http://autobahn.ws/python">AutobahnPython</a></li>
         </ul>
      </p>
   </body>
</html>
</style>

Additional Information:

sudo netstat -tulpn | grep '8888'

tcp        0      0 10.20.33.6:8888         0.0.0.0:*               LISTEN      23351/uwsgi     


sudo netstat -tulpn | grep '9000'

tcp        0      0 10.20.33.6:9000         0.0.0.0:*               LISTEN      1084/python     

sudo netstat -tulpn | grep uwsgi

tcp        0      0 10.20.33.6:8888         0.0.0.0:*               LISTEN      23351/uwsgi     

tcp ...
(more)
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-01-09 07:09:56 -0500

ubershy gravatar image

Hello. It's impossible to use curl utility when Zaqar is configured to use websocket driver.

Basically you are trying to use HTTP RESTful API ("wsgi" transport driver in "zaqar.conf"), while your Zaqar is configured to provide Websocket API ("websocket" transport driver in "zaqar.conf") with default port 9000.

NOTE: DevStack during "stack.sh" starts two instances of Zaqar: first one configured to use Websocket driver and listen on port 9000 (strictly using config "/etc/zaqar/zaqar.conf"), second one configured to use WSGI driver and listen on port 8888 (using config "/etc/zaqar/zaqar.conf" with transport driver option changed to "wsgi". If "~/.zaqar/zaqar.conf" configuration file exists, it overrides "/etc/zaqar/zaqar.conf"). But seems like you run Zaqar manually. In this case it's the same: if "~/.zaqar/zaqar.conf" configuration file exists, it overrides "/etc/zaqar/zaqar.conf"

If you run Zaqar using "stack.sh" script, there must be Zaqar instance running on port 8888, so just send your curl requests to port 8888.

If you run Zaqar manually:

If you want to use curl utility, the only solution is to configure Zaqar to use wsgi back end:

1) Find [drivers] section in your "zaqar.conf" and ensure that transport option is set to wsgi:

transport = wsgi

2) If you haven't changed port option in [drivers:transport:wsgi] section in "zaqar.conf", Zaqar will listen on default wsgi port 8888.

Or If you still want to use Zaqar Websocket API:

You can keep the current Zaqar configuration, but have to write client application that can connect to Zaqar through Websocket protocol or use the existing one. I don't know any existing ones, except websocket client example written in javascript in Zaqar repository: "examples/websocket.html". You can edit it and open it in your web-browser.

Please note that if you want to use Zaqar with keystone authentication in this websocket client example, you have to either:

a) Bypass CORS checks in your web browser. Follow https://blog.nraboy.com/2014/08/bypass-cors-errors-testing-apis-locally/ (Bypass CORS Errors When Testing APIs Locally) instruction.

or

b) Turn on CORS in keystone. Follow https://ianunruh.com/2014/11/openstack-cors.html (Enabling CORS in OpenStack APIs) instruction. Also add open_expose_headers=X-Subject-Token to [filter:cors] section, so websocket client will be able to get authentication token from HTTP header "X-Subject-Token".

PS: I'm a newbie developer in Zaqar. Zaqar still has not it's Configuration Reference hosted anywhere, but it will be fixed very soon and you'll be able to read conveniently about Zaqar configuration options. ;)

edit flag offensive delete link more
0

answered 2016-01-12 00:22:52 -0500

Neerja Narayan gravatar image

I had solved the issue earlier , but hadn't posted it here. Thanks for replying ubershy!

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-12-29 03:32:43 -0500

Seen: 407 times

Last updated: Jan 12 '16