Skip to content

timmo/gradle-ssh-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

gradle-ssh-deployment

Deployment via "rolling update" implemented with gradle ssh plugin.

A simple but adequate solution for Micro Service Deployment Pipelines.

See also

remotes {
  Closure id_rsa = {
    file("${System.properties['user.home']}/.ssh/id_rsa")
  }
  at1 {
    role 'at' // automated test stage
    host = 'myservice1.at.local'
    user = 'myservice'
    identity = id_rsa.call()
  }
  at2 {
    role 'at'
    host = 'myservice2.at.local
    ...
  }
  ps1 { ... } // production stage
  ps2 { ... }
}

['at', 'ps'].each { stage ->
  task "deploy${stage}"(type: SshTask) {
    String artefaktUri = ...  // points to maven repository
    session(remotes.role(stage)) {
      execute('if [ -x service.sh ]; then ./service.sh stop; fi')
      put('pipeline/deployable/downloadAndUnpack.sh', './')
      execute("chmod 755 ./downloadAndUnpack.sh; ./downloadAndUnpack.sh ${artefaktUri}")
      execute("./service.sh start", pty: true)
      execute("./waitForServiceStart.sh")
    }
  }
}

About

Deployment via "rolling update" implemented with gradle ssh plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published