Tag: Odoo

  • odoo Unable to find Wkhtmltopdf on this system

    odoo Unable to find Wkhtmltopdf on this system

    On an odoo installation, I got the error “Unable to find Wkhtmltopdf on this system”, when generating reports.

    odoo Wkhtmltopdf error

    This error was because server had old version of wkhtmltopdf installed.

    You can download and install latest version of wkhtmltopdf from

    https://wkhtmltopdf.org/downloads.html

    On Ubuntu 20.04, the error is fixed by

    Remove currently installed wkhtmltox

    apt remove --purge wkhtmltox
    

    Install newer version

    wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
    dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
    

    Create a symlink

    rm -f /usr/bin/wkhtmltopdf
    ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
    

    Restart odoo

    systemctl restart odoo
    
  • Install Odoo using Docker

    Odoo is an open source ERP and CRM software written in python. To install Odoo using docker, first install docker using

    wget -qO- https://get.docker.com/ | sh
    

    Odoo use PostgreSQL server to store database. Lets create a postgres docker container.

    docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=your-password-here -e POSTGRES_DB=postgres --name odoo-db postgres:10
    

    In above command, replace your-password-here with a secure password.

    Create a Odoo container with

    docker run -d -p 127.0.0.1:8069:8069 -p 127.0.0.1:8072:8072 --name odoo --link odoo-db:db -t odoo
    

    If container did not start on boot, enable start on boot with

    docker update --restart=unless-stopped CONTAINER_ID
    

    You can find CONTAINER_ID with docker ps or docker ps -a command.

    Next we need to configure a domain to be used with Odoo. For this, we use nginx web server as reverse proxy. Lets install nginx web server with command

    apt install nginx
    

    Install LetsEncrypt with

    wget https://raw.githubusercontent.com/serverok/server-setup/master/install/letsencrypt.sh
    bash ./letsencrypt.sh
    

    Before getting SSL, we need to configure Nginx web server with a simple config file for our domain.

    vi /etc/nginx/sites-enabled/odoo.conf
    

    Add

    server {
        listen 80;
        server_name YOUR-DOMAIN_HERE;
        root /var/www/html;
    }
    

    Restart nginx

    systemctl restart nginx
    

    At this point, nginx will serve the web site from /var/www/html folder. Lets get an SSL certficate using certbot

    certbot --authenticator webroot --webroot-path /var/www/html --installer nginx -d YOUR-DOMAIN_HERE
    

    Once you have SSL, we need to replace the nginx config with proper nginx config

    vi /etc/nginx/sites-enabled/odoo.conf
    

    Replace everything in the file with following content.

    upstream odoo {
        server 127.0.0.1:8069;
    }
    
    upstream odoo-chat {
        server 127.0.0.1:8072;
    }
    
    server {
        listen 80;
        server_name YOUR-DOMAIN-HERE;
    
        location ^~ /.well-known/acme-challenge/ {
            root /var/www/html;
        }
    
        location / {
            return 301 https://YOUR-DOMAIN-HERE$request_uri;
        }
    }
    
    server {
        listen 443 ssl http2;
        server_name YOUR-DOMAIN-HERE;
        ssl_certificate /etc/letsencrypt/live/YOUR-DOMAIN-HERE/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/YOUR-DOMAIN-HERE/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
        resolver 8.8.8.8 8.8.4.4;
        access_log /var/log/nginx/odoo-access.log;
        error_log /var/log/nginx/odoo-error.log;
    
        proxy_read_timeout 720s;
        proxy_connect_timeout 720s;
        proxy_send_timeout 720s;
        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;
    
        location / {
            proxy_redirect off;
            proxy_pass http://odoo;
        }
    
        location /longpolling {
            proxy_pass http://odoo-chat;
        }
    
        location ~* /web/static/ {
            proxy_cache_valid 200 90m;
            proxy_buffering    on;
            expires 864000;
            proxy_pass http://odoo;
        }
    
        gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
        gzip on;
    }
    

    Restart nginx

    systemctl restart nginx
    

    At this point, if you go to your web site, you will see Odoo install screen. All you need to do here is enter a database name and fill some information. You can select any database name, installer will create the database.

  • Odoo apt signatures couldn’t be verified

    When updating apt on Ubuntu server, i get following error

    root@ip-172-31-25-25:/home/ubuntu# apt-get update 
    Hit:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
    Hit:2 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease                                                         
    Hit:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease                                                       
    Ign:4 http://nightly.odoo.com/9.0/nightly/deb ./ InRelease                                                       
    Get:5 http://nightly.odoo.com/9.0/nightly/deb ./ Release [1186 B]                      
    Get:6 http://nightly.odoo.com/9.0/nightly/deb ./ Release.gpg [819 B]
    Ign:6 http://nightly.odoo.com/9.0/nightly/deb ./ Release.gpg
    Get:7 http://nightly.odoo.com/9.0/nightly/deb ./ Packages [1790 B]
    Hit:8 http://security.ubuntu.com/ubuntu xenial-security InRelease
    Fetched 3795 B in 2s (1736 B/s)
    Reading package lists... Done
    W: GPG error: http://nightly.odoo.com/9.0/nightly/deb ./ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY DEF2A2198183CBB5
    W: The repository 'http://nightly.odoo.com/9.0/nightly/deb ./ Release' is not signed.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    root@ip-172-31-25-25:/home/ubuntu# 
    

    To fix, run

    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DEF2A2198183CBB5