package com.mirantis.mcp

def checkPortIsFree(String localPort) {
    withEnv(["port=${localPort}"]) {
        sh '''
            if netstat -pnat | grep -qw "${port}"; then
                echo "Port ${port} is already opened."
                exit 1
            fi
        '''
    }
}

def deployProxy(String confDir, String proxyPassURL, String localPort) {
    withEnv(["localPort=${localPort}",
             "proxyPassURL=${proxyPassURL}",
             "confDir=${confDir}"]) {
        sh '''\
            cat <<EOF > "${confDir}/nginx-${localPort}"
            worker_processes auto;
            user jenkins;
            pid ${confDir}/nginx-${localPort}.pid;
            error_log /dev/null;
            #
            events {
               worker_connections 768;
            }
            #
            http {
                sendfile on;
                tcp_nopush on;
                tcp_nodelay on;
                keepalive_timeout 65;
                types_hash_max_size 2048;
                #
                include /etc/nginx/mime.types;
                default_type application/octet-stream;
                #
                access_log off;
                #
                server {
                    listen ${localPort} default_server;
                    #
                    server_name _;
                    client_max_body_size 0;
                    # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
                    chunked_transfer_encoding on;
                    #
                    location / {
                        proxy_set_header  Host              \\$http_host;   # required for docker client's sake
                        proxy_set_header  X-Real-IP         \\$remote_addr; # pass on real client's IP
                        proxy_set_header  X-Forwarded-For   \\$proxy_add_x_forwarded_for;
                        proxy_set_header  X-Forwarded-Proto \\$scheme;
                        proxy_read_timeout                  900;
                        proxy_pass                          ${proxyPassURL} ;
                    }
                }
            }'''.stripIndent()
        }
    sh "nginx -t -c ${confDir}/nginx-${localPort}"
    sh "nginx -c ${confDir}/nginx-${localPort}"
    return "127.0.0.1:${localPort}"
}

def destroyProxy(String confDir, String localPort) {
    def proxyPid = sh(script: "cat ${confDir}/nginx-${localPort}.pid",
                      returnStdout: true).trim()
    if ( proxyPid ) {
        sh "kill ${proxyPid}"
    }
}
