From 8954e693403fb0dae82c1e0f2850d4bc6c9fcdfb Mon Sep 17 00:00:00 2001 From: Dmitry Koltovich Date: Thu, 9 Jul 2020 21:08:11 +0300 Subject: [PATCH] 1.3.0 --- .github/labeler.yml | 38 +++++++++++++ .github/workflows/labeler.yml | 12 +++++ .travis.yml | 29 ---------- Readme.md | 62 +++++++++++++--------- build.gradle.kts | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/kotlin/online/colaba/Main.kt | 19 ++++--- src/main/kotlin/online/colaba/Ssh.kt | 2 +- src/main/kotlin/online/colaba/SshPlugin.kt | 3 +- 9 files changed, 102 insertions(+), 67 deletions(-) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml delete mode 100644 .travis.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..47eb6af --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,38 @@ +workflow: + - ".github/**" + - ".gitignore" + +build-gradle: + - "gradle/**" + - "build.gradle.kts" + - "settings.gradle.kts" + - "*/build.gradle.kts" + - "*/settings.gradle.kts" + - "gradle.properties" + +docker: + - "docker-compose.yml" + - "*/docker-compose.yml" + - "docker-compose.dev.yml" + - "*/docker-compose.dev.yml" + - "Dockerfile" + - "*/Dockerfile" + - ".dockerignore" + - "*/.dockerignore" + +env: + - ".env" + - "*/.env" +core: + - "src/main/*" +test: + - "**/src/test/*" + - "**/*/*Test*" +license: + - LICENSE +frontend: + - frontend/**/* + - any: ['*.vue'] + - any: ['*.js'] +deploy-security: + - id_rsa diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..363e019 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: "Add theme labels" + +on: + - pull_request + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cf2fe91..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: java -jdk: - - openjdk11 - -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.m2/ -addons: - sonarcloud: - organization: "steklopod-github" - token: - secure: 46667ecec393ca3715f8c6e344d583f6562b7311 - -before_install: - - chmod +x gradlew -install: skip - -script: - - ./gradlew tasks - - ./gradlew build -after_script: - - ./gradlew sonarqube - -notifications: - email: - on_success: never - on_failure: always diff --git a/Readme.md b/Readme.md index 963520a..97b356a 100644 --- a/Readme.md +++ b/Readme.md @@ -14,14 +14,12 @@ ```kotlin plugins { - id("online.colaba.ssh") version "1.2.34" + id("online.colaba.ssh") version "1.3.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] @@ -31,6 +29,30 @@ ssh { gradle ssh ``` +### Customization: + +#### [CLOUD mode] for deploying Spring Cloud microservices stack (no documentation). +> [DOCUMENTATION NEEDED issue for [CLOUD mode] microservices deployment](https://github.com/steklopod/gradle-ssh-plugin/issues/1) + +1. Register new task in your `build.gradle.kts`: +```kotlin + 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" + } +``` +2. Run this task: +```shell script +gradle customSshTask +``` + +___ ### Available gradle tasks from `ssh` plugin: Send by `ftp` with `ssh` (copy from local to remote server): @@ -52,34 +74,18 @@ Other tasks: * `compose` - docker compose up all docker-services(_gradle subprojects_) with recreate and rebuild * `compose-nginx`, `compose-backend`, `compose-frontend` - docker compose up subproject with recreate and rebuild * `prune` - remove unused docker data +> [DOCUMENTATION NEEDED issue](https://github.com/steklopod/gradle-ssh-plugin/issues/1) > Name of service for all tasks equals to ${project.name} -### Customization: - -1. Register new task in your `build.gradle.kts`: -```kotlin - 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" - } -``` -2. Run this task: -```shell script -gradle customSshTask -``` ___ -#### Preconfigured tasks for publishing/copy by ftp to remote server +### 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**) [TODO documentation for `jars` property for this task] +> [DOCUMENTATION NEEDED issue for [CLOUD mode] microservices deployment](https://github.com/steklopod/gradle-ssh-plugin/issues/1) + You can customize these properties: ```kotlin @@ -92,7 +98,11 @@ You can customize these properties: nginx = true } ``` -Project's structure example for a backend `monolit` architecture + +___ + + +> [MONOLIT mode] Project's structure example for a backend `monolit` architecture ```shell script project |-[backend] @@ -116,6 +126,7 @@ Project's structure example for a backend `monolit` architecture ``` > Default `backend`'s **jar** distribution path: `${project.rootDir}/backend/build/libs/*.jar` +> [DOCUMENTATION NEEDED issue for [CLOUD mode] microservices deployment](https://github.com/steklopod/gradle-ssh-plugin/issues/1) ___ @@ -127,6 +138,7 @@ tasks{ cmd { command = "echo ${project.name}" } } ``` +> [DOCUMENTATION NEEDED issue](https://github.com/steklopod/gradle-ssh-plugin/issues/1) ___ -### TODO documentation for microservices deployment (`ssh-jars` task) +### TODO documentation for [CLOUD mode] microservices deployment (`ssh-jars` task) diff --git a/build.gradle.kts b/build.gradle.kts index 5178de6..3245c2a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } -val pluginsVersion = "1.2.34" +val pluginsVersion = "1.3.0" val sshPlugin = "sshPlugin" description = "EASY-DEPLOY gradle needed tasks" version = pluginsVersion diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 622ab64..bb8b2fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/online/colaba/Main.kt b/src/main/kotlin/online/colaba/Main.kt index d55d8d9..2ae7f45 100644 --- a/src/main/kotlin/online/colaba/Main.kt +++ b/src/main/kotlin/online/colaba/Main.kt @@ -2,28 +2,31 @@ package online.colaba const val DEFAULT_HOST = "colaba.online" + +const val STATIC = "static" + +const val NGINX = "nginx" +const val CHAT = "chat" +const val BACKEND = "backend" +const val POSTGRES = "postgres" +const val FRONTEND = "frontend" + val JAVA_JARS: MutableSet = mutableSetOf( "auth", "card", "mail", - "chat", + CHAT, "gateway", "eureka-server" ) -const val STATIC = "static" - -const val NGINX = "nginx" -const val BACKEND = "backend" -const val POSTGRES = "postgres" -const val FRONTEND = "frontend" //Optional: const val ADMIN_SERVER = "admin-server" const val CONFIG_SERVER = "config-server" -fun jarLibsFolder(folder: String = BACKEND) = "$folder/build/libs" +fun jarLibFolder(folder: String = BACKEND) = "$folder/build/libs" val userHomePath: String = System.getProperty("user.home") val isWindows: Boolean = System.getProperty("os.name").toLowerCase().contains("windows") diff --git a/src/main/kotlin/online/colaba/Ssh.kt b/src/main/kotlin/online/colaba/Ssh.kt index fb2d9ad..eb5de45 100644 --- a/src/main/kotlin/online/colaba/Ssh.kt +++ b/src/main/kotlin/online/colaba/Ssh.kt @@ -101,7 +101,7 @@ open class Ssh : Cmd() { if (nginx) copyWithOverride(NGINX) - if (jars.isNotEmpty()) jars.parallelStream().forEach { copyWithOverride(jarLibsFolder(it)) } + if (jars.isNotEmpty()) jars.parallelStream().forEach { copyWithOverride(jarLibFolder(it)) } if (gradle) copyGradle() diff --git a/src/main/kotlin/online/colaba/SshPlugin.kt b/src/main/kotlin/online/colaba/SshPlugin.kt index 23bc0a8..9f72c24 100644 --- a/src/main/kotlin/online/colaba/SshPlugin.kt +++ b/src/main/kotlin/online/colaba/SshPlugin.kt @@ -40,7 +40,7 @@ class SshPlugin : Plugin { // run = "cd ${project.name} && echo \$PWD" } - JAVA_JARS.forEach{ register("ssh-$it", Ssh::class){ directory = jarLibsFolder(it); description = "Copy [${jarLibsFolder(it)}] to remote server" } } + JAVA_JARS.forEach{ register("ssh-$it", Ssh::class){ directory = jarLibFolder(it); description = "Copy [${jarLibFolder(it)}] to remote server" } } register("ssh-jars", Ssh::class) { jars = JAVA_JARS; description = "Copy all {*.jars} to remote server" } register("ssh-$FRONTEND", Ssh::class){ frontend = true; description = "Copy [$FRONTEND] jar to remote server" } register("ssh-$NGINX", Ssh::class) { nginx = true; description = "Copy [$NGINX] jar to remote server" } @@ -55,7 +55,6 @@ class SshPlugin : Plugin { register("compose-$POSTGRES", DockerCompose::class){ service = POSTGRES; description = "Docker compose up for [$POSTGRES] container" } register("compose-$BACKEND", DockerCompose::class) { service = BACKEND; description = "Docker compose up for [$BACKEND] container" } - register("clear-$FRONTEND", Ssh::class){ clearNuxt = true; description = "Remove local [node_modules] & [.nuxt]" } register("prune", Cmd::class){ command = "docker system prune -fa"; description = "Remove unused docker data"; group = dockerMainGroupName(project.name) }