captainVersion: 4
services:
    $$cap_appname:
        image: collabora/code:$$cap_collabora_version
        restart: always
        environment:
            domain: $$cap_wopihost_domain
            cert_domain: $$cap_appname.$$cap_root_domain
            server_name: $$cap_appname.$$cap_root_domain
            extra_params: --o:ssl.enable=false --o:ssl.termination=true
            username: $$cap_admin_user
            password: $$cap_admin_pass
        caproverExtra:
            containerHttpPort: '9980'
caproverOneClickApp:
    variables:
        - id: $$cap_admin_user
          label: Admin user
          description: permit access to the web admin interface
          defaultValue: adminuser
          validRegex: /^([a-zA-Z0-9])+$/
        - id: $$cap_admin_pass
          label: Admin password
          description: admin password
          validRegex: /.{1,}/
        - id: $$cap_collabora_version
          label: Collabora CODE Version
          defaultValue: 4.2.4.4
          description: Check out their docker page for the valid tags https://hub.docker.com/r/collabora/code/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_wopihost_domain
          label: WOPI host domain - yournextcloud.your.rootdomain.com
          description: >-
              Your Nextcloud host domain.

              Caution ! you must add a backslash before each dot of the url
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: >-
            Collabora CODE version is an online Office Suite.

            When you are using Nextcloud or ownCloud you can use it to enhance your online office document experience.

            The install will take about a minute for the process to finish.
        end: >-
            Collabora is deployed and available as $$cap_appname.


            IMPORTANT: You need do 5 manual steps before access.

            1 - Enable websocket on HTTP settings tab

            2 - Add the "proxy_read_timeout 36000s;" instruction below "proxy_http_version 1.1;"

            3 - Enable and force HTTPS and wait few minutes.

            4 - Add the Collabora Online extension for Nextcloud (3.7.0 for now)

            5 - Go to your Nextcloud plugin configuration > collabora online > use your own server > paste the FQDN of your new instance of collabora > save

            That's all, you can use collabora online to all your Nextcloud instance.
    displayName: Collabora Online
    isOfficial: true
    description: Collabora Online is an online and collaborating office suite
    documentation: Inspired by https://github.com/caprover/one-click-apps/pull/111 and from https://www.collaboraoffice.com/code/docker/
