postgres-api icon indicating copy to clipboard operation
postgres-api copied to clipboard

postgres-api: Improve documentation, fix bugs

Open mtekel opened this issue 10 years ago • 0 comments

Hi,

it would be great if it was documented more explicitly that there are only two plans currently available:

  • dedicated - not working yet*
  • shared - the only currently working plan, but with few bugs:

postgresapi itself doesn't correctly list these plans (when you try to get /plans, you always get {}), you have to look into the code. Also, enabling plans via POSTGRES_API_PLANS variable simply doesn't work, the code is buggy

Also the nomenclature of plan being a service plan and plan also being resource allocation plan (cpu, memory) is a bit confusing.

Another problem is with service instance names - as they translate directly into database names in postgresql. When you use any capital letter, things break - as databases are created in lowercase. When you then try to bind instance, you get Error: Failed to bind the instance "pTest12" to the app "dashboard": FATAL: database "pTest12" does not exist (it tries to open pTest12 DB, but the real name in psql is ptest12). This also means the database doesn't get destroyed on service instance destruction. When you later try to create instance named pTest12 you get Error: Failed to create the instance pTest12: Instance pTest12 already exists - because it fails creating ptest12 DB, as it still exists. These issues are raised in https://github.com/tsuru/postgres-api/issues/8 and https://github.com/tsuru/postgres-api/issues/9

I think for now this should be at least explicitly documented and later properly fixed.

Thanks!

* when you try dedicated service expect errors:

Error: Failed to create the instance test: <html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>

  </body>
</html>

returned by tsuru commandline client

2015-06-10 15:16:53 +0100 [api][e49935a461a1]: [2015-06-10 14:16:53 +0000] [48] [ERROR] Error handling request
2015-06-10 15:16:53 +0100 [api][e49935a461a1]: Traceback (most recent call last):
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 130, in handle
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:     self.handle_request(listener, req, client, addr)
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 171, in handle_request
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:     respiter = self.wsgi(environ, resp.start_response)
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:     return self.wsgi_app(environ, start_response)
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:     response = self.make_response(self.handle_exception(e))
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/flask/app.py", line 1577, in make_response
2015-06-10 15:16:53 +0100 [api][e49935a461a1]:     rv = self.response_class.force_type(rv, request.environ)
2015-06-10 15:16:54 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/werkzeug/wrappers.py", line 841, in force_type
2015-06-10 15:16:54 +0100 [api][e49935a461a1]:     response = BaseResponse(*_run_wsgi_app(response, environ))
2015-06-10 15:16:54 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/werkzeug/wrappers.py", line 57, in _run_wsgi_app
2015-06-10 15:16:54 +0100 [api][e49935a461a1]:     return _run_wsgi_app(*args)
2015-06-10 15:16:54 +0100 [api][e49935a461a1]:   File "/home/application/.app_env/local/lib/python2.7/site-packages/werkzeug/test.py", line 867, in run_wsgi_app
2015-06-10 15:16:54 +0100 [api][e49935a461a1]:     app_rv = app(environ, start_response)
2015-06-10 15:16:54 +0100 [api][e49935a461a1]: TypeError: 'MaxRetryError' object is not callable

present in the postgresapi logs.

mtekel avatar Jun 11 '15 09:06 mtekel