it-projects-llc / odoo-saas-tools

Odoo SaaS Tools — tools for SaaS Businesses. Sale and manage Odoo databases.
https://saas.it-projects.info
GNU Lesser General Public License v3.0
571 stars 581 forks source link

SaaS Server on a separate machine? #327

Open erkesado opened 8 years ago

erkesado commented 8 years ago

Hi,

How to maintain SaaS Servers on different machines than SaaS Portal? Could you provide any documentation?

Thanks in advance, erke

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36179500-saas-server-on-a-separate-machine?utm_campaign=plugin&utm_content=tracker%2F3643037&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3643037&utm_medium=issues&utm_source=github).
erkesado commented 8 years ago

Please help me, guys

yelizariev commented 8 years ago

you can.

For multiple servers, you have to use https://github.com/it-projects-llc/odoo-saas-tools/tree/9.0/saas_sysadmin_route53

erkesado commented 8 years ago

Thank you very much

iledarn commented 8 years ago

I think this is the documentation: https://github.com/iledarn/odoo-saas-tools/blob/9.0/docs/install.rst

You create odoo database for SaaS Server on different machine. Then you install the module 'saas_server' there. See 2,3,4 install.rst instruction points.

KaloyanNaumov commented 8 years ago

I'm trying to setup a multi-server configuration on Odoo 9 and am getting blocked on the OAuth level. Both hosts are populated with propper /etc/hosts file and know of each other. NginX configuration is also correct, from what i see.

Login from the Portal server's DBs & Sites works well (portal, server, template), but not from the remote. The remote Server is listed in the Portal -> SaaS -> OAuth Applications list, as successfully connected with the correct DB UUID, as is the SaaS -> Server definition.

From the remote server's I can't login with OAuth, only with local admin is OK. Logs indicate that the tokens are passed, but Authentication is failing Portal:

2016-08-26 20:38:49,798 18297 INFO saas.local werkzeug: 127.0.0.1 - - [26/Aug/2016 20:38:49] "GET /oauth2/auth?scope=userinfo&state=%7B%22p%22%3A+4%2C+%22r%22%3A+%22http%253A%252F%252Fs2.saas.local%252Fweb%22%2C+%22d%22%3A+%22s2.saas.local%22%7D&redirect_uri=http%3A%2F%2Fs2.saas.local%2Fauth_oauth%2Fsignin&response_type=token&client_id=cf7ff087-6bc5-11e6-876e-7831c1ceb5a2 HTTP/1.0" 302 -

Server:

2016-08-26 20:56:05,166 62668 INFO s2.saas.local werkzeug: 127.0.0.1 - - [26/Aug/2016 20:56:05] "GET /auth_oauth/signin HTTP/1.0" 200 -
url http://s2.saas.local:8069/oauth2/tokeninfo?access_token=LzKTMtHv92Pg1q6AR9ZTIOttKaIlf3
2016-08-26 20:56:07,375 62669 INFO ? werkzeug: 10.211.55.2 - - [26/Aug/2016 20:56:07] "GET /oauth2/tokeninfo?access_token=LzKTMtHv92Pg1q6AR9ZTIOttKaIlf3 HTTP/1.1" 404 -
2016-08-26 20:56:07,376 62668 ERROR s2.saas.local openerp.addons.auth_oauth.controllers.main: OAuth2: HTTP Error 404: NOT FOUND
Traceback (most recent call last):
  File "/Users/kani/odoo9/odoo/addons/auth_oauth/controllers/main.py", line 142, in signin
    credentials = u.auth_oauth(cr, SUPERUSER_ID, provider, kw, context=context)
  File "/Users/kani/odoo9/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/Users/kani/odoo9/odoo/addons/auth_oauth/res_users.py", line 101, in auth_oauth
    validation = self._auth_oauth_validate(cr, uid, provider, access_token, context=context)
  File "/Users/kani/odoo9/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/Users/kani/odoo9/ITP-odoo-saas-tools/auth_oauth_ip/models.py", line 48, in _auth_oauth_validate
    validation = self._auth_oauth_rpc(cr, uid, p.validation_endpoint, access_token, context=context, local_ip=p.local_ip, local_port=p.local_port)
  File "/Users/kani/odoo9/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/Users/kani/odoo9/ITP-odoo-saas-tools/auth_oauth_ip/models.py", line 40, in _auth_oauth_rpc
    f = urllib2.urlopen(req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: NOT FOUND
2016-08-26 20:56:07,377 62668 INFO s2.saas.local werkzeug: 127.0.0.1 - - [26/Aug/2016 20:56:07] "GET /auth_oauth/signin?access_token=LzKTMtHv92Pg1q6AR9ZTIOttKaIlf3&token_type=Bearer&state=%7B%22p%22%3A+4%2C+%22r%22%3A+%22http%253A%252F%252Fs2.saas.local%252Fweb%22%2C+%22d%22%3A+%22s2.saas.local%22%7D&expires_in=3600&scope=userinfo HTTP/1.0" 303 -
2016-08-26 20:56:07,756 62669 INFO s2.saas.local werkzeug: 127.0.0.1 - - [26/Aug/2016 20:56:07] "GET /web/login?oauth_error=2 HTTP/1.0" 200 -
2016-08-26 20:56:07,836 62668 INFO s2.saas.local werkzeug: 127.0.0.1 - - [26/Aug/2016 20:56:07] "POST /website/translations HTTP/1.0" 200 -

I've changed the roles of the two hosts - which holds the portal and which the remote server, same behaviour.

Any ideas what might be wrong?

Thank you very much for this great SaaS application and all your great modules!

yelizariev commented 7 years ago
  validation = self._auth_oauth_rpc(cr, uid, p.validation_endpoint, access_token, context=context, local_ip=p.local_ip, local_port=p.local_port)

check your local_ip value. It has to point to your saas portal

njeudy commented 6 years ago

@erkesado is it ok now ?