elosys:setup_template

Setup Template DB Script

  • This script is designed to automate the setup of Odoo databases with and without demo data. It interacts with Docker containers running Odoo and PostgreSQL to create, update, and manage databases.
  • You can find the script on Gitlab
  • Navigate to rembin/ directory
  • execute the script :
./setup_template_db.sh <version_number>
  • <version_number>: The version number of Odoo to use for database creation.

Example

./setup_template_db.sh 14
  • This command sets up Odoo databases using version 14, creating databases both with and without demo data.
  • Docker: The script relies on Docker for containerization.
  • PostgreSQL: The script uses PostgreSQL for database management.
  • VERSION: The version number of Odoo provided as the first argument to the script.
  • DBASENAME: The base name for the Odoo database. It is composed of “base” followed by the version number.
  • IMAGE: The Docker image name for Odoo, derived from the version number.
  • FILESTORE: The directory path for storing files related to Odoo.
  • setup_template_dbs(): This function sets up Odoo databases with and without demo data.
    • Parameters:
      • $1: The name of the database.
      • $2: The Docker image for Odoo.
    • Steps:
      • Checks if the database exists. If yes, deletes it.
      • Checks if the database with demo data exists. If yes, deletes it.
      • Creates a database with demo data.
      • Stops and removes the Docker container after initialization.
      • Creates a database without demo data.
  1. Checks if the script is provided with the required version number. If not, it displays an error message and exits.
  2. Calls the setup_template_dbs function with the base database name and the Odoo Docker image.
  • The script assumes the presence of a Docker network named app_net.
  • It links the Odoo container with the PostgreSQL container named pushdb.
  • It mounts the FILESTORE directory to /var/lib/odoo in the Odoo container for file storage.

Nadir Habib 2024/04/27 22:02

  • elosys/setup_template.txt
  • Last modified: 2024/04/27 22:03
  • by nadir