Starting Tryton server with docker-compose file

醉酒当歌 提交于 2019-12-13 08:30:34

问题


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?


回答1:


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

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

see the Docs




回答2:


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


来源:https://stackoverflow.com/questions/57703236/starting-tryton-server-with-docker-compose-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!