Skip to content

Commit

Permalink
misc changes for 1.3.0
Browse files Browse the repository at this point in the history
1. fix flyway migration Chinese garbled issue
2. limit hibernate query plan cache
3. fix import/export api
4. wording update for yaml/yml namespace support
5. update ldap sample configurations
  • Loading branch information
nobodyiam committed Feb 14, 2019
1 parent b45405b commit 81a1bce
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 22 deletions.
@@ -0,0 +1,18 @@
# ldap sample for active directory, need to rename this file to application-ldap.yml to make it effective
spring:
ldap:
base: "dc=example,dc=com"
username: "admin" # 配置管理员账号,用于搜索、匹配用户
password: "password"
searchFilter: "(sAMAccountName={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户
urls:
- "ldap://1.1.1.1:389"

ldap:
mapping: # 配置 ldap 属性
objectClass: "user" # ldap 用户 objectClass 配置
loginId: "sAMAccountName" # ldap 用户惟一 id,用来作为登录的 id
userDisplayName: "cn" # ldap 用户名,用来作为显示名
email: "userPrincipalName" # ldap 邮箱属性
filter: # 可选项,配置过滤,目前只支持 memberOf
memberOf: "CN=ServiceDEV,OU=test,DC=example,DC=com|CN=WebDEV,OU=test,DC=example,DC=com" # 只允许 memberOf 属性为 ServiceDEV 和 WebDEV 的用户访问
@@ -1,3 +1,4 @@
# ldap sample for apache ds, need to rename this file to application-ldap.yml to make it effective
spring:
ldap:
base: "dc=example,dc=com"
Expand All @@ -11,11 +12,11 @@ ldap:
mapping: # 配置 ldap 属性
objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置
loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id
rdnKey: "cn" # ldap rdn key
rdnKey: "cn" # ldap rdn key,可选项,如需启用group search需要配置
userDisplayName: "displayName" # ldap 用户名,用来作为显示名
email: "mail" # ldap 邮箱属性
group: # 配置ldap group
group: # 配置ldap group,可选配置,启用后只有特定group的用户可以登录apollo
objectClass: "groupOfNames" # 配置groupClassName
groupBase: "ou=group" # group search base
groupSearch: "(&(cn=apollo-admins)(&(member=*)))" # group filter
groupMembership: "member" # group memberShip eg. member or memberUid
groupSearch: "(&(cn=dev))" # group filter
groupMembership: "member" # group memberShip eg. member or memberUid
20 changes: 11 additions & 9 deletions apollo-portal/src/main/config/application-ldap-openldap-sample.yml
@@ -1,20 +1,22 @@
# ldap sample for open ldap, need to rename this file to application-ldap.yml to make it effective
spring:
ldap:
base: "dc=example,dc=com"
username: "cn=Manager,dc=example,dc=com" # 配置管理员账号,用于搜索、匹配用户
base: "dc=example,dc=org"
username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户
password: "password"
searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户
searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户
urls:
- "ldap://localhost:389"

ldap:
mapping: # 配置 ldap 属性
objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置
loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id
rdnKey: "uid" # ldap rdn key
userDisplayName: "displayName" # ldap 用户名,用来作为显示名
rdnKey: "uid" # ldap rdn key,可选项,如需启用group search需要配置
userDisplayName: "cn" # ldap 用户名,用来作为显示名
email: "mail" # ldap 邮箱属性
group: # 配置ldap group
groupBase: "ou=Group" # group search base
groupSearch: "(&(cn=apollo-admins))" # group filter
groupMembership: "memberUid" # group memberShip
group: # 启用group search,可选配置,启用后只有特定group的用户可以登录apollo
objectClass: "posixGroup" # 配置groupClassName
groupBase: "ou=group" # group search base
groupSearch: "(&(cn=dev))" # group filter
groupMembership: "memberUid" # group memberShip eg. member or memberUid
Expand Up @@ -48,7 +48,6 @@ public ConfigsExportController(
@PostMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/items/import")
public void importConfigFile(@PathVariable String appId, @PathVariable String env,
@PathVariable String clusterName, @PathVariable String namespaceName,
@RequestParam Integer namespaceId,
@RequestParam("file") MultipartFile file) {
if (file.isEmpty()) {
throw new BadRequestException("The file is empty.");
Expand All @@ -73,7 +72,7 @@ public void importConfigFile(@PathVariable String appId, @PathVariable String en
model.setEnv(env);
model.setClusterName(clusterName);
model.setNamespaceName(namespaceName);
model.setNamespaceId(namespaceId);
model.setNamespaceId(namespaceDTO.getId());
String configText;
try(InputStream in = file.getInputStream()){
configText = ConfigToFileUtils.fileToString(in);
Expand Down
Expand Up @@ -11,7 +11,7 @@ public class NamespaceTextModel implements Verifiable {
private String env;
private String clusterName;
private String namespaceName;
private int namespaceId;
private long namespaceId;
private String format;
private String configText;

Expand All @@ -30,7 +30,7 @@ public void setAppId(String appId) {
}

public Env getEnv() {
return Env.valueOf(env);
return Env.fromString(env);
}

public void setEnv(String env) {
Expand All @@ -53,11 +53,11 @@ public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}

public int getNamespaceId() {
public long getNamespaceId() {
return namespaceId;
}

public void setNamespaceId(int namespaceId) {
public void setNamespaceId(long namespaceId) {
this.namespaceId = namespaceId;
}

Expand Down
5 changes: 5 additions & 0 deletions apollo-portal/src/main/resources/application.yml
Expand Up @@ -3,6 +3,11 @@ spring:
name: apollo-portal
profiles:
active: ${apollo_profile}
jpa:
properties:
hibernate:
query:
plan_cache_max_size: 192 # limit query plan cache max size

server:
port: 8070
Expand Down
2 changes: 1 addition & 1 deletion apollo-portal/src/main/resources/static/namespace.html
Expand Up @@ -58,7 +58,7 @@
通过创建一个私有的Namespace可以实现分组管理配置
</li>
<li>私有Namespace的格式可以是xml、yml、yaml、json. 您可以通过apollo-client中ConfigFile接口来获取非properties格式Namespace的内容</li>
<li>1.3.0及以上版本的apollo-client针对yaml/yml提供了更好的支持,可以通过ConfigService.getConfig("someNamespace.yaml")直接获取Config对象,也可以通过@EnableApolloConfig("someNamespace.yaml")注入yaml配置到Spring中去</li>
<li>1.3.0及以上版本的apollo-client针对yaml/yml提供了更好的支持,可以通过ConfigService.getConfig("someNamespace.yml")直接获取Config对象,也可以通过@EnableApolloConfig("someNamespace.yml")或apollo.bootstrap.namespaces=someNamespace.yml注入yml配置到Spring/Spring Boot中去</li>
</ul>
</div>
<div class="row text-right" style="padding-right: 20px;">
Expand Down
2 changes: 1 addition & 1 deletion scripts/db/migration/flyway-configdb.properties
@@ -1,5 +1,5 @@
flyway.user=root
flyway.password=root
flyway.schemas=ApolloConfigDB
flyway.url=jdbc:mysql://localhost:3306
flyway.url=jdbc:mysql://localhost:3306?useSSL=false&characterEncoding=utf8
flyway.locations=filesystem:scripts/db/migration/configdb
2 changes: 1 addition & 1 deletion scripts/db/migration/flyway-portaldb.properties
@@ -1,5 +1,5 @@
flyway.user=root
flyway.password=root
flyway.schemas=ApolloPortalDB
flyway.url=jdbc:mysql://localhost:3306
flyway.url=jdbc:mysql://localhost:3306?useSSL=false&characterEncoding=utf8
flyway.locations=filesystem:scripts/db/migration/portaldb

0 comments on commit 81a1bce

Please sign in to comment.