docker-image: git.panda-chi.io:5002/panda-chi/docker-odoo-pandachi:12.0
data-resources:
  - /var/lib/odoo
# config-resources:
#   ## XXXvlab: should this be there or declared dynamically in the relation that
#   ## create/update this file ?
#   # - /etc/odoo-server.conf

docker-compose:
  command:
    - odoo
    - --config=/opt/odoo/auto/odoo.conf
  ## YYYvlab: useful ?
  tty: true
  environment:
    INITIAL_LANG: fr_FR
    LIST_DB: 'true'

default-options:
  workers: 1
  # modules:
  #   - l10n_fr
  #database: MYDATABASE  ## will be the one connected to postgres
  ## Adds custom values in options
  # conf:
  #   options:
  #     email_from: xxxx
  #   othersection:
  #     myvalue: yyy

uses:
  postgres-database:
    #constraint: required | recommended | optional
    #auto: pair | summon | none ## default: pair
    constraint: required
    auto: summon
    solves:
      database: "main storage"
    default-options:
      extensions:
        - unaccent
  log-rotate:
    #constraint: required | recommended | optional
    #auto: pair | summon | none ## default: pair
    constraint: recommended
    auto: pair
    solves:
      unmanaged-logs: "in docker logs"
    #default-options:
  web-proxy:
    #constraint: required | recommended | optional
    #auto: pair | summon | none ## default: pair
    constraint: recommended
    auto: pair
    solves:
      proxy: "Public access"
    default-options:
      target: !var-expand ${MASTER_BASE_SERVICE_NAME}:8069
      apache-custom-rules:
        - !bash-stdout |
          workers=$(relation-base-compose-get workers 2>/dev/null)
          workers=${workers:-1}
          if [ "$workers" -gt 1 ]; then
              echo "ProxyPass /longpolling/ http://${MASTER_BASE_SERVICE_NAME}:8072/longpolling/"
              echo "ProxyPassReverse /longpolling/ http://${MASTER_BASE_SERVICE_NAME}:8072/longpolling/"
          fi
  backup:
    constraint: recommended
    auto: pair
    solves:
      backup: "Automatic regular backup"
    default-options:
      ## First pattern matching wins, no pattern matching includes.
      ## include-patterns are checked first, then exclude-patterns
      ## Patterns rules:
      ##  - ending / for directory
      ##  - '*' authorized
      ##  - must start with a '/', will start from $SERVICE_DATASTORE
      exclude-patterns:
        - "/var/lib/odoo/sessions/"

# network-isolation:
#   whitelist:  ## required external services used by this service
#     - www.google.com
#     - www.gravatar.com
#     - fonts.gstatic.com
#     - fonts.googleapis.com
#     - cdnjs.cloudflare.com