Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Set admin password with environment variables

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
developmentconfigurationenvironmentenv
2 Replies
8296 Rodiniai
Portretas
Daniel Rodriguez

Hi,


I'm currently using the Odoo 17 docker image and would like to set the admin_passwd config value using environment variables.


  1. I've tried but do]esn't seem to work. Can ayone confirm if this is possible? 
  2. If it isn't, what options do I have or how can I "merge" odoo.conf files?

Thanks!

0
Portretas
Atmesti
Portretas
Gracious Joseph
Best Answer

In Odoo, setting the admin_passwd value using environment variables in a Dockerized setup is not directly supported out of the box. However, you can work around this limitation using the following methods:

1. Use Environment Variables with the Docker Image

The Odoo Docker image does not natively support environment variables to directly configure admin_passwd. However, you can achieve this by modifying the entrypoint script or dynamically injecting the value into the odoo.conf file.

Steps:

  1. Set Environment Variable in Docker:
    • Define the environment variable in your docker-compose.yml or when running the container:
      environment:
        - ADMIN_PASSWORD=my_secure_password
      
  2. Modify the Entrypoint Script:
    • Extend the official Odoo Docker image by creating a custom entrypoint script that writes the environment variable into the odoo.conf file.
    Example Dockerfile:
    FROM odoo:17
    
    COPY entrypoint.sh /entrypoint.sh
    RUN chmod +x /entrypoint.sh
    
    ENTRYPOINT ["/entrypoint.sh"]
    CMD ["odoo"]
    
    Example entrypoint.sh:
    #!/bin/bash
    
    # Add the admin_passwd value to the odoo.conf file
    if [ -n "$ADMIN_PASSWORD" ]; then
        echo "admin_passwd = $ADMIN_PASSWORD" >> /etc/odoo/odoo.conf
    fi
    
    # Execute the original entrypoint command
    exec "$@"
    
  3. Rebuild and Run the Container:
    • Build the custom image:
      docker build -t custom-odoo .
      
    • Run the container with the environment variable:
      docker run -e ADMIN_PASSWORD=my_secure_password custom-odoo
      

2. Alternative: Dynamically Update odoo.conf

If you don’t want to modify the Docker image, you can dynamically write the environment variable into the odoo.conf file during container startup.

Steps:

  1. Mount a Script to Modify odoo.conf:
    • Write a script that reads the ADMIN_PASSWORD environment variable and appends it to /etc/odoo/odoo.conf.
    Example script set_admin_password.sh:
    #!/bin/bash
    
    if [ -n "$ADMIN_PASSWORD" ]; then
        echo "admin_passwd = $ADMIN_PASSWORD" >> /etc/odoo/odoo.conf
    fi
    
    exec "$@"
    
  2. Add the Script in docker-compose.yml:
    services:
      odoo:
        image: odoo:17
        environment:
          - ADMIN_PASSWORD=my_secure_password
        volumes:
          - ./set_admin_password.sh:/usr/local/bin/set_admin_password.sh
        entrypoint: ["bash", "/usr/local/bin/set_admin_password.sh"]
    
  3. Run the Container:
    • The script will dynamically update odoo.conf before the container starts.

3. Combine odoo.conf Files

If you want to merge configuration files, you can copy multiple configuration files into the container and specify which files to include.

Steps:

  1. Create Multiple conf Files:
    • Create a base configuration file (e.g., base.conf) and an additional file for the admin password (e.g., admin.conf).
    Example admin.conf:
    [options]
    admin_passwd = my_secure_password
    
  2. Modify the Entrypoint:
    • Use the --config option to load multiple configuration files.
    • For example:
      odoo --config=/etc/odoo/base.conf --config=/etc/odoo/admin.conf
      
  3. Automate This with Docker:
    • Copy multiple configuration files into the container:
      volumes:
        - ./base.conf:/etc/odoo/base.conf
        - ./admin.conf:/etc/odoo/admin.conf
      
    • Modify the CMD or entrypoint to include the merged configuration.

4. Use a Secret Management Tool

For production, storing sensitive information like admin_passwd in plain text environment variables is not recommended. Use a secret management tool like Docker Secrets or HashiCorp Vault.

Using Docker Secrets:

  1. Create a Secret:
    echo "my_secure_password" | docker secret create odoo_admin_password -
    
  2. Update docker-compose.yml:
    services:
      odoo:
        image: odoo:17
        secrets:
          - odoo_admin_password
    secrets:
      odoo_admin_password:
        file: /run/secrets/odoo_admin_password
    
  3. Update the Entrypoint Script:
    • Read the secret file and add it to odoo.conf:
      if [ -f /run/secrets/odoo_admin_password ]; then
          ADMIN_PASSWORD=$(cat /run/secrets/odoo_admin_password)
          echo "admin_passwd = $ADMIN_PASSWORD" >> /etc/odoo/odoo.conf
      fi
      
      exec "$@"
      

5. Verify the Setup

After implementing the changes, verify that the admin password is set correctly:

  1. Log in to Odoo.
  2. Go to Settings > Activate Developer Mode > General Settings.
  3. Ensure that the admin password is configured under the database management section.

Conclusion

  • While Odoo doesn’t directly support setting admin_passwd via environment variables, you can achieve this by modifying the entrypoint script or dynamically appending the value to odoo.conf.
  • For production environments, consider using secret management tools to enhance security. Let me know if you need further assistance!

1
Portretas
Atmesti
Portretas
Dominik Ehrenberg
Best Answer

Not sure what version Gracious Joseph used, but using multiple conf files with something like

odoo --config=/etc/odoo/base.conf --config=/etc/odoo/admin.conf

definitely does not work in Odoo 18. It will always use the last conf file provided

0
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
Dynamic Dashboard Background and Text on Dark/Light Theme Switch in Odoo 16 sh
development configuration
Portretas
Portretas
1
lapkr. 25
92
Bulk PDF download error
development configuration
Portretas
0
spal. 25
505
I am trying to set up a mass BOM edit. My Python code is giving forbidden opcode(s) error. Odoo 18
development configuration
Portretas
Portretas
Portretas
2
rugs. 25
960
Google Calendar Sync - Odoo Calendar
development configuration
Portretas
Portretas
Portretas
3
rugp. 25
1873
Timesheets multiple days
development configuration
Portretas
Portretas
Portretas
3
liep. 25
1199
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now