Enable Dark Mode!
odoo-saas-setup-in-server.png
By: Sayooj ao

How to Setup Odoo-Saas in Server?

Technical

This blog discusses the implementation of Odoo ERP as Saas (Software as a service). Saas comes as a software distribution model, allowing the application providers to offer their third-party applications or services to the clients via the internet. The clients can later access the application by providing a unique username and password.

Advantages Of Saas

    1. Time-Saving, Profit-Generating, Flexibility in Use, Cost Effective.

    2. Improvement in Product/Services Quality.

    3. Lesser Management and Enhanced Productivity.

    4. Decrements in software privacy.

The scope of Saas in Odoo

Implementation of saas will be an asset to those companies who like to provide their key service to a number of clients. Here in the case, the clients have to pay each month or year for license and they don’t need a server,  nor they need to install the application on their computer. Clients (one or thousands) can access the software or service (with unique username and password) and it’s all part (based on subscription plan). The company can define the various plan according to the behavior of the customers.

Implementation Of Saas in Odoo

Requirements

    1. Odoo with the latest version.

    2. Domain with or without an SSL certificate.

    3. Saas setup tool modules with the version of odoo used.

    4. Saas access modules with the version of odoo used.

External Packages

sphinx==1.2.3

mercurial==3.2.2

sphinx-patchqueue==0.4.0

Odoo Configurations

1. Install Odoo

Install Odoo from git using script.
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh
sudo chmod +x odoo_install.sh
sudo ./odoo_install.sh

With /etc/odoo.conf have

[options]
;admin password for PostgreSQL database
admin_passwd = qazxsw
;specify additional addons paths (separated by commas)
addons_path = /odoo/odoo-server/addons,/odoo/custom/addons,
/odoo/custom/odoo-saas-tools, /odoo/custom/access-addons
;Filter listed database REGEXP
dbfilter = ^%h$
xmlrpc_port = 8069
;specify the TCP port for longpolling requests.
longpolling_port = 8072
;;Database options
;specify the database name
db_name = False
;specify the database user name
db_user = odoo
;specify the database password
db_password = False
;specify the database host
db_host = False
;specify the database port
db_port = 5432;specify the the maximum number of physical connections to posgresql
;;logging options
;Specify the log file to store the log details.
logfile = /var/log/odoo/odoo-server.log

Install nginx

sudo apt-get install nginx

2. Set reverse proxy on nginx. Add this thing to below file into cd /etc/nginx/sites-enabled

server {
    server_name example.com *.example.com ;
    listen 80;
    access_log /var/log/nginx/testing-access.log;
    error_log /var/log/nginx/testing-error.log;
    location /longpolling {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8072;
}
    location / {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8069/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    gzip on;
    gzip_min_length 1000;
}
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
Usage Create two databases for the portal and server. Example: example.com and server.example.com

1. Install Saas portal modules in the Portal database and Saas server modules in the Server database.

2. DB Names in plans = “example%i.domainname.com” it creates databases as

   example001.domainname.com,

   example002.domainname.com

3. Configuration Of Saas Portal.

Go to Saas -> Configuration -> settings -> Set “Base SaaS domain” to your “Domain Name

4. Configuration Of Saas Server.

Go to Saas -> Server -> Select server -> Click on “Open Server, this will direct to the server database

After activating the developer mode go to Settings -> OAuth Providers -> Saas -> and copy the client id

Set the Authentication URL to http://Your Domain name/oauth2/auth

Set the Validation URL to http://Your Domain name/oauth2/tokeninfo

Return to the portal database and go to  Saas -> Server -> Select server, then paste the copied client id in the field “Database UUID” then click “Sync Server”.

Odoo Performance tuning

1. Rule of thumb:

workers = [ 1 + number of cores * 2]

1 woker = 6 concurrent user

Odoo need crone workers. So we divide above worker into worker + crone worker

The worker become

worker? = worker -1 \\ worker - Max_cron_threads

max_cron_threads? = 1

memory calculations use total workers

limit-memory-soft? = 640 x workers \ \ Bytes (in binary)memory-hard? = 768MB x workers \ \ Bytes (in binary)

Eg: Core=2, RAM = 2

workers = 1+2*2 = 5

Max_cron_threads = 1

Worker = 4

memory calculations use total workers.

limit-memory-soft = 5*640 = 3200 MB = 3355443200 Bytes

memory-hard = 768 x 5 = 3840 MB = 4026531840 Bytes

2. Max_connection rule [used in postgres conf file]

(1 + workers + max_cron_threads) * db_maxconn ? < ? max_connections

For example, if you have following values:

workers = 1 (minimal value to make long polling work)

max_cron_threads = 2 (default)

db_maxconn = 64 (default)

max_connections = 100 (default)

then (1 + 1 + 2) * 64 = 256 > 100, i.e. the condition is not satisfied and such

deployment may face the error described above.

Client Database Configuration

Saas ->Clients -> Select Client -> Click on “Configure”, here we can Install, Update or Uninstall the modules

odoo-saas setup in server-1

You can download Saas Modules and  Access Modules.


If you need any assistance in odoo, we are online, please chat with us.



6
Comments

mohamed

Thank you It reached the stage Usage Create two databases for the portal and server. Example: example.com and server.example.com The model has been lifted but I do not know what the next step

30/08/2019

-

8:40AM

Bishal Giri

I an trying to configure Odoo saas. Everything is working as expected but i couldn't login to Sass Portal via "Login to Saas Portal". I have done the following steps for installing the Saas 1. Created two database named local and server 2. Set the db-filter = ^%d$ 3.Corresponding subdoamin for the local and server database are local.samagyan.com and server.samagyan.com 4. Installed the saas_portal and saas_portal* in local db and saas_server and saas_server* in server database 5. In the Oauth Providers (Users & Companies menu) section, I kept the authentication url as "http://local.samagyan.com/oauth2/auth" and Validation url as " http://local.samagyan.com/oauth2/tokeninfo" After this step, i am lost. Can you please help what i should do after this

24/04/2019

-

10:48PM

Sayooj

Hi Sahyog, it is based on the name of your conf file name.If your file name is odoo-server.conf you follow the further steps with that file.

23/05/2019

-

10:18PM

sahyog

is it With /etc/odoo.conf ? or /etc/odoo-server.conf ?

19/05/2019

-

7:02PM

Sayooj

Hi Bishal Giri, After changing the authentication url follow the steps below In the server database go to Settings -> Activate developer Mode -> Oauth Providers ->Saas -> Then copy the Client Id from the page Then return to the Portal database -> Select the menu Saas -> Servers -> While configuring the server paste the copied Client id in the field in the Database UUID -> Then click on sync server and follow the remaining steps in the blog

17/05/2019

-

9:15PM

ARISTIDE ATSE

Thanks you for your excellent article,. Please how to setup the saas with letsencrypt SSL certificate ?. Best regards

10/04/2019

-

8:52AM



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message