-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
158 lines (138 loc) · 4.75 KB
/
build.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
buildscript {
ext {
springBootVersion = '1.5.21.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'java-library'
id 'com.sourcemuse.mongo' version '1.0.0'
id 'org.hidetake.ssh' version "1.1.3"
id 'org.springframework.boot' version '1.5.21.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'application'
}
group = 'uk.ac.ebi.subs'
version = '0.4.1-SNAPSHOT'
mainClassName = "uk.ac.ebi.subs.FileChecksumCalculatorApplication"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('uk.ac.ebi.subs:subs-repository:2.33.1-SNAPSHOT')
compile("de.siegmar:logback-gelf:1.1.0")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
test {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
runWithMongoDb = true
}
mongo {
mongoVersion = "3.4.3"
}
springBoot {
executable = true
}
ext.gradle_env = hasProperty('env') ? env : 'dev'
remotes {
devFCCOnCluster {
role('dev')
host = project.hasProperty(project.name + "DevOnClusterDeployTarget") ? getProperty(project.name + "DevOnClusterDeployTarget") : 'localhost'
}
devFCCOnFUSHH {
role('dev')
host = project.hasProperty(project.name + "DevOnFUSHHDeployTarget") ? getProperty(project.name + "DevOnFUSHHDeployTarget") : 'localhost'
}
testFCCOnCluster {
role('test')
host = project.hasProperty(project.name + "TestOnClusterDeployTarget") ? getProperty(project.name + "TestOnClusterDeployTarget") : 'localhost'
}
testFCCOnFUSHH1 {
role('test')
host = project.hasProperty(project.name + "TestOnFUSHH1DeployTarget") ? getProperty(project.name + "TestOnFUSHH1DeployTarget") : 'localhost'
}
testFCCOnFUSHH2 {
role('test')
host = project.hasProperty(project.name + "TestOnFUSHH2DeployTarget") ? getProperty(project.name + "TestOnFUSHH2DeployTarget") : 'localhost'
}
prodFCCOnCluster {
role('prod')
host = project.hasProperty(project.name + "ProdOnClusterDeployTarget") ? getProperty(project.name + "ProdOnClusterDeployTarget") : 'localhost'
}
prodFCCOnFUSHH1 {
role('prod')
host = project.hasProperty(project.name + "ProdOnFUSHH1DeployTarget") ? getProperty(project.name + "ProdOnFUSHH1DeployTarget") : 'localhost'
}
prodFCCOnFUSHH2 {
role('prod')
host = project.hasProperty(project.name + "ProdOnFUSHH2DeployTarget") ? getProperty(project.name + "ProdOnFUSHH2DeployTarget") : 'localhost'
}
prodFCCOnFUSHH3 {
role('prod')
host = project.hasProperty(project.name + "ProdOnFUSHH3DeployTarget") ? getProperty(project.name + "ProdOnFUSHH3DeployTarget") : 'localhost'
}
}
ssh.settings {
user = 'sub_adm'
}
if (project.hasProperty('sshKeyFile')) {
ssh.settings.identity = new File(sshKeyFile)
}
if (project.hasProperty('sshPassphrase')) {
ssh.settings.passphrase = sshPassphrase
}
task deployJar(type: SshTask, dependsOn: 'build') {
doLast {
sshRun()
}
ssh.settings {
knownHosts = allowAnyHosts
}
}
task testSsh(type: SshTask) {
doLast {
sshTestRun()
}
ssh.settings {
knownHosts = allowAnyHosts
}
}
private Object sshRun() {
ssh.run {
session(remotes.role(gradle_env)) {
execute "/homes/sub_adm/create_dirs.sh $gradle_env $project.name", ignoreError: false
def jarFileName = project.name + "-" + project.version + "." + System.currentTimeMillis() + ".jar"
File jarDeployFile = new File("/homes/sub_adm/apps/$env/$project.name/jar",jarFileName)
File jarDeployDir = jarDeployFile.getParentFile()
println "Uploading jar $jar.archivePath.name to $jarDeployFile.absolutePath area on $remote"
put(jar.archivePath.absolutePath, jarDeployFile.absolutePath)
println "creating symbolic link to $jar.archiveName"
def result = execute "ln -s -f $jarDeployFile.absolutePath $jarDeployDir/$jar.baseName" + ".jar", ignoreError: true
println result
println "updating permissions of $jarDeployDir/$jar.archiveName"
execute "chmod u+x $jarDeployDir/*", ignoreError: false
}
}
}
private Object sshTestRun(){
ssh.run {
session(remotes.role(gradle_env)){
println "started ssh session"
}
}
}