bmuschko / gradle-cargo-plugin

Gradle plugin that provides deployment capabilities to local and remote containers via Cargo
Apache License 2.0
258 stars 63 forks source link

deploy to tomcat subdomain #202

Open MVTec opened 4 years ago

MVTec commented 4 years ago

I want to deploy x.war in tomcat using cargo plugin "com.bmuschko.cargo-base". This application runs on subdomain and has a non default appBase. Moreover behind loadbalancer on two Servers x1.y.de and x2.y.de

tomcat server.xml

<Host
                name="x.y.de"
                debug="0"
                appBase="x_webapps"
                ...     
</Host>

defined servers as below in build.gradle

def servers =[
    'x.y.de': [
        'configPath': 'properties/prod/x',
        'remote': [
            [
                'hostname': 'x1.y.de',
                'port': 80,
                'username': 'abc',
                'password': '...'
            ],
            [
                'hostname': 'x2.y.de',
                'port': 80,
                'username': 'abc',
                'password': '...'
            ]
        ]
    ]
]

using this for deployment

servers.each { host, server ->
    server.get('remote').each { config ->
        def serverName = config.hostname.replace('.', '').replace('-', '').capitalize()

        task "deployRemote${serverName}"(type: com.bmuschko.gradle.cargo.tasks.remote.CargoRedeployRemote) {
            description = "Deploys WAR to remote Tomcat '${config.name}'."
            containerId = 'tomcat8x'
            hostname = config.hostname
            port = config.port
            username = config.username
            password = config.password
        }
    }
}

This works for application in webapps directory but nor for the ones with subdomain Any idea, how to get it working?