captainVersion: 4
services:
    $$cap_appname-db:
        image: mysql:$$cap_mysql_version
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql
        environment:
            MYSQL_DATABASE: redmine
            MYSQL_ROOT_PASSWORD: $$cap_mysql_password
        caproverExtra:
            notExposeAsWebApp: 'true'

    $$cap_appname:
        depends_on:
            - $$cap_appname-db
        image: redmine:$$cap_redmine_version
        environment:
            REDMINE_DB_MYSQL: srv-captain--$$cap_appname-db
            REDMINE_DB_PORT: 3306
            REDMINE_DB_PASSWORD: $$cap_mysql_password
            REDMINE_SECRET_KEY_BASE: $$cap_key_base
        restart: always
        volumes:
            - $$cap_appname-data:/usr/src/redmine/files
        caproverExtra:
            containerHttpPort: '3000'

caproverOneClickApp:
    variables:
        - id: $$cap_redmine_version
          label: Redmine Version
          defaultValue: 4.2.3
          description: 'Check out their Docker page for the valid tags https://hub.docker.com/_/redmine?tab=tags'
        - id: $$cap_mysql_version
          label: MySQL Version
          defaultValue: 5.7
          description: 'Check out their Docker page for the valid tags https://hub.docker.com/_/mysql?tab=tags'
        - id: $$cap_mysql_password
          label: MySQL Password
          defaultValue: $$cap_gen_random_hex(16)
        - id: $$cap_key_base
          label: Redmine Secret Key Base
          defaultValue: $$cap_gen_random_hex(64)

    instructions:
        start: >-
            Redmine is a flexible project management web application written using Ruby on Rails framework. For more info visit https://www.redmine.org/projects/redmine.

                        
            After installation, login to Redmine using the default credentials [admin:admin].
        end: >-
            ✅  Redmine has been successfully deployed and is now available at http://$$cap_appname.$$cap_root_domain!


            🔐  The default login credentials are:

                Username: admin
                Password: admin
            --------------------------------------------

            More information on initial configuration can be found at https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Configuration.

    displayName: Redmine (MySQL)
    isOfficial: true
    description: >-
        Redmine is a flexible project management web application written using Ruby on Rails framework. This app is packaged with MySQL.
    documentation: >-
        This docker-compose is taken from https://hub.docker.com/_/redmine?tab=description
