Skip to Content
Menu
This question has been flagged
1 Reply
6358 Views

I'm using azure app service and would like to connect my odoo to postgress server (not using db in docker)

is it possible to configure docker official image to work with remote database server?

(not by running a cmd) maybe using docker compose?

or should I create another docker image?

Avatar
Discard

Hello;

I'm with the same kind of issue with odoo v.14

Hello guys!

Did you figure out how to solve this?

I'm with the same kind of issue; custom odoo13 docker image and trying to connect it to PostgreSQL on RDS.

Best Answer

The default odoo docker uses the following parameters in the wait-for-psql.py script that is called from the entrypoint.sh

    arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('--db_host', required=True)
arg_parser.add_argument('--db_port', required=True)
arg_parser.add_argument('--db_user', required=True)
arg_parser.add_argument('--db_password', required=True)
arg_parser.add_argument('--timeout', type=int, default=5)

But we don't want to use these parameters, only odoo will use them to test the connection.

So, in our docker-compose file, we are going to configure the connection parameters to our RDS

version: '3.3'
services:
odoo:
container_name: odoo15
image: odoo/odoo:15.0
# build:
restart: always
tty: true
networks:
- default
ports:
- "0.0.0.0:8069:8069"
volumes:
- odoo-data:/var/lib/odoo:delegated
- ~/odoo15e/enterprise:/mnt/enterprise:delegated
- ~/odoo15e/design-themes:/mnt/design-themes:delegated
- ./conf:/etc/odoo
environment:
- DB_PORT_5432_TCP_ADDR=odoo-prod-db-odoo-ar.us-east-1.rds.amazonaws.com
- DB_PORT_5432_TCP_PORT=5432
- DB_ENV_POSTGRES_USER=odoo
- DB_ENV_POSTGRES_PASSWORD=dfioluhe546kljhgdrf87
networks:
default:
driver: bridge
volumes:
odoo-data:

In the RDS console, we need to give the privileges to the odoo user who is going to connect to the database.

ALTER ROLE odoo WITH CREATEDB;

While our odoo.conf file does not have to contain connection parameters for the script wait-for-psql.py to allow us to run the container without giving errors

[options]
addons_path = /mnt/odoo/addons,/mnt/enterprise,/mnt/design-themes
admin_passwd = j5HyMkxA$GgN4VVaPhuOCkJRHh2F9EaoLWyx78LzrH6q
csv_internal_sep = ,
data_dir = /var/lib/odoo
;db_host = False
db_maxconn = 64
;db_name = False
;db_password = False
;db_port = 5432
;db_sslmode = prefer
;db_template = template0
;db_user = False
;dbfilter = False
demo = {}
email_from = False
from_filter = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
http_enable = True
http_interface =
http_port = 8069
import_partial =

;)


Avatar
Discard
Related Posts Replies Views Activity
2
Sep 23
5704
1
Sep 22
1142
0
Feb 22
1965
0
Nov 24
130
0
Aug 24
246