Skip to content

Commit 5c925a3

Browse files
author
jkwong888
committed
add chart, bump version
1 parent e233f3c commit 5c925a3

File tree

13 files changed

+297
-126
lines changed

13 files changed

+297
-126
lines changed

build.gradle

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
buildscript {
22
ext {
3-
springBootVersion = '1.4.0.RELEASE'
3+
springBootVersion = '1.5.7.RELEASE'
44
}
55
repositories {
66
mavenCentral()
7+
maven {
8+
url 'https://plugins.gradle.org/m2/'
9+
}
10+
jcenter()
711
}
812
dependencies {
913
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
14+
classpath 'gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.13.0'
1015
}
1116
}
1217

1318
apply plugin: 'java'
1419
apply plugin: 'eclipse'
15-
apply plugin: 'spring-boot'
20+
apply plugin: 'org.springframework.boot'
21+
apply plugin: 'com.palantir.docker'
1622

1723
jar {
1824
baseName = 'config-server'
@@ -28,8 +34,7 @@ targetCompatibility = 1.8
2834

2935
dependencyManagement {
3036
imports {
31-
mavenBom 'org.springframework.cloud:spring-cloud-starter-config:1.2.0.RELEASE'
32-
mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.SR5"
37+
mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Dalston.SR1"
3338
}
3439
}
3540

@@ -45,3 +50,14 @@ eclipse {
4550
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
4651
}
4752
}
53+
54+
docker {
55+
name "jkwong/${jar.baseName}:latest"
56+
copySpec.into("/")
57+
.include("**/${jar.baseName}-${jar.version}.jar")
58+
.from("build/libs")
59+
.rename("${jar.baseName}-${jar.version}.jar", "app.jar")
60+
files "app.jar"
61+
dockerfile file ('src/main/docker/Dockerfile')
62+
}
63+

chart/springconfigserver/Chart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
description: Spring Config Server
3+
name: springconfigserver
4+
version: 1.0.0
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Release.Name }}-{{ .Chart.Name }}-bootstrap
5+
labels:
6+
component: config-server-bootstrap
7+
data:
8+
bootstrap.yaml: |+
9+
spring:
10+
rabbitmq:
11+
addresses: {{ .Values.rabbitmq.url }}
12+
host: {{ .Values.rabbitmq.host }}
13+
port: {{ .Values.rabbitmq.port }}
14+
username: {{ .Values.rabbitmq.username }}
15+
password: {{ .Values.rabbitmq.password }}
16+
virtual-host: {{ .Values.rabbitmq.virtualHost }}
17+
ssl:
18+
enabled: {{ .Values.rabbitmq.sslEnabled }}
19+
cloud:
20+
config:
21+
uri: http://{{ .Values.service.name }}:{{ .Values.service.port }}
22+
{{ if .Values.bootstrap.values }}
23+
{{- toYaml .Values.bootstrap.values | indent 4 }}
24+
{{ end }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Release.Name }}-{{ .Chart.Name }}-config-server
5+
labels:
6+
component: config-server
7+
data:
8+
bootstrap.yaml: |+
9+
server:
10+
port: {{ .Values.service.internalPort }}
11+
application:
12+
name: spring-config-server
13+
14+
application.yaml: |+
15+
spring:
16+
rabbitmq:
17+
addresses: {{ .Values.rabbitmq.url }}
18+
host: {{ .Values.rabbitmq.host }}
19+
port: {{ .Values.rabbitmq.port }}
20+
username: {{ .Values.rabbitmq.username }}
21+
password: {{ .Values.rabbitmq.password }}
22+
virtual-host: {{ .Values.rabbitmq.virtualHost }}
23+
ssl:
24+
enabled: {{ .Values.rabbitmq.sslEnabled }}
25+
cloud:
26+
config:
27+
server:
28+
git:
29+
uri: {{ .Values.git.uri }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Release.Name }}-{{ .Chart.Name }}-config-server
5+
labels:
6+
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
7+
component: config-server
8+
spec:
9+
replicas: {{ .Values.replicaCount }}
10+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
11+
template:
12+
metadata:
13+
labels:
14+
component: config-server
15+
spec:
16+
containers:
17+
- name: config-server
18+
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
19+
imagePullPolicy: {{ .Values.image.pullPolicy }}
20+
readinessProbe:
21+
httpGet:
22+
path: /health
23+
port: {{ .Values.service.internalPort }}
24+
initialDelaySeconds: 20
25+
volumeMounts:
26+
- mountPath: /config
27+
name: config-server-data
28+
env:
29+
- name: ENCRYPT_KEY
30+
valueFrom:
31+
secretKeyRef:
32+
name: {{ .Release.Name }}-{{ .Chart.Name }}-config-server
33+
key: encrypt.key
34+
volumes:
35+
- name: config-server-data
36+
configMap:
37+
name: {{ .Release.Name }}-{{ .Chart.Name }}-config-server
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ .Release.Name }}-{{ .Chart.Name }}-config-server
5+
labels:
6+
component: config-server
7+
type: Opaque
8+
data:
9+
encrypt.key: {{ .Values.encryption.key | b64enc }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ .Values.service.name }}
5+
labels:
6+
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- name: http
11+
port: {{ .Values.service.port }}
12+
selector:
13+
component: config-server

chart/springconfigserver/values.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This is a YAML-formatted file.
2+
# Declare variables to be passed into your templates.
3+
replicaCount: 1
4+
revisionHistoryLimit: 1
5+
6+
image:
7+
repository: jkwong/spring-config-server
8+
tag: latest
9+
pullPolicy: Always
10+
11+
service:
12+
name: config-server
13+
type: ClusterIP
14+
port: 8888
15+
internalPort: 8888
16+
17+
rabbitmq:
18+
url:
19+
host:
20+
port:
21+
username:
22+
password:
23+
virtualHost:
24+
sslEnabled:
25+
26+
git:
27+
uri:
28+
29+
encryption:
30+
key: 8YiY6ypoTgoLrdyPa1dgijUNfeyWcGTEjESSUuF6o9gKA1ZdgPJj5BUpOQrf7qkK
31+
32+
bootstrap:
33+
values: ''

gradle/wrapper/gradle-wrapper.jar

1.04 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jan 22 12:51:41 CST 2016
1+
#Thu Sep 21 16:07:20 EDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-bin.zip

gradlew

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
##############################################################################
44
##
55
## Gradle start up script for UN*X
66
##
77
##############################################################################
88

9-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10-
DEFAULT_JVM_OPTS=""
9+
# Attempt to set APP_HOME
10+
# Resolve links: $0 may be a link
11+
PRG="$0"
12+
# Need this for relative symlinks.
13+
while [ -h "$PRG" ] ; do
14+
ls=`ls -ld "$PRG"`
15+
link=`expr "$ls" : '.*-> \(.*\)$'`
16+
if expr "$link" : '/.*' > /dev/null; then
17+
PRG="$link"
18+
else
19+
PRG=`dirname "$PRG"`"/$link"
20+
fi
21+
done
22+
SAVED="`pwd`"
23+
cd "`dirname \"$PRG\"`/" >/dev/null
24+
APP_HOME="`pwd -P`"
25+
cd "$SAVED" >/dev/null
1126

1227
APP_NAME="Gradle"
1328
APP_BASE_NAME=`basename "$0"`
1429

30+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31+
DEFAULT_JVM_OPTS=""
32+
1533
# Use the maximum available, or set MAX_FD != -1 to use that value.
1634
MAX_FD="maximum"
1735

18-
warn ( ) {
36+
warn () {
1937
echo "$*"
2038
}
2139

22-
die ( ) {
40+
die () {
2341
echo
2442
echo "$*"
2543
echo
@@ -30,6 +48,7 @@ die ( ) {
3048
cygwin=false
3149
msys=false
3250
darwin=false
51+
nonstop=false
3352
case "`uname`" in
3453
CYGWIN* )
3554
cygwin=true
@@ -40,26 +59,11 @@ case "`uname`" in
4059
MINGW* )
4160
msys=true
4261
;;
62+
NONSTOP* )
63+
nonstop=true
64+
;;
4365
esac
4466

45-
# Attempt to set APP_HOME
46-
# Resolve links: $0 may be a link
47-
PRG="$0"
48-
# Need this for relative symlinks.
49-
while [ -h "$PRG" ] ; do
50-
ls=`ls -ld "$PRG"`
51-
link=`expr "$ls" : '.*-> \(.*\)$'`
52-
if expr "$link" : '/.*' > /dev/null; then
53-
PRG="$link"
54-
else
55-
PRG=`dirname "$PRG"`"/$link"
56-
fi
57-
done
58-
SAVED="`pwd`"
59-
cd "`dirname \"$PRG\"`/" >/dev/null
60-
APP_HOME="`pwd -P`"
61-
cd "$SAVED" >/dev/null
62-
6367
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6468

6569
# Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@ location of your Java installation."
8589
fi
8690

8791
# Increase the maximum file descriptors if we can.
88-
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
92+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
8993
MAX_FD_LIMIT=`ulimit -H -n`
9094
if [ $? -eq 0 ] ; then
9195
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@ if $cygwin ; then
150154
esac
151155
fi
152156

153-
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154-
function splitJvmOpts() {
155-
JVM_OPTS=("$@")
157+
# Escape application args
158+
save () {
159+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160+
echo " "
156161
}
157-
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158-
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
162+
APP_ARGS=$(save "$@")
163+
164+
# Collect all arguments for the java command, following the shell quoting and substitution rules
165+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166+
167+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169+
cd "$(dirname "$0")"
170+
fi
159171

160-
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172+
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)