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
You can download Saas Modules and Access Modules.