forked from pcdavies/TwitterFeed
-
Notifications
You must be signed in to change notification settings - Fork 749
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
1 parent
93648b7
commit d038596
Showing
4 changed files
with
181 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: twitter-feed | ||
labels: | ||
commit: ${WERCKER_GIT_COMMIT} | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: twitter-feed | ||
template: | ||
metadata: | ||
labels: | ||
app: twitter-feed | ||
commit: ${WERCKER_GIT_COMMIT} | ||
color: blue | ||
spec: | ||
containers: | ||
- name: twitter-feed | ||
image: ${DOCKER_REPO}:${WERCKER_GIT_BRANCH}-${WERCKER_GIT_COMMIT} | ||
imagePullPolicy: Always | ||
ports: | ||
- name: twitter-feed | ||
containerPort: 8080 | ||
protocol: TCP | ||
volumeMounts: | ||
- name: podinfo | ||
mountPath: /tmp | ||
readOnly: false | ||
volumes: | ||
- name: podinfo | ||
downwardAPI: | ||
items: | ||
- path: "labels" | ||
fieldRef: | ||
fieldPath: metadata.labels | ||
imagePullSecrets: | ||
- name: wercker | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: twitter-feed | ||
labels: | ||
app: twitter-feed | ||
commit: ${WERCKER_GIT_COMMIT} | ||
spec: | ||
ports: | ||
- port: 30000 | ||
targetPort: 8080 | ||
selector: | ||
app: twitter-feed | ||
color: green | ||
type: ClusterIP | ||
--- |
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,56 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: twitter-feed-v2 | ||
labels: | ||
commit: 9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0 | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: twitter-feed | ||
template: | ||
metadata: | ||
labels: | ||
app: twitter-feed | ||
commit: 9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0 | ||
color: green | ||
spec: | ||
containers: | ||
- name: twitter-feed | ||
image: wcr.io/derekoneil/twitter-feed:master-9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0 | ||
imagePullPolicy: Always | ||
ports: | ||
- name: twitter-feed | ||
containerPort: 8080 | ||
protocol: TCP | ||
volumeMounts: | ||
- name: podinfo | ||
mountPath: /tmp | ||
readOnly: false | ||
volumes: | ||
- name: podinfo | ||
downwardAPI: | ||
items: | ||
- path: "labels" | ||
fieldRef: | ||
fieldPath: metadata.labels | ||
imagePullSecrets: | ||
- name: wercker | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: twitter-feed | ||
labels: | ||
app: twitter-feed | ||
commit: 9a8fa77277c4a8c3c96d96d4b804e83c26ac6cc0 | ||
spec: | ||
ports: | ||
- port: 30000 | ||
targetPort: 8080 | ||
selector: | ||
app: twitter-feed | ||
color: green | ||
type: ClusterIP | ||
--- |
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,65 @@ | ||
#Use OpenJDK base docker image from dockerhub and open the application port on the docker container | ||
box: | ||
id: openjdk | ||
ports: | ||
- 8080 | ||
|
||
#Build our application using Maven, just as we always have | ||
build: | ||
steps: | ||
- install-packages: | ||
packages: maven | ||
- script: | ||
name: maven build | ||
code: mvn clean assembly:assembly | ||
|
||
#Push the docker image with our built and tested application to the Oracle Container Registry | ||
push-release: | ||
steps: | ||
- internal/docker-push: | ||
tag: $WERCKER_GIT_BRANCH-$WERCKER_GIT_COMMIT | ||
working-dir: /pipeline/source | ||
ports: 8080 | ||
cmd: sh target/bin/start | ||
#Inject our Wercker application token into Kubernetes to authenticate container pulls | ||
#delete any existing Wercker secret before creating, to accommodate secret changes | ||
inject-secret: | ||
box: | ||
id: alpine | ||
cmd: /bin/sh | ||
steps: | ||
|
||
- kubectl: | ||
name: delete secret | ||
server: $KUBERNETES_MASTER | ||
token: $KUBERNETES_TOKEN | ||
insecure-skip-tls-verify: true | ||
command: delete secret wercker; echo delete registry secret | ||
|
||
- kubectl: | ||
name: create secret | ||
server: $KUBERNETES_MASTER | ||
token: $KUBERNETES_TOKEN | ||
insecure-skip-tls-verify: true | ||
command: create secret docker-registry wercker --docker-server=$DOCKER_REGISTRY --docker-username=$DOCKER_USERNAME --docker-password=$KUBERNETES_TOKEN --docker-email=$DOCKER_EMAIL; echo create registry secret | ||
|
||
#Deploy our container from the Oracle Container Registry to the Oracle Container Engine (Kubernetes) | ||
deploy-to-cluster: | ||
box: | ||
id: alpine | ||
cmd: /bin/sh | ||
steps: | ||
|
||
- bash-template | ||
|
||
- script: | ||
name: "Visualise Kubernetes config" | ||
code: cat kubernetes.yml | ||
|
||
- kubectl: | ||
name: deploy to kubernetes | ||
server: $KUBERNETES_MASTER | ||
#username: $KUBERNETES_USERNAME | ||
token: $KUBERNETES_TOKEN | ||
insecure-skip-tls-verify: true | ||
command: apply -f kubernetes.yml |