forked from dharmeshsing/CoinTossX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_remote.gradle
47 lines (39 loc) · 1.28 KB
/
deploy_remote.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
remotes {
local {
host = '[ip address]'
user = '[username]'
password = '[password]'
knownHosts = allowAnyHosts
}
}
task deployRemote {
doLast {
cleanDirectory(remotes.local)
copyFiles(remotes.local)
}
}
def cleanDirectory(def server){
logger.lifecycle("Clean Software directory ...")
ssh.run {
session(server) {
execute 'rm -r ' + project.softwarePath
execute 'mkdir ' + project.softwarePath
execute 'rm -Rf /dev/shm/aeron'
}
}
}
def copyFiles(def server){
logger.lifecycle("Copy files to server...")
ssh.run {
session(server) {
logger.lifecycle("Copy files to server...")
put from: rootProject.projectDir.absolutePath + '/deploy', into: project.softwarePath
logger.lifecycle("Copy data files to server...")
execute 'mkdir ' + project.softwarePath + '/data'
put from: rootProject.projectDir.absolutePath + '/data', into: project.softwarePath
execute 'mv ' + project.softwarePath + '/deploy/* ' + project.softwarePath
execute 'rm -r ' + project.softwarePath + '/deploy'
execute 'find ' + project.softwarePath + ' -type f -exec chmod 755 {} +'
}
}
}