captainVersion: 4
services:
    $$cap_appname-db:
        image: postgres:$$cap_postgres-version
        volumes:
            - $$cap_appname-db:/var/lib/postgresql/data
        restart: always
        environment:
            POSTGRES_USER: dolibarr
            POSTGRES_PASSWORD: $$cap_pg-pass
            POSTGRES_DB: dolibarr
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname:
        image: upshift/dolibarr:$$cap_dolibarr-version
        depends_on:
            - $$cap_appname-db
        volumes:
            - $$cap_appname-html:/var/www/html
            - $$cap_appname-docs:/var/www/documents
        restart: always
        environment:
            DOLI_DB_HOST: srv-captain--$$cap_appname-db
            DOLI_DB_NAME: dolibarr
            DOLI_DB_ROOT_LOGIN: dolibarr
            DOLI_DB_ROOT_PASSWOORD: $$cap_pg-pass
            DOLI_DB_USER: dolibarr
            DOLI_DB_PORT: 5432
            DOLI_DB_TYPE: pgsql
            DOLI_DB_PASSWORD: $$cap_pg-pass
            DOLI_ADMIN_LOGIN: $$cap_admin-login
            DOLI_ADMIN_PASSWORD: $$cap_admin-pass
            DOLI_URL_ROOT: http://$$cap_appname.$$cap_root_domain
caproverOneClickApp:
    variables:
        - id: $$cap_postgres-version
          label: Postgres Version
          defaultValue: 9.6-alpine
          description: Checkout their docker page for the valid tags https://hub.docker.com/r/library/postgres/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_dolibarr-version
          label: Dolibarr Version
          defaultValue: '11.0'
          description: Checkout their docker page for the valid tags https://hub.docker.com/r/library/postgres/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_pg-pass
          label: Postgres Password
          description: The password of the PostgreSQL Database
          validRegex: /.{1,}/
        - id: $$cap_admin-login
          label: Dolibarr Admin Login
          defaultValue: admin
          description: The login of the fisrt admin user of Dolibarr
          validRegex: /.{1,}/
        - id: $$cap_admin-pass
          label: Dolibarr Admin Password
          description: The password of the first admin user of Dolibarr
          validRegex: /.{1,}/
    instructions:
        start: Dolibarr is an Open Source ERP & CRM for Business
        end: Dolibarr is deployed and available as srv-captain--$$cap_appname:8080 to other apps.
    displayName: Dolibarr
    description: Open Source ERP & CRM for Business (sme or large companies, freelancers, foundations)
    documentation: https://hub.docker.com/r/upshift/dolibarr
