{
    "captainVersion": "2",
    "documentation": "Taken from https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml",
    "displayName": "",
    "description": "PeerTube is a decentralized video hosting network, based on free/libre software",
    "dockerCompose": {
        "version": "1",
        "services": {
            "$$cap_appname-db": {
                "image": "postgres:$$cap_postgres_version",
                "notExposeAsWebApp": "true",
                "volumes": [
                    "$$cap_appname-db-data:/var/lib/postgresql/data"
                ],
                "restart": "always",
                "environment": {
                    "POSTGRES_USER": "$$cap_db_user",
                    "POSTGRES_PASSWORD": "$$cap_db_pass",
                    "POSTGRES_DB": "peertube"
                }
            },
            "$$cap_appname-redis": {
                "image": "redis:$$cap_redis_version",
                "notExposeAsWebApp": "true",
                "volumes": [
                    "$$cap_appname-redis-data:/data"
                ],
                "restart": "always"
            },
            "$$cap_appname": {
                "depends_on": [
                    "$$cap_appname-db",
                    "$$cap_appname-redis"
                ],
                "image": "chocobozzz/peertube:$$cap_peertube_version",
                "containerHttpPort": "9000",
                "volumes": [
                    "$$cap_appname-peertube-data:/data",
                    "$$cap_appname-peertube-config:/config"
                ],
                "restart": "always",
                "environment": {
                  "PEERTUBE_DB_USERNAME": "$$cap_db_user",
                  "PEERTUBE_DB_PASSWORD": "$$cap_db_pass",
                  "PEERTUBE_DB_HOSTNAME": "srv-captain--$$cap_appname-db",
                  "PEERTUBE_REDIS_HOSTNAME": "srv-captain--$$cap_appname-redis",
                  "PEERTUBE_WEBSERVER_HOSTNAME": "$$cap_appname.$$cap_root_domain",
                  "PEERTUBE_WEBSERVER_PORT": "443",
                  "PEERTUBE_WEBSERVER_HTTPS": "true",
                  "PEERTUBE_TRUST_PROXY": "[\"127.0.0.1\", \"loopback\", \"172.18.0.0/16\"]",
                  "PEERTUBE_SMTP_USERNAME": "$$cap_smtp_username",
                  "PEERTUBE_SMTP_PASSWORD": "$$cap_smtp_password",
                  "PEERTUBE_SMTP_HOSTNAME": "$$cap_smtp_hostname",
                  "PEERTUBE_SMTP_PORT": "$$cap_smtp_port",
                  "PEERTUBE_SMTP_FROM": "$$cap_smtp_from",
                  "PEERTUBE_SMTP_TLS": "$$cap_smtp_tls",
                  "PEERTUBE_SMTP_DISABLE_STARTTLS": "$$cap_smtp_starttls",
                  "PEERTUBE_ADMIN_EMAIL": "$$cap_admin_email"
                }
            }
        },
        "volumes": {
            "db_data": {}
        }
    },
    "instructions": {
        "start": "PeerTube is a free, decentralized and federated video platform. (Github : https://github.com/Chocobozzz/PeerTube/)",
        "end": "Peertube is deployed and available as $$cap_appname-peertube. \n\n IMPORTANT: It will take up to 2 minutes for peertube to be ready. Before that, you might see 502 error page.\n"
    },
    "variables": [{
            "id": "$$cap_db_user",
            "label": "Database user",
            "defaultValue": "peertubeuser",
            "validRegex": "/^([a-zA-Z0-9])+$/"
        },
        {
            "id": "$$cap_db_pass",
            "label": "Database password",
            "description": "",
            "validRegex": "/.{1,}/"
        },
        {
            "id": "$$cap_postgres_version",
            "label": "Postgress Version",
            "defaultValue": "10-alpine",
            "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/library/postgress/tags/",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_redis_version",
            "label": "Redis Version",
            "defaultValue": "4-alpine",
            "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/library/redis/tags/",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_peertube_version",
            "label": "Peertube Version",
            "defaultValue": "production-stretch",
            "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/chocobozzz/peertube/tags/",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_smtp_username",
            "label": "SMTP username",
            "defaultValue": ""
        },
        {
            "id": "$$cap_smtp_from",
            "label": "SMTP from",
            "defaultValue": ""
        },
        {
            "id": "$$cap_smtp_password",
            "label": "SMTP password",
            "defaultValue": ""
        },
        {
            "id": "$$cap_smtp_hostname",
            "label": "SMTP hostname",
            "defaultValue": ""
        },
        {
            "id": "$$cap_smtp_port",
            "label": "SMTP port",
            "defaultValue": ""
        },
        {
            "id": "$$cap_smtp_tls",
            "label": "SMTP TLS",
            "defaultValue": "false"
        },
        {
            "id": "$$cap_smtp_starttls",
            "label": "SMTP STARTTLS",
            "defaultValue": "false"
        },
        {
            "id": "$$cap_admin_email",
            "label": "administrator email",
            "defaultValue": ""
        }
    ]

}
