Remote interactive plugins (idea uses gradle interfaces with remote servers, publishing services, viewing logs, connecting arthas, etc.)
Use Instructions
vi ~/.ssh/config
# Development environment
Host xx.dev.iuin
HostName 1.0.1.1
User root
Port 222
IdentitFile ~/.ssh/id_ed25519_iu
ssh-copy-id -i ~/.ssh/id_ed25519_iu xxx.dev.iuin
Combined gradle usage
- Add the following to build.gradle file at the root of the project
// Add the following to build.gradle file in project root directory
plugins {
id 'io.github.iuin8.remote' version '0.1.36'
}
group = 'com.xxx.xxx'
version = '3.0.0'
- Add the following to the settings.gradle file at the root of the project
// Settings under the project root directory. Add the following to the radle file the
//gradle plugin repository
pluginManagement ROL
repositories are subject to the
///local
mavenLocal()
//private sub
maven 0
url 'http://10. 1.11. 1:11111/repository/maven-public/'
allowInsecureProtocol = true
}
//domestic image
maven
url 'https://maven. liyun. om/repository/public'
}
//gradle official Portal
gradlePluginPortal()
//alternate
mavenCentral()
}
}
- Profiles :
/remote-plugin/remote.yml
# Configuration file: {project_root}/remote-plugin/remote.yml
# Remote plugin configuration example
# Supported placeholders:
# - ${service} : current Gradle project name
# - ${REMOTE_BASE_DIR} : value of remote.base.dir
# - ${remote.base.dir} : same as above
# Environment configurations
# Each environment can have its own settings
environments:
# Development environment configuration (from gradle-dev.properties)
dev:
remote:
server: xxx.dev.iuin
base:
dir: /data/xxx
# Other environments, e.g.: test environment, production environment, etc.
test:
remote:
server: xxx.test.iuin
base:
dir: /data/xxx
# Service ports configuration (previously in service-ports.json)
service:
ports:
order-service: 1111
start:
command: $REMOTE_BASE_DIR/$SERVICE_NAME/$SERVICE_NAME-start.sh
# command: sudo systemctl restart $SERVICE_NAME
env:
JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:3$SERVICE_PORT
# Configure log file pattern for logTask (logTo<Profile>)
# Default resolves to: ${REMOTE_BASE_DIR}/../logs/${service}.log
log:
filePattern: ${REMOTE_BASE_DIR}/../logs/${service}.log
- Publish Example Service
# bash ./gradlew :order-service:publish\(dev\) --info
bash ./gradlew :order-service:publish\(dev\)
# Execute this command, or double click this gradle task directly in idea, can post services to remote server
