Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
steklopod committed Jul 9, 2020
1 parent fe47e1f commit 8954e69
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 67 deletions.
38 changes: 38 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -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 }}
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

62 changes: 37 additions & 25 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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):
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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)
___

Expand All @@ -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)
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
19 changes: 11 additions & 8 deletions src/main/kotlin/online/colaba/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = 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")
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/online/colaba/Ssh.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/online/colaba/SshPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SshPlugin : Plugin<Project> {
// 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" }
Expand All @@ -55,7 +55,6 @@ class SshPlugin : Plugin<Project> {
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) }

Expand Down

0 comments on commit 8954e69

Please sign in to comment.