Skip to content

Releases: steklopod/gradle-ssh-plugin

1.8.13

06 Feb 11:49
e804cce
Compare
Choose a tag to compare

All bugs are fixed now 🔫

backends (monolit/microservices)

  • autoserch of backends jars locations for CD

frontend

  • autosearch frontend folder
  • nuxt + nuxt-bridge distribution autodetect
  • clear node-modules and other files task in help category of gradle tasks

other

  • CD of docker, gradle files
  • static folder deploy if not exists on remote server (without overriding)

docker-compose

After deploying to remote server we need to recreate remotely all our docker containers. This plugin brings such gradle-tasks.

Available customisation parameters (all are optional):

    user      : String = "root"
    host      : String? = null

    postgres  : String? = null

    directory : String? = null

    run : String = "cd ${project.name} && echo \$PWD"

    gradle           : Boolean = false

    docker           : Boolean = false

    backend          : Boolean = false
    jars             : List<String> = listOf()

    frontend                   : Boolean = false
    frontendClear              : Boolean = false
    frontendWhole              : Boolean = false
    frontendDistCompressed     : Boolean = false
    frontendFolder             : String? = null

    nginx           : Boolean = false

    static          : Boolean = false
    staticOverride  : Boolean = false

    envFiles        : Boolean = false

    elastic         : Boolean = false
    kibana          : Boolean = false
    admin           : Boolean = false
    logstash        : Boolean = false
    broker          : Boolean = false
    config          : Boolean = false

    withBuildSrc    : Boolean = false

    checkKnownHosts : Boolean = false

    server : SshServer? = null

1.3.0 is here

09 Jul 18:08
Compare
Choose a tag to compare

✉️ Chat enable by default

  • Current configuration of main task
register("publish", Ssh::class) {
                description = "Copy for all projects to remote server)"

                jars = JAVA_JARS

                nginx = true
                docker = true
                gradle = true
                static = true
                frontend = true
                postgres = true
                clearNuxt = true

                admin = false
                config = false
                monolit = false
            }

1.1.0 is here

26 Dec 12:13
Compare
Choose a tag to compare

🛡 SSH - gradle plugin for easy deploy by ftp Build Status Quality Gate Status

Quick start

  1. You must have id_rsa private key (on your local machine: {user.home}/.ssh/id_rsa) to use this plugin

  2. In your build.gradle.kts file

plugins {
     id("online.colaba.ssh") version "1.1.0"
}

ssh {
    host = "hostexample.com"; user = "user"   
    directory = "distribution"
    run = "ls -a"
}

This tasks will copy local project distribution folder into remote ~/{project.name}/ and print it [will execute by ftp with ssh]

🎯 Run task:

gradle ssh

Available gradle tasks from ssh plugin:

Send by ftp with ssh (copy from local to remote server):

  1. publishBack - copy backend distribution *.jar-file
  2. publishFront - copy frontend folder
  3. publishNginx - copy nginx folder
  4. publishGradle - copy gradle needed files
  5. publishDocker - copy docker files

All this tasks includes in 1 task:

  • publish - all enabled by default (true)

All this tasks excluded in 1 task:

  • ssh task, where all disabled by default (false) but can be included manually.

Other tasks:

  • compose - docker compose up all (including subprojects) docker-services with recreate and rebuild

  • composeDev - docker compose up all (including subprojects) docker-services with recreate and rebuild from docker-compose.dev.yml file

  • composeNginx, composeBack, composeFront - docker compose up subproject with recreate and rebuild

  • recomposeAll - docker compose up after removing nginx, frontend & backend subproject-containers

  • recomposeAllDev - docker compose up after removing nginx, frontend & backend subproject-containers from docker-compose.dev.yml file

  • prune - remove unused docker data

  • removeBackAndFront - remove backend, frontend containers

  • removeAll - remove nginx, frontend, backend containers

Name of service for all tasks equals to ${project.name}

Customization:

  1. Register new task in your build.gradle.kts:
        register("customSshTask", Ssh::class) {
            host = "hostexample.com"
            user = "root"
            gradle = true
            frontend = true
            backend = true
            docker = true
            nginx = true
            run = "cd ${project.name} && echo \$PWD"
        }
  1. Run this task:
gradle customSshTask

Preconfigured tasks for publishing/copy by ftp to remote server

By default you have preconfigured profiles tasks:

  • ssh - all disabled by default (false)
  • publish - all enabled by default (true)

You can customize this properties:

        ssh {
            host = "hostexample.com"
            user = "root"
            frontendFolder = "client"
            backendFolder = "server"
            directory = "copy_me_to_remote"
            nginx = true
        }

Project's structure example

 project
   |-[backend]
              | - [build/libs]/*.jar
              | - Dockerfile
              | - Dockerfile.dev
              | - docker-compose.yml
              | - docker-compose.dev.yml
              | - ...
   |-[frontend]
              | - docker-compose.yml
              | - ...
   |-[nginx]
              | - ...
   |-[gradle]
              | - ...
   |- gradlew
   |- gradlew.bat
   |- docker-compose.yml
   |- ...

Default backend's jar distribution path: ${project.rootDir}/backend/build/libs/*.jar


Optional

With ssh plugin you have additional bonus task for executing a command line process on local PC [linux/windows]:

tasks{
      cmd { command = "echo ${project.name}" }
}