[ADD] Configuration file template

This commit is contained in:
Aaron Bohy 2015-01-02 10:57:31 +01:00
parent d3fbe5fcdb
commit 0c90527ef9
3 changed files with 64 additions and 8 deletions

View File

@ -38,8 +38,9 @@ RUN curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odo
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys 0xdef2a2198183cbb5 \ RUN apt-key adv --keyserver pgp.mit.edu --recv-keys 0xdef2a2198183cbb5 \
&& echo "deb http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/ ./" >> /etc/apt/sources.list && echo "deb http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/ ./" >> /etc/apt/sources.list
# Run script # Run script and Odoo configuration file
COPY ./run.sh / COPY ./run.sh /
COPY ./openerp-server.conf /etc/odoo/
# Mount /var/lib/odoo to allow restoring filestore # Mount /var/lib/odoo to allow restoring filestore
VOLUME ["/var/lib/odoo"] VOLUME ["/var/lib/odoo"]

42
8.0/openerp-server.conf Normal file
View File

@ -0,0 +1,42 @@
[options]
addons_path = /usr/lib/python2.7/dist-packages/openerp/addons
db_host = False
db_password = False
db_port = False
db_user = odoo
; admin_passwd = admin
; auto_reload = False
; csv_internal_sep = ,
; data_dir = False
; db_maxconn = 64
; db_name = False
; db_template = template1
; dbfilter = .*
; debug_mode = False
; email_from = False
; limit_memory_hard = 2684354560
; limit_memory_soft = 2147483648
; limit_request = 8192
; limit_time_cpu = 60
; limit_time_real = 120
; list_db = True
; log_db = False
; log_handler = [':INFO']
; log_level = info
; logfile = None
; longpolling_port = 8072
; max_cron_threads = 2
; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False
; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False
; workers = 0
; xmlrpc = True
; xmlrpc_interface =
; xmlrpc_port = 8069
; xmlrpcs = True
; xmlrpcs_interface =
; xmlrpcs_port = 8071

View File

@ -1,11 +1,24 @@
#!/bin/bash #!/bin/bash
# set variables in openerp-server.conf CONFIG_FILE=/etc/odoo/openerp-server.conf
sed -i "s/^db_host.*/db_host = $DB_PORT_5432_TCP_ADDR/" /etc/odoo/openerp-server.conf
sed -i "s/^db_port.*/db_port = $DB_PORT_5432_TCP_PORT/" /etc/odoo/openerp-server.conf # sets a configuration variable in openerp-server.conf
sed -i "s/^db_user.*/db_user = $DB_ENV_POSTGRES_USER/" /etc/odoo/openerp-server.conf # $1: key, $2: value
sed -i "s/^db_password.*/db_password = $DB_ENV_POSTGRES_PASSWORD/" /etc/odoo/openerp-server.conf function set_config {
sed -i "\$adata_dir = /var/lib/odoo" /etc/odoo/openerp-server.conf if grep -q "^$1.*" $CONFIG_FILE
then
sed -i "s/^$1.*$/$1 = $2/" $CONFIG_FILE
else
sed -i "$ a$1 = $2" $CONFIG_FILE
fi
}
# set odoo data directory and database host, port, user and password
set_config "data_dir" "\/var\/lib\/odoo"
set_config "db_host" $DB_PORT_5432_TCP_ADDR
set_config "db_port" $DB_PORT_5432_TCP_PORT
set_config "db_user" $DB_ENV_POSTGRES_USER
set_config "db_password" $DB_ENV_POSTGRES_PASSWORD
# start Odoo # start Odoo
exec gosu odoo /usr/bin/openerp-server --config /etc/odoo/openerp-server.conf exec gosu odoo /usr/bin/openerp-server --config $CONFIG_FILE