captainVersion: 4

services:
    $$cap_appname-db:
        image: mysql:5.7.32
        volumes:
            - $$cap_appname-mysql-data:/var/lib/mysql
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_MYSQL_ROOT_PWD
            MYSQL_USER: $$cap_DB_USERNAME
            MYSQL_PASSWORD: $$cap_DB_PASSWORD
            MYSQL_DATABASE: $$cap_DB_DATABASE
        caproverExtra:
            notExposeAsWebApp: 'true'

    $$cap_appname:
        image: 'thomascenni/alpine-invoiceplane:v1.5.11'
        volumes:
            - $$cap_appname-storage:/storage
            - $$cap_appname-config:/config
        environment:
            IP_URL: 'http://$$cap_appname.$$cap_root_domain'
            DB_HOSTNAME: 'srv-captain--$$cap_appname-db'
            DB_USERNAME: $$cap_DB_USERNAME
            DB_PASSWORD: $$cap_DB_PASSWORD
            DB_DATABASE: $$cap_DB_DATABASE
            DB_PORT: '3306'

caproverOneClickApp:
    variables:
        - defaultValue: $$cap_gen_random_hex(20)
          description: This is the MySQL root password. Randomly generated. Can be changed also.
          id: $$cap_MYSQL_ROOT_PWD
          label: MYSQL_ROOT_PWD
          validRegex: /^([^\s^\/])+$/
        - defaultValue: 'invoiceplane'
          description: This is the username to access the invoiceplane db. Can use the default provided.
          id: $$cap_DB_USERNAME
          label: DB_USERNAME
          validRegex: /^([^\s^\/])+$/
        - defaultValue: $$cap_gen_random_hex(16)
          description: This is password for the user accessing the invoiceplane db. Randomly generated. Can be changed also.
          id: $$cap_DB_PASSWORD
          label: DB_PASSWORD
          validRegex: /^([^\s^\/])+$/
        - defaultValue: 'invoiceplane'
          description: This is name for the database hosting InvoicePlane application. Can use the default provided.
          id: $$cap_DB_DATABASE
          label: DB_DATABASE
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: >-
            InvoicePlane is a self-hosted open source application for managing invoices.

            See https://www.invoiceplane.com/.

            This one click app is based on:
            - woahbase/alpine-mysql image
            - thomascenni/alpine-invoiceplane, based on woahbase/alpine-php and the official InvoicePlane sources from their Github repository.
        end: >-
            InvoicePlane is deployed and available as $$cap_appname.
            IMPORTANT: It will take up to 1 minute for InvoicePlane to be ready. 
            Before that, you might see 502 error page.
    displayName: InvoicePlane
    isOfficial: false
    description: InvoicePlane is a self-hosted open source application for managing your quotes, invoices, clients and payments.
    documentation: Taken from https://www.invoiceplane.com/.
