captainVersion: 4
services:
    # SearX
    $$cap_appname:
        image: searx/searx:$$cap_searx_version
        environment:
            BIND_ADDRESS: 0.0.0.0:8080
            BASE_URL: https://$$cap_appname.$$cap_root_domain
            MORTY_URL: https://$$cap_appname-morty.$$cap_root_domain
            MORTY_KEY: $$cap_MORTY_KEY
        caproverExtra:
            containerHttpPort: '8080'
    # Filtron
    $$cap_appname-filtron:
        volumes:
            - $$cap_appname-filtron-data:/etc/filtron
        ports:
            - 4004:4004
            - 4005:4005
        restart: always
        caproverExtra:
            dockerfileLines:
                - FROM dalf/filtron@$$cap_filtron_version
                - ADD https://raw.githubusercontent.com/searx/searx-docker/master/rules.json /etc/filtron/rules.json
                - USER root
                - RUN chmod -R 755 /etc/filtron/
                - ENTRYPOINT ["/usr/local/filtron/filtron", "--rules", "/etc/filtron/rules.json", "--listen", "0.0.0.0:4004", "--api", "0.0.0.0:4005", "--target", "srv-captain--searx:8080"]
            containerHttpPort: '3000'
    # Morty
    $$cap_appname-morty:
        restart: always
        environment:
            MORTY_KEY: $$cap_MORTY_KEY
            MORTY_ADDRESS: 0.0.0.0:3000
        caproverExtra:
            containerHttpPort: '3000'
            dockerfileLines:
                - FROM dalf/morty@$$cap_morty_version
                - CMD -timeout 6 -ipv6
    # Checker
    $$cap_appname-checker:
        restart: always
        volumes:
            - $$cap_appname-checker-data:/usr/local/searx-checker/html/data
        caproverExtra:
            notExposeAsWebApp: true
            dockerfileLines:
                - FROM searx/searx-checker@$$cap_checker_version
                - CMD ["-cron", "-o", "html/data/status.json", "http://srv-captain--$$cap_appname:8080"]
caproverOneClickApp:
    variables:
        - id: $$cap_searx_version
          label: Searx Version Tag
          defaultValue: '0.17.0-281-219af243'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/searx/searx/tags/
        - id: $$cap_filtron_version
          label: Filtron Docker Version Hash
          defaultValue: 'sha256:5b55f79b06fdd58122a6d764eca09d2ec687c5af5b78969124e69714d6bb889b'
          description: Starts with 'sha256:'.  Find on https://hub.docker.com/r/dalf/filtron/tags/
        - id: $$cap_morty_version
          label: Morty Docker Version Hash
          defaultValue: 'sha256:cb930c25254337e7a3abaf6daab326c663a4cdf1cbf4ae040ff7f670493df7fd'
          description: Starts with 'sha256:'.  Find on https://hub.docker.com/r/dalf/morty/tags/
        - id: $$cap_checker_version
          label: Searx-checker Docker Version Hash
          defaultValue: 'sha256:8ebda54ed8854e1300a4670e2bba86a5d2f4ceeb5c39290e4cc20df22bf974be'
          description: Starts with 'sha256:'.  Find on https://hub.docker.com/r/searx/searx-checker/tags/
        - label: Morty Secret Key
          description: use openssl rand -base64 33
          defaultValue: RemplaceWithARealKey!
          id: $$cap_MORTY_KEY
    instructions:
        start: >-
            Privacy-respecting, hackable metasearch engine.
        end: >-
            Aaaand you're done! 😄

            Now enable HTTPS on Searx, Filtron & Morty.
    displayName: Searx
    description: Privacy-respecting, hackable metasearch engine.
    documentation: Taken from https://github.com/searx/searx-docker
