Skip to content

Instantly share code, notes, and snippets.

@Guidoom
Last active October 30, 2024 10:05
Show Gist options
  • Save Guidoom/d5db0a76ce669b139271a528a8a2a27f to your computer and use it in GitHub Desktop.
Save Guidoom/d5db0a76ce669b139271a528a8a2a27f to your computer and use it in GitHub Desktop.
Sample odoo.conf file
[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux
# ( /etc/odoo/openerp-server.conf )
#
# Great pain has been taken to organize this file, and include comments for
# each. As with all open source software this file is a work in progress. If
# you see something that is wrong or needs to be updated, submit and issue
# on TurnKey's GIT Hub issue tracker! Or better yet, fork the repo with this
# file and submit a pull request!
#
# Information about these settings where taken from openerp-server --help
# and from https://www.odoo.com/documentation/8.0/reference/cmdline.html
#
#-----------------------------------------------------------------------------
# Index:
# Database Settings
# Logs Settings
# Service Settings
# Email Settings
# Server Options
# Tuning Adjustments
# Testing and Demo Settings
#-----------------------------------------------------------------------------
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
# Database Settings
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#-----------------------------------------------------------------------------
# Specify the database host (default localhost).
#-----------------------------------------------------------------------------
#db_host = localhost
#-----------------------------------------------------------------------------
# Specify the database port (default None).
#-----------------------------------------------------------------------------
#db_port = 5432
#-----------------------------------------------------------------------------
# Specify the database user name (default None).
#-----------------------------------------------------------------------------
#db_user = odoo
#-----------------------------------------------------------------------------
# Specify the database password for db_user (default None)
#-----------------------------------------------------------------------------
db_password = 00aa9df39b0c99ac3d1d8412d2917175
#-----------------------------------------------------------------------------
# Specify the database name.
#-----------------------------------------------------------------------------
db_name = False
#-----------------------------------------------------------------------------
# DataError: new encoding (UTF8) is incompatible with the encoding of the
# template database (SQL_ASCII) HINT: Use the same encoding as in the template
# database, or use template0 as template.
#-----------------------------------------------------------------------------
db_template = template0
#-----------------------------------------------------------------------------
# Master Database password
# This is set at first boot, and can be set from within Odoo
#-----------------------------------------------------------------------------
admin_passwd = 12357
#-----------------------------------------------------------------------------
# specify the the maximum number of physical connections to posgresql
#-----------------------------------------------------------------------------
db_maxconn = 64
#-----------------------------------------------------------------------------
# Filter listed database REGEXP
#-----------------------------------------------------------------------------
dbfilter = .*
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
# Logs Settings
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#
#
# I found information from Odoo on logging was not very clear. So I complied
# this helpful list and info about Odoo logging.
#
# Information was gleaned from the following sites:
# (The URLs are broken up to fit them in the file)
# - http://www.mindissoftware.com
# /2014/09/07/Odoo-logging-configuration-usage-implementation/
# - https://www.odoo.com/
# /forum/help-1/question
# /what-is-the-full-list-of-command-line-options-for-odoo-59139
# - https://www.odoo.com/documentation/8.0/reference/cmdline.html
#
# Odoo uses the Python standard logging library. However, it uses a special
# configuration syntax to configure logging levels for its modules.
#
# It's helpful to know what each level type means, so below is quick list:
#
# Level meanings:
# debug: Debug message for debugging only.
# info: Information message to report important modular event.
# warning: Warning message to report minor issues.
# error: Error message to report failed operations.
# critical: A critical message -- so critical that the module cannot work
#
#
# log_level:
# any value in the list below. Odoo changed the log_level meaning
# here because these level values are mapped to a set of predefined
# 'module:log_level' pairs. These pairs are listed next to the log-level.
# You could get the same result by using the log_handler option
#
#
# LOG LEVEL / log_handler: module:log_level
# ----------------------------------------------------------------------------
# info / [':INFO']
# critical / ['openerp:CRITICAL', 'werkzeug:CRITICAL']
# error / ['openerp:ERROR', 'werkzeug:ERROR']
# warn / ['openerp:WARNING', 'werkzeug:WARNING']
# debug / ['openerp:DEBUG']
# debug_sql / ['openerp.sql_db:DEBUG']
# debug_rpc / ['openerp:DEBUG','openerp.http.rpc.request:DEBUG']
# debug_rpc_answer / ['openerp:DEBUG','openerp.http.rpc.request:DEBUG',
# 'openerp.http.rpc.response:DEBUG']
#
# End of Logging Info
# ----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# The log filename. If not set, use stdout.
#-----------------------------------------------------------------------------
logfile = /var/log/odoo/openerp-server.log
#-----------------------------------------------------------------------------
# True/False. If True, create a daily log file and keep 30 files.
#-----------------------------------------------------------------------------
logrotate = True
#-----------------------------------------------------------------------------
# Ture/False. If True, also write log to 'ir_logging' table in database
#-----------------------------------------------------------------------------
log-db = False
#-----------------------------------------------------------------------------
# True/False logs to the system's event logger: syslog
#-----------------------------------------------------------------------------
syslog = False
#-----------------------------------------------------------------------------
# Log level - One of the following:
# info, debug_rpc, warn, test, critical, debug_sql, error, debug,
# debug_rpc_answer
#-----------------------------------------------------------------------------
log-level = warn
#-----------------------------------------------------------------------------
# log_handler - can be a list of 'module:log_level' pairs.
# The default value is ':INFO' -- it means the default logging level
# is 'INFO' for all modules.
#-----------------------------------------------------------------------------
# log_handler =
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
# Service Settings
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#-----------------------------------------------------------------------------
# The IP address on which the server will bind.
# If empty, it will bind on all interfaces (default empty).
#-----------------------------------------------------------------------------
interface = localhost
#-----------------------------------------------------------------------------
# The TCP port on which the server will listen (default 8069).
#-----------------------------------------------------------------------------
port = 8069
#-----------------------------------------------------------------------------
# Launch server over https instead of http (default False).
#-----------------------------------------------------------------------------
secure = False
#-----------------------------------------------------------------------------
# Set to True if you are deploying your App behind a proxy
# e.g. Apache using mod_proxy. --proxy_mode added, using Werkzeug ProxyFix class
#-----------------------------------------------------------------------------
proxy_mode = True
#-----------------------------------------------------------------------------
# Specify the addons_path folders ordered by priority
# addons_path=/first/path/,/second/path/
#-----------------------------------------------------------------------------
addons_path = /opt/openerp/odoo/addons,/home/myaddons
#-----------------------------------------------------------------------------
# The file where the server pid will be stored (default False).
# We are letting the init script create the pid
#-----------------------------------------------------------------------------
# pidfile = False
#-----------------------------------------------------------------------------
# specify reference timezone for the server (e.g. Europe/Brussels)
#-----------------------------------------------------------------------------
timezone = False
#-----------------------------------------------------------------------------
# specify the certificate file for the SSL connection
#-----------------------------------------------------------------------------
secure_cert_file = server.cert
#-----------------------------------------------------------------------------
# specify the private key file for the SSL connection
#-----------------------------------------------------------------------------
secure_pkey_file = server.pkey
#-----------------------------------------------------------------------------
# XML-RPC Secure Configuration (disabled if ssl is unavailable):
# xmlrpcs - Set to False to disable the XML-RPC Secure protocol
# xmlrpcs_interface - Specify the TCP IP address for the XML-RPC Secure
# protocol. The empty string binds to all interfaces.
# xmlrpcs_port - Specify the TCP port for the XML-RPC Secure protocol
#-----------------------------------------------------------------------------
xmlrpcs = True
xmlrpcs_interface = 127.0.0.1
xmlrpcs_port = 8071
#-----------------------------------------------------------------------------
# XML-RPC Configuration:
# xmlrpc - Set to False to disable the XML-RPC protocol
# xmlrpc_interface - Specify the TCP IP address for the XML-RPC
# protocol. The empty string binds to all interfaces.
# xmlrpc_port - Specify the TCP port for the XML-RPC protocol
#-----------------------------------------------------------------------------
xmlrpc = True
xmlrpc_interface = 127.0.0.1
xmlrpc_port = 8069
#-----------------------------------------------------------------------------
# Long polling port:
# TCP port for long-polling connections in multiprocessing or gevent mode,
# defaults to 8072. Not used in default (threaded) mode.
#-----------------------------------------------------------------------------
longpolling_port = 8072
#-----------------------------------------------------------------------------
# Use this for big data importation, if it crashes you will be able to continue
# at the current state. Provide a filename to store intermediate importation
# states.
#-----------------------------------------------------------------------------
import_partial =
#-----------------------------------------------------------------------------
# Use the unaccent function provided by the database when available
#-----------------------------------------------------------------------------
unaccent = False
#-----------------------------------------------------------------------------
# specify modules to export. Use in combination with --i18n-export
#-----------------------------------------------------------------------------
translate_modules = ['all']
#-----------------------------------------------------------------------------
# Comma-separated list of server-wide modules, default=web
#-----------------------------------------------------------------------------
server_wide_modules = None
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
# Email Settings
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#-----------------------------------------------------------------------------
# Specify the SMTP server for sending email (default localhost).
#-----------------------------------------------------------------------------
smtp_server = localhost
#-----------------------------------------------------------------------------
# Specify the SMTP user for sending email (default False).
#-----------------------------------------------------------------------------
smtp_user = False
#-----------------------------------------------------------------------------
# Specify the SMTP password for sending email (default False).
#-----------------------------------------------------------------------------
smtp_password = False
#-----------------------------------------------------------------------------
# if True, SMTP connections will be encrypted with SSL (STARTTLS)
#-----------------------------------------------------------------------------
smtp_ssl = False
#-----------------------------------------------------------------------------
# Specify the SMTP email address for sending email
#-----------------------------------------------------------------------------
email_from = "TKL-Odoo-Server@example.com"
#-----------------------------------------------------------------------------
# Specify the SMTP port
#-----------------------------------------------------------------------------
smtp_port = 25
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
# Tuning Options
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#-----------------------------------------------------------------------------
# A word on tuning your Odoo Server
#-----------------------------------------------------------------------------
#
# A lot of time has gone in to testing this TKL appliance, and one thing we
# learned while testing was tuning. For all the why we chose these numbers you
# can take a look at he issues on GitHub (links at the botton of this article)
#
# Most of this text here was taken from the Memory Matrix Discussion
# https://github.com/DocCyblade/tkl-odoo/issues/49#issuecomment-148881166
#
# It is important to note that you can run Odoo in threaded mode by setting
# the workers option to 0 however there are some modules that won't work
# and you loose fine grain control of resource management.
#
#-----------------------------------------------------------------------------
#
# the --workers is how many new process will be started to perform work or
# (answer requests) The workers have limits upon them set by the limit_xxxxx
# options here in the config file.
#
# The "limit_memory_soft" limit is the amount of ram that when a process
# goes over this limit after it is done with the request it is terminated
# and the memory it was using is freed. This amount goes for each process
#
# The hard limit is the amount of ram that if the process goes over it,
# it WILL terminate right then. (I don't think this is really correct
# because of the PDF issue we had and set this to 1.3 GB and never
# saw a process take this much. but if its below 1.3GB PDF are not created)
#
# The one we need to pay attention to is the limit_memory_soft.
# As these workers will stay alive and hold on to memory until that limit
# is reached. So if you have 5 workers and the soft limit is 256MB you could
# end up with 5 workers each taking 256MB that's 1.25GB of RAM that could
# be taken up. If you only had 1GB of ram you may need to dial back your
# workers or your soft limit.
#
# It's a balancing act of sorts, I am also not sure if keeping the
# workers at say 350 or 400 if there is some caching effect. Not sure
# why it's holding on to the memory.
#
#-----------------------------------------------------------------------------
#
# Hardware Matrix for recommended values:
# (Note these are for REAL hardware, Virtual Hardware has it's own
# issues that can arise with too many guest on a host with too many
# CPU cores etc, so remember that when looking at the chart below)
# (One other note that when I tested these, I did use VMware but
# no other VMs where competing for resources)
# (One last note, really. These numbers are to show the relationship
# between the config settings and hardware. We also assume you are running
# the database server on the same server. I know at some point in the
# higher numbers that this would not be the case. These are not numbers
# set in stone nor numbers gotten from Odoo. These are numbers I have
# come up with from the testing I have done. Real world examples if you
# have them would be great and these numbers can and should be updated!
#
# Heading | Description
# ------------------ | ---------------------------------------------------------
# CPUs | Number of CPU Cores not threads
# Physical | Physical memory, not virtual or swap
# workers | Number of workers specified in config file (workers = x)
# cron | Number of workers for cron jobs (max_cron_threads = xx)
# Mem Per | Memory in MB that is the max memory for request per worker
# Max Mem | Maximum amount that can be used by all workers
# limit_memory_soft | Number in bytes that you will use for this setting
#
# Note: Max Memory if notice is less than total memory this is on purpose. As
# workers process requests they can grow beyond the Mem Per limit so a
# server under heavy load could go past this amount. This is why there
# is "head room" built in.
#
# CPUs | Physical | workers | cron | Mem Per | Max Mem | limit_memory_soft
# ---- | -------- | ------- | ---- | ------- | ------- | -----------------------
# ANY | =< 256MB | NR | NR | NR | NR | NR
# 1 | 512MB | 0 | N/A | N/A | N/A | N/A
# 1 | 512MB | 1 | 1 | 177MB | 354MB | 185127901
# 1 | 1GB | 2 | 1 | 244MB | 732MB | 255652815
# 1 | 2GB | 2 | 1 | 506MB | 1518MB | 530242876
# 2 | 1GB | 3 | 1 | 183MB | 732MB | 191739611
# 2 | 2GB | 5 | 2 | 217MB | 1519MB | 227246947
# 2 | 4GB | 5 | 2 | 450MB | 3150MB | 471974428
# 4 | 2GB | 5 | 2 | 217MB | 1519MB | 227246947
# 4 | 4GB | 9 | 2 | 286MB | 3146MB | 300347363
# 4 | 8GB | 9 | 3 | 546MB | 6552MB | 572662306
# 4 | 16GB | 9 | 3 | 1187MB | 14244MB | 1244918057
#
#
#-----------------------------------------------------------------------------
#
# Calculations on how we got the above chart and other info can be found
#
# Memory Matrix Discussion
# https://github.com/DocCyblade/tkl-odoo/issues/49
#
# Shakedown Testing Discussions
# https://github.com/DocCyblade/tkl-odoo/issues/52
# https://github.com/DocCyblade/tkl-odoo/issues/53
# https://github.com/DocCyblade/tkl-odoo/issues/54
# https://github.com/DocCyblade/tkl-odoo/issues/55
#
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Specify the number of workers, 0 disable prefork mode.
# if count is not 0 , enables multiprocessing and sets up the
# specified number of HTTP workers (sub-processes processing HTTP and RPC
# requests). TKL Default is 0
#
# (See chart above for recommended values)
#-----------------------------------------------------------------------------
workers = 0
#-----------------------------------------------------------------------------
# number of workers dedicated to cron jobs. Defaults to 2. The workers are
# threads in multithreading mode and processes in multiprocessing mode.
#-----------------------------------------------------------------------------
max_cron_threads = 1
#-----------------------------------------------------------------------------
# Prevents the worker from using more than <limit> CPU seconds for each
# request. If the limit is exceeded, the worker is killed
#-----------------------------------------------------------------------------
limit_time_cpu = 60
#-----------------------------------------------------------------------------
# Prevents the worker from taking longer than <limit> seconds to process a
# request. If the limit is exceeded, the worker is killed.
#-----------------------------------------------------------------------------
limit_time_real = 170
#-----------------------------------------------------------------------------
# Maximum allowed virtual memory per worker. If the limit is exceeded, the
# worker is killed and recycled at the end of the current request.
#
# (See chart above for recommended values)
#-----------------------------------------------------------------------------
limit_memory_soft = 255652815
#-----------------------------------------------------------------------------
# Hard limit on virtual memory, any worker exceeding the limit will be
# immediately killed without waiting for the end of the current request
# processing.
#
# Not sure of the reason but if this is set lower that 1.3GB then print jobs
# using PDF does not work. We are unsure why but this was the lowest amount
# for it to work.
#-----------------------------------------------------------------------------
limit_memory_hard = 1395864371
#-----------------------------------------------------------------------------
# Number of requests a worker will process before being recycled and restarted.
#-----------------------------------------------------------------------------
limit_request = 8196
#-----------------------------------------------------------------------------
# Force a limit on the maximum number of records kept in the virtual osv_memory
# tables. The default is False, which means no count-based limit.
#-----------------------------------------------------------------------------
osv_memory_count_limit = False
#-----------------------------------------------------------------------------
# Force a limit on the maximum age of records kept in the virtual osv_memory
# tables. This is a decimal value expressed in hours, and the default is 1 hour.
#-----------------------------------------------------------------------------
osv_memory_age_limit = 1.0
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
# Testing and Demo Settings
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#-----------------------------------------------------------------------------
# Enable YAML and unit tests.
#-----------------------------------------------------------------------------
test_enable = False
#-----------------------------------------------------------------------------
# Launch a python or YML test file.
#-----------------------------------------------------------------------------
test_file = False
#-----------------------------------------------------------------------------
# If set, will save sample of all reports in this directory.
#-----------------------------------------------------------------------------
test_report_directory = False
#-----------------------------------------------------------------------------
# Commit database changes performed by YAML or XML tests.
#-----------------------------------------------------------------------------
test_commit = False
#-----------------------------------------------------------------------------
# disable loading demo data for modules to be installed (comma-separated, use
# "all" for all modules). Default is none
#-----------------------------------------------------------------------------
without_demo =
@iifast2
Copy link

iifast2 commented Apr 1, 2024

Thanks.

@ngist
Copy link

ngist commented Apr 4, 2024

FYI interface directive is deprecated at least in Odoo 17 and has been replaced with http_interface the interface directive is silently ignored and Odoo will listen for any incoming IP addresses.

so you need to change interface localhost to http_interface localhost

@iamRahulSharma
Copy link

Wow! this is best odoo conf template with detailed explanation

@sehrishnaz
Copy link

sehrishnaz commented Aug 6, 2024 via email

@Sarah-JJ
Copy link

Sarah-JJ commented Sep 3, 2024

Better than Odoo documentation itself, thank you

@sehrishnaz
Copy link

sehrishnaz commented Sep 16, 2024 via email

@WildfootW
Copy link

I’ve created an odoo.conf sample for Odoo 17. It’s based on official sources but is untested. Feel free to use it if needed: https://github.com/WildfootW/odoo.conf-sample/blob/main/odoo.conf

@auriga1
Copy link

auriga1 commented Oct 17, 2024

longpolling_port is deprecated, if you wish to change longpolling port:

longpolling_port = False
gevent_port = 8072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment