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
1 |
wget -qO- https://get.docker.com/ | sh |
Odoo use PostgreSQL server to store database. Lets create a postgres docker container.
1 |
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
1 |
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
1 |
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
1 |
apt install nginx |
Install LetsEncrypt with
1 2 |
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.
1 |
vi /etc/nginx/sites-enabled/odoo.conf |
Add
1 2 3 4 5 |
server { listen 80; server_name YOUR-DOMAIN_HERE; root /var/www/html; } |
Restart nginx
1 |
systemctl restart nginx |
At this point, nginx will serve the web site from /var/www/html folder. Lets get an SSL certficate using certbot
1 |
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
1 |
vi /etc/nginx/sites-enabled/odoo.conf |
Replace everything in the file with following content.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
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
1 |
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.
awesome…the guide is clean and clear..it works flawlessly