From 0c90527ef908add1f125406a81519f9626d982d3 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 2 Jan 2015 10:57:31 +0100 Subject: [PATCH] [ADD] Configuration file template --- 8.0/Dockerfile | 3 ++- 8.0/openerp-server.conf | 42 +++++++++++++++++++++++++++++++++++++++++ 8.0/run.sh | 27 +++++++++++++++++++------- 3 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 8.0/openerp-server.conf diff --git a/8.0/Dockerfile b/8.0/Dockerfile index fc6f071..218ff1e 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -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 \ && 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 ./openerp-server.conf /etc/odoo/ # Mount /var/lib/odoo to allow restoring filestore VOLUME ["/var/lib/odoo"] diff --git a/8.0/openerp-server.conf b/8.0/openerp-server.conf new file mode 100644 index 0000000..ccc8caf --- /dev/null +++ b/8.0/openerp-server.conf @@ -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 diff --git a/8.0/run.sh b/8.0/run.sh index 3226180..f1dd6a0 100755 --- a/8.0/run.sh +++ b/8.0/run.sh @@ -1,11 +1,24 @@ #!/bin/bash -# set variables in 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 -sed -i "s/^db_user.*/db_user = $DB_ENV_POSTGRES_USER/" /etc/odoo/openerp-server.conf -sed -i "s/^db_password.*/db_password = $DB_ENV_POSTGRES_PASSWORD/" /etc/odoo/openerp-server.conf -sed -i "\$adata_dir = /var/lib/odoo" /etc/odoo/openerp-server.conf +CONFIG_FILE=/etc/odoo/openerp-server.conf + +# sets a configuration variable in openerp-server.conf +# $1: key, $2: value +function set_config { + 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 -exec gosu odoo /usr/bin/openerp-server --config /etc/odoo/openerp-server.conf +exec gosu odoo /usr/bin/openerp-server --config $CONFIG_FILE