This setup guide covers the configuration and deployment of an Odoo on-premise instance with Nginx as a reverse proxy and automatic SSL certificate renewal and application.
This config has been made for a VPS with 6vcpu 16RAM.
odoo.conf: Configuration file for Odoo.postgres.conf: Configuration file for PostgreSQL.nginx/: Directory containing Nginx configuration files.build_image.sh: Script to build the Odoo image fromodoo.deb.odoo.deb: Odoo package, which must be downloaded from Odoo's official site.Dockerfile: Dockerfile used to build the Odoo image.docker-compose.yml: Docker Compose file to orchestrate the Odoo services on-premise.cert_renew_and_load.sh: Script used to renew and apply SSL certificates.send_log_via_mailgun.sh: Script used to send notifications via Mailgun when the SSL certificate has been updated.cronjob: Cron job entry for renewing the SSL certificate automatically.
-
Odoo and PostgreSQL Configuration:
- Adjust
odoo.confandpostgres.confaccording to your specific requirements. - Copy all these files to your VPS, e.g.,
~/odoo17-enterprise.
- Adjust
-
Nginx Setup:
- Place your Nginx configuration files in the
nginx/directory. - Ensure Nginx is configured to serve Odoo and handle SSL termination.
- Place your Nginx configuration files in the
-
Building Odoo Image:
- Download
odoo.debfrom the provided link. - Run
build_image.shto build your Docker image.
- Download
-
Running the Services:
- Use
docker-compose up -dto start the services defined indocker-compose.yml.
- Use
-
SSL Certificate Renewal:
- Ensure
cert_renew_and_load.shandsend_log_via_mailgun.share executable. - Update the cron job script with the correct paths and ensure it is added to your crontab.
- Ensure
To ensure your SSL certificates are automatically renewed, add the following cron job to your system:
0 4 10 * * /root/odoo17-enterprise/cert_renew_and_load.sh >> /root/odoo17-enterprise/cert_renew_and_load.log 2>&1; /root/odoo17-enterprise/send_log_via_mailgun.sh
This cron job will attempt to renew the SSL certificate on the 10th of every month at 4:00 AM. After attempting renewal, it will send a log via Mailgun.
- Feels free to improve this config.
- Remember to replace placeholders in scripts and configuration files with your actual data, such as domain names, email addresses, and API keys.
- Regularly check the logs for any errors and monitor the SSL certificate's renewal status.
For additional help or information, please refer to the Odoo documentation or contact support.