Skip to content

Commit

Permalink
Initial upload from an internal fork. Contains contributions by:
Browse files Browse the repository at this point in the history
Mark Nuttall
David Currie
Ut Le
Adam Yoho
Bruce Tiffany
Jon Hawkes
Akihiko Kuroda
Jagadeeswar Gangaraju
Tom Evans
  • Loading branch information
mnuttall committed Mar 16, 2017
1 parent 61633ed commit 543149d
Show file tree
Hide file tree
Showing 22 changed files with 978 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/**
.kube
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM websphere-liberty:microProfile
RUN installUtility install --acceptLicense logstashCollector-1.0
COPY server.xml /config/server.xml
COPY target/microservice-schedule-1.0.0-SNAPSHOT.war /config/apps/schedule.war
21 changes: 21 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!groovy

node('master') {

// A collection of build utils.
def utils = load "/scripts/buildUtils.groovy"

stage ('Extract') {
checkout scm
}

stage ('Build') {
utils.mavenBuild ('clean', 'package')
utils.dockerBuild ('microservice-schedule')
}

stage ('Deploy') {
utils.deploy ()
}

}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# sample.microservicebuilder.schedule
# Microservice Builder Sample - Schedule microservice

See the [sample documentation](/wasdev/sample.microservicebuilder.docs) for more information.
71 changes: 71 additions & 0 deletions manifests-secure/deploy-schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: microservice-schedule-sample
spec:
replicas: 1
template:
metadata:
labels:
name: schedule-deployment
spec:
containers:
- name: microservice-schedule
image: microservice-schedule:latest
env:
- name: EXTERNAL_IP_ADDR
valueFrom:
configMapKeyRef:
name: ipaddr-config
key: EXTERNAL_IP_ADDR
ports:
- containerPort: 9080
imagePullPolicy: Never
volumeMounts:
- name: keystore
mountPath: /etc/wlp/config/keystore
- name: truststore
mountPath: /etc/wlp/config/truststore
- name: liberty-config
mountPath: /config/configDropins
imagePullPolicy: Never
volumes:
- name: keystore
secret:
secretName: wlp-keystore
- name: truststore
secret:
secretName: wlp-truststore
- name: liberty-config
configMap:
name: liberty-config
items:
- key: keystore.xml
path: defaults/keystore.xml
- key: logging.xml
path: defaults/logging.xml
---
apiVersion: v1
kind: Service
metadata:
name: schedule-service
namespace: default
spec:
ports:
- port: 9080
selector:
name: schedule-deployment
---
apiVersion: v1
kind: Service
metadata:
name: schedule-service-nodeport
namespace: default
spec:
type: NodePort
ports:
- port: 9443
nodePort: 31015

selector:
name: schedule-deployment
15 changes: 15 additions & 0 deletions manifests-secure/schedule-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/rewrite-target: /schedule
name: schedule-ingress
spec:
rules:
- host:
http:
paths:
- path: /schedule
backend:
serviceName: schedule-service
servicePort: 9080
61 changes: 61 additions & 0 deletions manifests/deploy-schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: microservice-schedule-sample
spec:
replicas: 1
template:
metadata:
labels:
name: schedule-deployment
spec:
containers:
- name: microservice-schedule
image: microservice-schedule:latest
# env:
# - name: EXTERNAL_IP_ADDR
# valueFrom:
# configMapKeyRef:
# name: ipaddr-config
# key: EXTERNAL_IP_ADDR
ports:
- containerPort: 9080
imagePullPolicy: Never
volumeMounts:
- name: keystore
mountPath: /etc/wlp/config/keystore
- name: truststore
mountPath: /etc/wlp/config/truststore
- name: liberty-config
mountPath: /config/configDropins
imagePullPolicy: Never
readinessProbe:
httpGet:
path: /schedule/nessProbe
port: 9080
volumes:
- name: keystore
secret:
secretName: wlp-keystore
- name: truststore
secret:
secretName: wlp-truststore
- name: liberty-config
configMap:
name: liberty-config
items:
- key: keystore.xml
path: defaults/keystore.xml
- key: logging.xml
path: defaults/logging.xml
---
apiVersion: v1
kind: Service
metadata:
name: schedule-service
namespace: default
spec:
ports:
- port: 9080
selector:
name: schedule-deployment
15 changes: 15 additions & 0 deletions manifests/schedule-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/rewrite-target: /schedule
name: schedule-ingress
spec:
rules:
- host:
http:
paths:
- path: /schedule
backend:
serviceName: schedule-service
servicePort: 9080
115 changes: 115 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Microprofile.io
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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>

<groupId>sample.microservicebuilder</groupId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>microservice-schedule</artifactId>
<packaging>war</packaging>
<name>Conference :: Schedule</name>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<docker.file.dir>artifacts</docker.file.dir>
<webxml.path></webxml.path>
</properties>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webXml>${webxml.path}</webXml>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>pom.xml</packagingExcludes>
</configuration>
</plugin>

<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>microservice-schedule</name>
<build>
<dockerFileDir>${docker.file.dir}</dockerFileDir>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>


<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
<version>7.0</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.github.wasdev.microprofile-conference</groupId>
<artifactId>demo-bootstrap</artifactId>
<version>1.0.0</version>
</dependency>

<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>microprofile</artifactId>
<scope>provided</scope>
<version>2016.10.0</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>security</id>
<properties>
<docker.file.dir>artifactsSecured</docker.file.dir>
<webxml.path>src/main/liberty/webapp-security/web.xml</webxml.path>
</properties>
</profile>
</profiles>
</project>
15 changes: 15 additions & 0 deletions server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<server description="microservice-schedule">

<!-- Enable features -->
<featureManager>
<feature>microProfile-1.0</feature>
</featureManager>

<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />

<webApplication location="schedule.war" contextRoot="/"/>

</server>
4 changes: 4 additions & 0 deletions src/main/docker/artifactsSecured/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM websphere-liberty:microProfile
RUN installUtility install --acceptLicense logstashCollector-1.0 openidConnectClient-1.0 jsp-2.3 ssl-1.0 appSecurity-2.0
COPY server.xml /config/server.xml
COPY maven/microservice-schedule-1.0.0-SNAPSHOT.war /config/apps/schedule.war
46 changes: 46 additions & 0 deletions src/main/docker/artifactsSecured/server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<server description="microservice-schedule">

<!-- Enable features -->
<featureManager>
<feature>ssl-1.0</feature>
<feature>appSecurity-2.0</feature>
<feature>microProfile-1.0</feature>
<feature>jsp-2.3</feature>
<feature>openidConnectClient-1.0</feature>
</featureManager>

<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />

<oidcClientWebapp contextPath="/oidcclient" />
<openidConnectClient id="rp" signatureAlgorithm="RS256" inboundPropagation="supported"
scope="openid profile email"
redirectToRPHostAndPort="https://${env.EXTERNAL_IP_ADDR}:31015"
httpsRequired="false"
clientId="rp"
clientSecret="rpSecret"
sharedKey="rpSecret"
issuerIdentifier="https://trustme"
authorizationEndpointUrl="https://${env.EXTERNAL_IP_ADDR}:31005/oidc/endpoint/OP/authorize"
tokenEndpointUrl="https://${env.EXTERNAL_IP_ADDR}:31005/oidc/endpoint/OP/token"
jwkEndpointUrl="https://${env.EXTERNAL_IP_ADDR}:31005/oidc/endpoint/OP/jwk"
audiences="abc123"
>
</openidConnectClient>

<!--
<logging traceSpecification="com.ibm.ws.security.oauth*=all:com.ibm.ws.security.openid*=all"
traceFileName="trace.log" maxFileSize="50" maxFiles="10" />
-->

<webApplication location="schedule.war" contextRoot="/">
<application-bnd>
<security-role name="ScheduleRole"> <!-- matches web.xml -->
<special-subject type="ALL_AUTHENTICATED_USERS" />
</security-role>
</application-bnd>
</webApplication>

</server>
Loading

0 comments on commit 543149d

Please sign in to comment.