Deploy-Helper는 소프트웨어 개발자를 대상으로하는 아티팩트 배포를위한 작은 도구입니다.
작업을 수행 할 때 테스트 네트워크에 아티팩트를 배포하는 데 도움이되는 Deploy-Helper를 작성했습니다. 나는 아마 그것을 위해 내 IDE를 사용할 수 있었을 것입니다. 그러나 그것은 재미 있지 않습니다!
배포 헬퍼가없는 단계 :
배포 헬퍼가있는 단계 :
기본 구성 파일 deploy-helper.json 작업 디렉토리에 있어야합니다.
예제 구성 :
{
// Required
"destinations" : [
{
// Name of the destination
"name" : "service1" ,
// Normally you would set a real address or a ip here,
// but you could also use aliases from your ssh config (like I did here)
"address" : "test-network" ,
// The path for our destination (used for the ssh session)
"path" : "/home/user/services/service1/data/" ,
// SSH_COMMANDS (ssh first, then commands) or
// COMMANDS_SSH (commands first, then ssh)
"order" : "SSH_COMMANDS"
} ,
{
"name" : "service2" ,
"address" : "test-network" ,
"path" : "/home/user/services/service1/data/" ,
"order" : "SSH_COMMANDS"
}
] ,
// Required
"artifact" : {
// Directory that contains the artifact
"directory" : "./target" ,
// Name regex that matches the artifact
"name" : "my-software-[\d.A-Za-z-]+\.jar" ,
// Sorting operation for possible artifacts
// LAST_MODIFIED_ASC (oldest file first) or
// LAST_MODIFIED_DESC (newest file first)
"sort" : "LAST_MODIFIED_DESC"
} ,
// Optional
"commands" : [
// Can be either a string or an array of strings
"scp {ARTIFACT_PATH} {SSH_USER}@{DEST_ADDRESS}:{DEST_PATH}{ARTIFACT_NAME}"
] ,
// Optional
"ssh" : {
// If port is > 0, the ssh command will be USER@HOST:PORT
// If the port is <= 0, the ssh command will be USER@HOST
"port" : 0 ,
// How long to wait for the connection to establish
"sleep" : "2000" ,
// The ssh user
"user" : "user" ,
// Plaintext password auth requires 'sshpass'
// "password": "foobar",
"commands" : [
// Commands have to be a string
"rm my-software-*.jar"
]
}
}이 예제 구성은 다음을 수행합니다.
rm 명령을 실행하여 오래된 아티팩트를 삭제하십시오scp 명령을 실행하여 새로운 아티팩트를 서버에 복사하십시오 또한 .gitignore 파일에 deploy-helper.json 추가해야합니다.
참고 : 하나의 아티팩트 만있을 수 있습니다.
{DEST_ADDRESS} : 대상 주소
{DEST_NAME} : 대상 이름
{DEST_PATH} : 대상 경로
{SSH_USER} : ssh 사용자
{SSH_PORT} : ssh 포트
{ARTIFACT_PATH} : 아티팩트 경로
{ARTIFACT_NAME} : 아티팩트 이름
| 긴 | 짧은 | 설명 |
|---|---|---|
| -코피그 | -기음 | 구성 위치를 대체하십시오 |
| --말 수가 많은 | -다섯 | 활성화 된 경우 프로세스 출력이 stdout & stderr로 리디렉션됩니다. |
| --목적지 | -디 | 목적지를 무시합니다 (Comma Seperated List) |
Deploy-Helper를 설치하는 것은 최신 릴리스에서 Jar를 다운로드하는 것만 큼 쉽습니다 (이론적으로). 그러나 항아리를 일종의 중앙 위치에 보관해야 할 것입니다.
이것이 ZSH를 사용하여 Linux 시스템에서 배포 헬퍼를 '설치'한 방법입니다.
sudo mkdir /opt/deploy-helpersudo chown max:max /opt/deploy-helpermv ~/Downloads/deploy-helper-*.jar /opt/deploy-helperecho "alias deploy='java --enable-preview -jar /opt/deploy-helper/deploy-helper-VERSION.jar'" >> ~/.zshrc 그런 다음 터미널 (또는 source ~/.zshrc )을 다시 열면 완료됩니다!
기본 명령 :
java --enable-preview -jar deploy-helper-VERSION.jar OPTIONS
명령을 별칭에 바인딩 :
alias deploy='java --enable-preview -jar /opt/deploy-helper/deploy-helper-VERSION.jar'
다른 구성으로 Deploy-Helper 실행 :
deploy -c ~/my-deploy-config.json
지정된 목적지로 배포 헬퍼 실행 :
deploy -d service1,service4,service5
전제 조건 :
단계 :
git clone https://github.com/cerus/deploy-helper.git 복제하십시오cd deploy-helper 이동하십시오mvn clean package 실행하십시오기여 가이드 라인을 따르십시오