Odoo

Odoo on CentOS 7 : https://www.rosehosting.com/blog/install-odoo-12-on-centos-7/

or official one : https://www.odoo.com/documentation/12.0/setup/install.html#fetch-the-sources

Don’t forget –depth 1 (otherwise : 2.3 GB, :-))

for os x, install postgres app, add bin directory to path in bash profile :

export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

If os x Mojave, install header for zlib with this command :

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

For dev :

create a base module:

./odoo-bin scaffold mymodule ../odoo-modules/

install watchdog to auto update on code update

pip3 install watchdog

start server with external modules and development tools, -u mymodule is for update mymodule in development before start.

./odoo-bin --addons-path=addons,../odoo-modules/ --db-filter=odoo --dev=reload -u mymodule

follow odoo install from https://linuxize.com/post/how-to-deploy-odoo-12-on-ubuntu-18-04/

sudo yum install rh-python36 rh-python36-python-devel git gcc wget nodejs-less libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel

for long polling and, thus, chat : add the line to /etc/odoo.conf

workers = 2

add service file for systemd

cat /etc/systemd/system/odoo12.service
[Unit]
Description=Odoo12
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo12
PermissionsStartOnly=true
User=odoo12
Group=odoo12
ExecStart=/opt/odoo12/odoo-venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

add service and nginx configuration

cat /etc/nginx/sites-enabled/example.com

# Odoo servers
upstream odoo {
server 127.0.0.1:8069;
}

upstream odoochat {
server 127.0.0.1:8072;
}

# HTTP -> HTTPS
server {
listen 80;
server_name www.example.com example.com;

include snippets/letsencrypt.conf;
return 301 https://example.com$request_uri;
}

# WWW -> NON WWW
server {
listen 443 ssl http2;
server_name www.example.com;

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include snippets/ssl.conf;

return 301 https://example.com$request_uri;
}

server {
listen 443 ssl http2;
server_name example.com;

proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;

# Proxy headers
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;

# SSL parameters
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include snippets/ssl.conf;

# log files
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;

# Handle longpoll requests
location /longpolling {
proxy_pass http://odoochat;
}

# Handle / requests
location / {
proxy_redirect off;
proxy_pass http://odoo;
}

# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}

# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

Selenium and chromedriver

on CentOS : install chromedriver and chromium browser and chromium headless, can be launched as root with –no-sandbox option

pip install selenium

example python script :

import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.headless = True
options.add_argument('--no-sandbox')
chrome_driver_binary = "chromedriver"
driver = webdriver.Chrome(chrome_driver_binary, chrome_options=options)
driver.get('http://www.google.com/xhtml');
#time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
#time.sleep(5) # Let the user actually see something!
driver.quit()