Starting Tryton server with docker-compose file

2019-08-31 02:00发布

I am trying to link an external postgres to tryton/tryton from docker hub.

docker-compose.yaml

version: '3.7'

services:
  tryton-postgres:
    image: postgres
    ports:
      - 5432:5432
    environment:
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=tryton
    restart: always

  gnuserver:
    image: tryton/tryton:4.6
    links:
      - tryton-postgres:postgres
    ports:
      - 8000:8000
    depends_on:
      - tryton-postgres
    entrypoint: /entrypoint.sh trytond

when i ssh into the container and run trytond-admin --all -d tryton it seems to be looking for sqlite file instead of the connected postgres database. Are there some env variagbles i must set? What am i missing in my docker compose file?

2条回答
来,给爷笑一个
2楼-- · 2019-08-31 02:43

you need to edit /etc/tryton/trytond.conf to look at postgresql:

uri = postgresql://USERNAME:PASSWORD@tryton-postgres:5432/

see the Docs

查看更多
贪生不怕死
3楼-- · 2019-08-31 02:49

Instead of changing the configuration file, with Docker it is simpler to set environment variable like:

DB_USER=
DB_PASSWORD=
DB_HOSTNAME=tryton-postgres
DB_PORT=5432
查看更多
登录 后发表回答