it-projects-llc / odoo-runbot-docker

43 stars 47 forks source link

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? #16

Open YogeshMahera-SerpentCS opened 6 years ago

YogeshMahera-SerpentCS commented 6 years ago

Hello @yelizariev

Could you please help me resolve this error.

I have followed this commands

Then I have access this

And I am facing these errors

2018-07-26 12:52:58,237 18 INFO runbot werkzeug: 172.17.0.1 - - [26/Jul/2018 12:52:58] "POST /longpolling/poll HTTP/1.1" 200 - 2018-07-26 12:52:58,295 18 INFO runbot werkzeug: 172.17.0.1 - - [26/Jul/2018 12:52:58] "POST /website/translations HTTP/1.1" 200 - 2018-07-26 12:53:00,830 21 INFO runbot openerp.addons.runbot.runbot: git: git --git-dir=/mnt/odoo-extra/runbot/static/repo/https___gitlab.com_yogeshmahera-serpentcs_test_project.git fetch -p origin +refs/pull//head:refs/pull/ 2018-07-26 12:53:02,571 20 INFO ? openerp.sql_db: ConnectionPool(used=0/count=0/max=64): Closed 1 connections to 'host=172.17.0.3 port=5432 user=odoo password=xxxx dbname=runbot'

2018-07-26 12:53:07,994 21 INFO runbot openerp.addons.runbot.runbot: git: git --git-dir=/mnt/odoo-extra/runbot/static/repo/https_gitlab.com_yogeshmahera-serpentcs_test_project.git for-each-ref --format %(refname)%00%(objectname)%00%(committerdate:iso8601)%00%(authorname)%00%(authoremail)%00%(subject)%00%(committername)%00%(committeremail) --sort=-committerdate refs/heads refs/pull 2018-07-26 12:53:08,695 21 ERROR runbot openerp.addons.runbot.runbot: 00006-9-0-4b8f2c failed running method job_10_test_base Traceback (most recent call last): File "/mnt/odoo-extra/runbot/runbot.py", line 1204, in _schedule pid = job_method(cr, uid, build, lock_path, log_path) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 268, in wrapper return old_api(self, *args, kwargs) File "/mnt/odoo-extra/runbot/runbot.py", line 1014, in _job_10_test_base self._local_pg_createdb(cr, uid, "%s-base" % build.dest) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 268, in wrapper return old_api(self, *args, *kwargs) File "/mnt/odoo-extra/runbot/runbot.py", line 918, in _local_pg_createdb self._local_pg_dropdb(cr, uid, dbname) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 268, in wrapper return old_api(self, args, kwargs) File "/mnt/odoo-extra/runbot/runbot.py", line 910, in _local_pg_dropdb with local_pgadmin_cursor() as local_cr: File "/usr/lib/python2.7/contextlib.py", line 17, in enter return self.gen.next() File "/mnt/odoo-extra/runbot/runbot.py", line 163, in local_pgadmin_cursor cnx = psycopg2.connect("dbname=postgres") File "/usr/lib/python2.7/dist-packages/psycopg2/init__.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) OperationalError: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

kingctan commented 5 years ago

also meet this.

sotolucas commented 4 years ago

Hi @YogeshMahera-SerpentCS . Could you solve this problem? Thanks!

sotolucas commented 4 years ago

Hi @YogeshMahera-SerpentCS . Could you solve this problem? Thanks!

I've solved the problem by sharing a new volume called 'odoo-db-socket' between Odoo container and DB container, as by default the method prefers the UNIX socket connection, and this mostly is not a problem if you host the PSQL service in the same container, but it is if you host it in another container as it may happen if you're using Docker. It looks like this:

  odoo:
    image: calyxserviciossa/odoo-runbot-docker:11.0
    depends_on:
      - db
    ports:
      - "8069:8069"
      - "8072:8072"
    command:
      - odoo
      - --database=runbot
      - --db-filter=^runbot$$
      - --workers=5
      - --max-cron-threads=1
    volumes:
      - odoo-web-data:/var/lib/odoo
      - odoo-db-socket:/var/run/postgresql

  db:
    image: postgres:10
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata
      - odoo-db-socket:/var/run/postgresql

volumes:
  certs:
  html:
  vhostd:
  odoo-web-data:
  odoo-db-data:
  odoo-db-socket:

@yelizariev does this solution seem right for you?

yelizariev commented 4 years ago

I don't remember such a trick. All I can suggest is to check README file. It should work, but I'm not sure