Skip to content

Commit

Permalink
Merge pull request #7 from Zhicheng-Liu/EE-694
Browse files Browse the repository at this point in the history
EE-694 Add config to build jar and use Postgres
  • Loading branch information
jorizci authored Mar 13, 2019
2 parents 642d505 + 57a09fc commit f996565
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pipeline {
stages {
stage('Default Build pointing to Staging DB') {
steps {
sh "mvn clean package -DskipTests -DbuildDirectory=staging/target -DegaAcccession-db.url=${stagingPostgresDbUrl} -DegaAccession-db.username=${postgresDBUserName} -DegaAcccession-db.password=${postgresDBPassword} -Dinstance.id=ega-accession-01-staging -Dddl-behaviour=${params.DbBehaviour}"
sh "mvn clean package -DskipTests -DbuildDirectory=staging/target -DegaAccession-db.url=${stagingPostgresDbUrl} -DegaAccession-db.username=${postgresDBUserName} -DegaAccession-db.password=${postgresDBPassword} -Dinstance.id=ega-accession-01-staging -Dddl-behaviour=${params.DbBehaviour}"
}
}
stage('Build For FallBack And Production') {
Expand All @@ -35,9 +35,9 @@ pipeline {
}
steps {
echo 'Build pointing to FallBack DB'
sh "mvn clean package -DskipTests -DbuildDirectory=fallback/target -DegaAcccession-db.url=${fallBackPostgresDbUrl} -DegaAccession-db.username=${postgresDBUserName} -DegaAcccession-db.password=${postgresDBPassword} -Dinstance.id=ega-accession-01-fallback -Dddl-behaviour=${params.DbBehaviour}"
sh "mvn clean package -DskipTests -DbuildDirectory=fallback/target -DegaAccession-db.url=${fallBackPostgresDbUrl} -DegaAccession-db.username=${postgresDBUserName} -DegaAccession-db.password=${postgresDBPassword} -Dinstance.id=ega-accession-01-fallback -Dddl-behaviour=${params.DbBehaviour}"
echo 'Build pointing to Production DB'
sh "mvn clean package -DskipTests -DbuildDirectory=production/target -DegaAcccession-db.url=${productionPostgresDbUrl} -DegaAccession-db.username=${postgresDBUserName} -DegaAcccession-db.password=${postgresDBPassword} -Dinstance.id=ega-accession-01-production -Dddl-behaviour=${params.DbBehaviour}"
sh "mvn clean package -DskipTests -DbuildDirectory=production/target -DegaAccession-db.url=${productionPostgresDbUrl} -DegaAccession-db.username=${postgresDBUserName} -DegaAccession-db.password=${postgresDBPassword} -Dinstance.id=ega-accession-01-production -Dddl-behaviour=${params.DbBehaviour}"
}
}
stage('Deploy To Staging') {
Expand Down
20 changes: 15 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>uk.ac.ebi.ega</groupId>
<artifactId>accessioning-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<packaging>${packaging.type}</packaging>

<name>accessioning-service</name>
<url>http://github.com/EBIvariation/ega-accession</url>
Expand All @@ -14,6 +14,7 @@
<hibernate.version>5.2.17.Final</hibernate.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<buildDirectory>${project.basedir}/target</buildDirectory>
<packaging.type>war</packaging.type>
</properties>

<parent>
Expand All @@ -34,14 +35,19 @@
<version>0.6-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>1.4.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -119,6 +125,10 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
17 changes: 14 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
#####################################################################################
# SPRING-CORE
#####################################################################################
spring.application.name=EGA accession service
spring.application.name=ega-accession-service
# Bean jmx domain when using multiple applications with tomcat.
spring.jmx.default-domain=ega-accession
endpoints.jmx.domain=ega-accession
#####################################################################################
# DATABASES
#####################################################################################
spring.jpa.hibernate.use-new-id-generator-mappings=true
spring.datasource.url=@egaAcccession-db.url@
spring.datasource.url=@egaAccession-db.url@
spring.datasource.username=@egaAccession-db.username@
spring.datasource.password=@egaAcccession-db.password@
spring.datasource.password=@egaAccession-db.password@
spring.jpa.hibernate.ddl-auto=@ddl-behaviour@
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect
spring.jpa.generate-ddl=true
#####################################################################################
# ACTUATOR
Expand Down Expand Up @@ -95,3 +96,13 @@ accessioning.monotonic.array.nextBlockInterval=0
accessioning.monotonic.sample.blockSize=1000
accessioning.monotonic.sample.blockStartValue=0
accessioning.monotonic.sample.nextBlockInterval=0

#####################################################################################
# Local Eureka
#####################################################################################
eureka.name=accessionService
eureka.port=8761
eureka.vipAddress=
eureka.serviceUrls=
eureka.client.serviceUrl.defaultZone=
eureka.instance.preferIpAddress=true
5 changes: 4 additions & 1 deletion src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ accessioning.monotonic.array.nextBlockInterval=0

accessioning.monotonic.sample.blockSize=1000
accessioning.monotonic.sample.blockStartValue=0
accessioning.monotonic.sample.nextBlockInterval=0
accessioning.monotonic.sample.nextBlockInterval=0

# disable eureka for test
eureka.client.enabled=false

0 comments on commit f996565

Please sign in to comment.