captainVersion: 4
services:
    $$cap_appname-redis:
        image: redis:$$cap_redis_version
        volumes:
            - $$cap_appname-cache-data:/app/data
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-postgres:
        image: postgres:$$cap_postgres_version
        volumes:
            - $$cap_appname-postgres-data:/var/lib/postgresql/data
        restart: always
        environment:
            POSTGRES_USER: weblate
            POSTGRES_PASSWORD: $$cap_pg_pass
            POSTGRES_DB: weblate
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname:
        image: weblate/weblate:$$cap_weblate_version
        depends_on:
            - $$cap_appname-postgres
            - $$cap_appname-redis
        volumes:
            - $$cap_appname-data:/app/data
        restart: always
        environment:
            WEBLATE_DEBUG: 0
            WEBLATE_LOGLEVEL: INFO
            WEBLATE_ADMIN_EMAIL: $$cap_admin_email
            WEBLATE_ADMIN_PASSWORD: $$cap_admin_password
            WEBLATE_SERVER_EMAIL: $$cap_server_email
            WEBLATE_DEFAULT_FROM_EMAIL: $$cap_email_from
            WEBLATE_REGISTRATION_OPEN: $$cap_open_registration
            POSTGRES_PASSWORD: $$cap_pg_pass
            POSTGRES_USER: weblate
            POSTGRES_DATABASE: weblate
            POSTGRES_HOST: srv-captain--$$cap_appname-postgres
            REDIS_HOST: srv-captain--$$cap_appname-redis
            WEBLATE_SITE_DOMAIN: $$cap_appname.$$cap_root_domain
            WEBLATE_SITE_TITLE: $$cap_appname Weblate
            WEBLATE_ADMIN_NAME: Weblate Admin
            POSTGRES_PORT: 5432
            REDIS_PORT: 6379
        caproverExtra:
            containerHttpPort: '8080'
caproverOneClickApp:
    variables:
        - id: $$cap_postgres_version
          label: Postgres Docker version
          defaultValue: 13-alpine
          description: Check out their Docker page for the valid versions https://hub.docker.com/r/library/postgres/tags
        - id: $$cap_redis_version
          label: Redis Docker version
          defaultValue: 6-alpine
          description: Check out their Docker page for the valid versions https://hub.docker.com/r/library/redis/tags
        - id: $$cap_weblate_version
          label: weblate Docker Image tag
          defaultValue: 4.4.2-1
          description: latest, edge, bleeding, or version - Check out their Docker page for the valid tags https://hub.docker.com/r/weblate/weblate/tags
        - id: $$cap_pg_pass
          label: Postgres Password
          description: Password must be at least 30 characters.  Please use a random string.
          validRegex: /^[^\@]{30,}$/
        - id: $$cap_admin_email
          label: Email of the first user and administrator of weblate
          description: Will be used to login to weblate
        - id: $$cap_admin_password
          label: Password of the first user and administrator of weblate
          description: Will be used to login to weblate
        - id: $$cap_server_email
          label: Weblate server email
          description: (eg weblate@example.com)
        - id: $$cap_email_from
          label: Weblate FROM email
          description: (eg weblate@example.com)
        - id: $$cap_open_registration
          label: Allow open registration of people (0/1)
          defaultValue: 0
          description: Do you allow people to register openly to the platform?
    instructions:
        start: Open-source collaborative localization tools. Check all the environment settings you can set here - https://github.com/WeblateOrg/docker-compose/blob/master/environment
        end: Weblate is deployed and available as srv-captain--$$cap_appname:80. Note that the application may take up to ten minutes to become available.
    displayName: weblate
    isOfficial: true
    description: Weblate is a copylefted libre software web-based continuous localization system, used by over 1150 libre projects and companies in more than 115 countries.
    documentation: https://hub.docker.com/r/weblate/weblate https://github.com/WeblateOrg/docker-compose https://docs.weblate.org/en/latest/admin/install/docker.html
