-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
327 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/target/ | ||
/bin/ | ||
/.settings/ | ||
*# | ||
*.iml | ||
*.ipr | ||
*.iws | ||
*.jar | ||
*.sw? | ||
*~ | ||
.#* | ||
.*.md.html | ||
.DS_Store | ||
.classpath | ||
.factorypath | ||
.gradle | ||
.idea | ||
.metadata | ||
.project | ||
.recommenders | ||
.settings | ||
.springBeans | ||
/build | ||
/code | ||
MANIFEST.MF | ||
_site/ | ||
activemq-data | ||
bin | ||
build | ||
build.log | ||
dependency-reduced-pom.xml | ||
dump.rdb | ||
interpolated*.xml | ||
lib/ | ||
manifest.yml | ||
overridedb.* | ||
settings.xml | ||
target | ||
transaction-logs | ||
.flattened-pom.xml | ||
secrets.yml | ||
.gradletasknamecache | ||
.sts4-cache | ||
node_modules | ||
.dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM openjdk:8u212-jdk-alpine | ||
COPY target/*SNAPSHOT.jar app.jar | ||
EXPOSE 8080 | ||
ENV TZ=Asia/Seoul | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
ENTRYPOINT ["java","-Xmx400M","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar","--spring.profiles.active=docker"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
steps: | ||
- id: 'build' | ||
name: 'gcr.io/cloud-builders/mvn' | ||
args: [ | ||
'clean', | ||
'package', | ||
'-Dmaven.test.skip=true' | ||
] | ||
### Build | ||
- id: 'docker build' | ||
name: 'gcr.io/cloud-builders/docker' | ||
entrypoint: 'bash' | ||
args: | ||
- '-c' | ||
- | | ||
echo '$COMMIT_SHA =' $COMMIT_SHA | ||
docker build -t gcr.io/$PROJECT_ID/$_PROJECT_NAME:$COMMIT_SHA . | ||
### Test | ||
### Publish | ||
- id: 'publish' | ||
name: 'gcr.io/cloud-builders/docker' | ||
entrypoint: 'bash' | ||
args: | ||
- '-c' | ||
- | | ||
docker push gcr.io/$PROJECT_ID/$_PROJECT_NAME:$COMMIT_SHA | ||
### deploy | ||
- id: 'deploy' | ||
name: 'gcr.io/cloud-builders/gcloud' | ||
entrypoint: 'bash' | ||
args: | ||
- '-c' | ||
- | | ||
PROJECT=$$(gcloud config get-value core/project) | ||
gcloud container clusters get-credentials "$${CLOUDSDK_CONTAINER_CLUSTER}" \ | ||
--project "$${PROJECT}" \ | ||
--zone "$${CLOUDSDK_COMPUTE_ZONE}" | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: $_PROJECT_NAME | ||
labels: | ||
app: $_PROJECT_NAME | ||
spec: | ||
ports: | ||
- port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app: $_PROJECT_NAME | ||
type: | ||
LoadBalancer | ||
EOF | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: $_PROJECT_NAME | ||
labels: | ||
app: $_PROJECT_NAME | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: $_PROJECT_NAME | ||
template: | ||
metadata: | ||
labels: | ||
app: $_PROJECT_NAME | ||
spec: | ||
containers: | ||
- name: $_PROJECT_NAME | ||
image: gcr.io/$PROJECT_ID/$_PROJECT_NAME:$COMMIT_SHA | ||
ports: | ||
- containerPort: 8080 | ||
EOF | ||
substitutions: | ||
_PROJECT_NAME: gateway | ||
options: | ||
env: | ||
# # location/name of GKE cluster (used by all kubectl commands) | ||
- CLOUDSDK_COMPUTE_ZONE=asia-northeast1-a | ||
- CLOUDSDK_CONTAINER_CLUSTER=standard-cluster-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: gateway | ||
labels: | ||
app: gateway | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: gateway | ||
template: | ||
metadata: | ||
labels: | ||
app: gateway | ||
spec: | ||
containers: | ||
- name: gateway | ||
image: username/gateway:latest | ||
ports: | ||
- containerPort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: gateway | ||
labels: | ||
app: gateway | ||
spec: | ||
ports: | ||
- port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app: gateway | ||
type: LoadBalancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.1.1.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>com.example</groupId> | ||
<artifactId>boot-camp-gateway</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>boot-camp-gateway</name> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
<spring-cloud.version>Greenwich.SR2</spring-cloud.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Add Stackdriver Trace Starter --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-gateway</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring-cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package fisherp; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
|
||
public static ApplicationContext applicationContext; | ||
|
||
public static void main(String[] args) { | ||
applicationContext = SpringApplication.run(Application.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
server: | ||
port: 8088 | ||
|
||
--- | ||
|
||
spring: | ||
profiles: default | ||
cloud: | ||
gateway: | ||
#<<< API Gateway / Routes | ||
routes: | ||
- id: tunneling | ||
uri: http://localhost:8080 | ||
predicates: | ||
- Path=/api/**, /apis/** | ||
- id: frontend | ||
uri: http://localhost:8081 | ||
predicates: | ||
- Path=/** | ||
#>>> API Gateway / Routes | ||
globalcors: | ||
corsConfigurations: | ||
'[/**]': | ||
allowedOrigins: | ||
- "*" | ||
allowedMethods: | ||
- "*" | ||
allowedHeaders: | ||
- "*" | ||
allowCredentials: true | ||
|
||
|
||
--- | ||
|
||
spring: | ||
profiles: docker | ||
cloud: | ||
gateway: | ||
routes: | ||
- id: tunneling | ||
uri: http://localhost:8080 | ||
predicates: | ||
- Path=/api/**, /apis/** | ||
- id: frontend | ||
uri: http://localhost:8081 | ||
predicates: | ||
- Path=/** | ||
globalcors: | ||
corsConfigurations: | ||
'[/**]': | ||
allowedOrigins: | ||
- "*" | ||
allowedMethods: | ||
- "*" | ||
allowedHeaders: | ||
- "*" | ||
allowCredentials: true | ||
|
||
server: | ||
port: 8080 |
Submodule kubeez-tunneling
added at
e5dd74
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters