captainVersion: 4
services:
    # Wallabag
    $$cap_appname:
        depends_on:
            - $$cap_appname-mariadb
        image: wallabag/wallabag:$$cap_wallabag_version
        restart: 'always'
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_mariadb-rootpass
            SYMFONY__ENV__DATABASE_DRIVER: pdo_mysql
            SYMFONY__ENV__DATABASE_HOST: srv-captain--$$cap_appname-mariadb
            SYMFONY__ENV__DATABASE_PORT: 3306
            SYMFONY__ENV__DATABASE_NAME: $$cap_mariadb-db
            SYMFONY__ENV__DATABASE_USER: $$cap_mariadb-user
            SYMFONY__ENV__DATABASE_PASSWORD: $$cap_mariadb-pass
            SYMFONY__ENV__SECRET: $$cap_gen_random_hex(30)
            SYMFONY__ENV__DOMAIN_NAME: https://$$cap_appname.$$cap_root_domain
        volumes:
            - $$cap_appname-images:/var/www/wallabag/web/assets/images
    # MariaDB
    $$cap_appname-mariadb:
        image: mariadb:$$cap_mariadb_version
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_mariadb-rootpass
        volumes:
            - $$cap_appname-mariadb-data:/var/lib/mysql
        restart: unless-stopped
        caproverExtra:
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_wallabag_version
          label: Version Tag
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/wallabag/wallabag/tags
          defaultValue: '2.4.0'
        - id: $$cap_mariadb_version
          label: MariaDB Version
          defaultValue: '10.5.6'
          description: Checkout their docker page for the valid tags https://hub.docker.com/r/library/mariadb/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_mariadb-db
          label: MariaDB Database
          description: Database name for Wallabag
          defaultValue: 'wallabag'
        - id: $$cap_mariadb-user
          label: MariaDB User
          description: Database User for Wallabag
          defaultValue: 'wallabag'
        - id: $$cap_mariadb-pass
          label: MariaDB database user password
          description: Super secret database user password
          defaultValue: $$cap_gen_random_hex(32)
        - id: $$cap_mariadb-rootpass
          label: MariaDB Root password
          description: Super secret database user password
          defaultValue: $$cap_gen_random_hex(32)
    instructions:
        start: |-
            Wallabag is a self hostable application for saving web pages: Save and classify articles. Read them later. Freely.
        end: |-
            Aaaand you're done! 😄
            Your service is available at http://$$cap_appname.$$cap_root_domain
            -------------------------------------------------------------------

            Default login is wallabag:wallabag.
    displayName: Wallabag
    isOfficial: true
    description: Wallabag is a self hostable application for saving web pages, Save and classify articles. Read them later. Freely.
    documentation: https://github.com/wallabag/docker#how-to-use-this-image
