Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
07227940
Commit
07227940
authored
Apr 28, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support eureka configuration with multiple envs
parent
d57dd58a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
207 additions
and
151 deletions
+207
-151
pom.xml
apollo-adminservice/pom.xml
+0
-6
assembly-descriptor.xml
apollo-adminservice/src/assembly/assembly-descriptor.xml
+36
-47
bootstrap.yml
apollo-adminservice/src/main/resources/bootstrap.yml
+9
-2
pom.xml
apollo-biz/pom.xml
+6
-0
CtripEurekaClientConfig.java
.../com/ctrip/apollo/biz/eureka/CtripEurekaClientConfig.java
+28
-0
CtripEurekaSettings.java
...java/com/ctrip/apollo/biz/eureka/CtripEurekaSettings.java
+47
-0
assembly-descriptor.xml
apollo-configservice/src/assembly/assembly-descriptor.xml
+36
-47
bootstrap.yml
apollo-configservice/src/main/resources/bootstrap.yml
+9
-2
assembly-descriptor.xml
apollo-portal/src/assembly/assembly-descriptor.xml
+36
-47
No files found.
apollo-adminservice/pom.xml
View file @
07227940
...
...
@@ -25,12 +25,6 @@
<scope>
test
</scope>
</dependency>
<!-- end of apollo -->
<!-- eureka -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka
</artifactId>
</dependency>
<!-- end of eureka -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
...
...
apollo-adminservice/src/assembly/assembly-descriptor.xml
View file @
07227940
...
...
@@ -7,53 +7,41 @@
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>
true
</useAllReactorProjects>
<fileSets>
<!--scripts -->
<fileSet>
<directory>
src/main/scripts
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*:apollo-buildtools:*
</include>
<include>
*:apollo-adminservice:*
</include>
<include>
*.sh
</include>
</includes>
<sources>
<includeModuleDirectory>
false
</includeModuleDirectory>
<fileSets>
<!--scripts -->
<fileSet>
<directory>
src/main/scripts
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*.sh
</include>
</includes>
<fileMode>
0755
</fileMode>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
config
</outputDirectory>
<excludes>
<exclude>
apollo-adminservice.conf
</exclude>
</excludes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
apollo-adminservice.conf
</include>
</includes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
<directory>
target
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
${project.artifactId}-*.jar
</include>
</includes>
<fileMode>
0755
</fileMode>
</fileSet>
</fileSets>
</sources>
</moduleSet>
</moduleSets>
<fileMode>
0755
</fileMode>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
config
</outputDirectory>
<excludes>
<exclude>
apollo-adminservice.conf
</exclude>
</excludes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
apollo-adminservice.conf
</include>
</includes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
<directory>
target
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
${project.artifactId}-*.jar
</include>
</includes>
<fileMode>
0755
</fileMode>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
apollo-adminservice/src/main/resources/bootstrap.yml
View file @
07227940
...
...
@@ -5,4 +5,11 @@ eureka:
serviceUrl
:
defaultZone
:
http://${eureka.instance.hostname}:8080/eureka/
healthcheck
:
enabled
:
true
\ No newline at end of file
enabled
:
true
ctrip
:
eureka
:
dev
:
http://${ctrip_eureka_dev:localhost}:8080/eureka/
fat
:
http://${ctrip_eureka_fat:localhost}:8080/eureka/
uat
:
http://${ctrip_eureka_uat:localhost}:8080/eureka/
pro
:
http://${ctrip_eureka_pro:localhost}:8080/eureka/
\ No newline at end of file
apollo-biz/pom.xml
View file @
07227940
...
...
@@ -22,6 +22,12 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<!-- eureka -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka
</artifactId>
</dependency>
<!-- end of eureka -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
...
...
apollo-biz/src/main/java/com/ctrip/apollo/biz/eureka/CtripEurekaClientConfig.java
0 → 100644
View file @
07227940
package
com
.
ctrip
.
apollo
.
biz
.
eureka
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.netflix.eureka.EurekaClientConfigBean
;
import
org.springframework.stereotype.Component
;
@Component
public
class
CtripEurekaClientConfig
extends
EurekaClientConfigBean
{
@Autowired
private
CtripEurekaSettings
eurekaSettings
;
/**
* Assert only one zone: defaultZone, but multiple environments.
*/
public
List
<
String
>
getEurekaServerServiceUrls
(
String
myZone
)
{
String
serviceUrls
=
eurekaSettings
.
getDefaultEurekaUrl
(
myZone
);
if
(
serviceUrls
!=
null
)
{
return
Arrays
.
asList
(
serviceUrls
.
split
(
","
));
}
else
{
return
super
.
getEurekaServerServiceUrls
(
myZone
);
}
}
}
apollo-biz/src/main/java/com/ctrip/apollo/biz/eureka/CtripEurekaSettings.java
0 → 100644
View file @
07227940
package
com
.
ctrip
.
apollo
.
biz
.
eureka
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
com.ctrip.apollo.core.enums.Env
;
import
com.ctrip.apollo.core.enums.EnvUtils
;
import
com.ctrip.framework.foundation.Foundation
;
@Component
public
class
CtripEurekaSettings
{
@Value
(
"${ctrip.eureka.dev:localhost}"
)
private
String
devEureka
;
@Value
(
"${ctrip.eureka.fat:localhost}"
)
private
String
fatEureka
;
@Value
(
"${ctrip.eureka.uat:localhost}"
)
private
String
uatEureka
;
@Value
(
"${ctrip.eureka.pro:localhost}"
)
private
String
proEureka
;
public
String
getDefaultEurekaUrl
(
String
zone
)
{
Env
env
=
EnvUtils
.
transformEnv
(
Foundation
.
server
().
getEnvType
());
if
(
env
==
null
)
{
return
null
;
}
switch
(
env
)
{
case
LOCAL:
return
null
;
case
DEV:
return
devEureka
;
case
FAT:
case
FWS:
return
fatEureka
;
case
UAT:
return
uatEureka
;
case
TOOLS:
case
PRO:
return
proEureka
;
default
:
return
null
;
}
}
}
apollo-configservice/src/assembly/assembly-descriptor.xml
View file @
07227940
...
...
@@ -7,53 +7,41 @@
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>
true
</useAllReactorProjects>
<fileSets>
<!--scripts -->
<fileSet>
<directory>
src/main/scripts
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*:apollo-buildtools:*
</include>
<include>
*:apollo-configservice:*
</include>
<include>
*.sh
</include>
</includes>
<sources>
<includeModuleDirectory>
false
</includeModuleDirectory>
<fileSets>
<!--scripts -->
<fileSet>
<directory>
src/main/scripts
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*.sh
</include>
</includes>
<fileMode>
0755
</fileMode>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
config
</outputDirectory>
<excludes>
<exclude>
apollo-configservice.conf
</exclude>
</excludes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
apollo-configservice.conf
</include>
</includes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
<directory>
target
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
${project.artifactId}-*.jar
</include>
</includes>
<fileMode>
0755
</fileMode>
</fileSet>
</fileSets>
</sources>
</moduleSet>
</moduleSets>
<fileMode>
0755
</fileMode>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
config
</outputDirectory>
<excludes>
<exclude>
apollo-configservice.conf
</exclude>
</excludes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
apollo-configservice.conf
</include>
</includes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
<directory>
target
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
${project.artifactId}-*.jar
</include>
</includes>
<fileMode>
0755
</fileMode>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
apollo-configservice/src/main/resources/bootstrap.yml
View file @
07227940
...
...
@@ -6,4 +6,11 @@ eureka:
serviceUrl
:
defaultZone
:
http://${eureka.instance.hostname}:8080/eureka/
healthcheck
:
enabled
:
true
\ No newline at end of file
enabled
:
true
ctrip
:
eureka
:
dev
:
http://${ctrip_eureka_dev:localhost}:8080/eureka/
fat
:
http://${ctrip_eureka_fat:localhost}:8080/eureka/
uat
:
http://${ctrip_eureka_uat:localhost}:8080/eureka/
pro
:
http://${ctrip_eureka_pro:localhost}:8080/eureka/
\ No newline at end of file
apollo-portal/src/assembly/assembly-descriptor.xml
View file @
07227940
...
...
@@ -7,53 +7,41 @@
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>
true
</useAllReactorProjects>
<fileSets>
<!--scripts -->
<fileSet>
<directory>
src/main/scripts
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*:apollo-buildtools:*
</include>
<include>
*:apollo-portal:*
</include>
<include>
*.sh
</include>
</includes>
<sources>
<includeModuleDirectory>
false
</includeModuleDirectory>
<fileSets>
<!--scripts -->
<fileSet>
<directory>
src/main/scripts
</directory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<include>
*.sh
</include>
</includes>
<fileMode>
0755
</fileMode>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
config
</outputDirectory>
<excludes>
<exclude>
apollo-portal.conf
</exclude>
</excludes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
apollo-portal.conf
</include>
</includes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
<directory>
target
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
${project.artifactId}-*.jar
</include>
</includes>
<fileMode>
0755
</fileMode>
</fileSet>
</fileSets>
</sources>
</moduleSet>
</moduleSets>
<fileMode>
0755
</fileMode>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
config
</outputDirectory>
<excludes>
<exclude>
apollo-portal.conf
</exclude>
</excludes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<fileSet>
<directory>
src/main/config
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
apollo-portal.conf
</include>
</includes>
<lineEnding>
unix
</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
<directory>
target
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
${project.artifactId}-*.jar
</include>
</includes>
<fileMode>
0755
</fileMode>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment