1.1.0 is here
🛡 SSH
- gradle plugin for easy deploy by ftp
Quick start
-
You must have
id_rsa
private key (on your local machine:{user.home}/.ssh/id_rsa
) to use this plugin -
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):
publishBack
- copy backend distribution*.jar
-filepublishFront
- copy frontend folderpublishNginx
- copy nginx folderpublishGradle
- copy gradle needed filespublishDocker
- 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:
- 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"
}
- 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}" }
}