Skip to content

Commit 0f86b52

Browse files
committed
deploy scripts
1 parent 38d5dd2 commit 0f86b52

8 files changed

+557
-1
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM tomcat
2-
ADD target/addressbook.war /usr/local/tomcat/webapps
2+
ADD target/sampleapp.war /usr/local/tomcat/webapps
33
EXPOSE 8080
44
CMD /usr/local/tomcat/bin/catalina.sh run

deploy/ansible.cfg

+490
Large diffs are not rendered by default.

deploy/deploy.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- hosts: "{{ env }}"
2+
become: yes
3+
tasks:
4+
- name: remove any previous app services
5+
shell: |
6+
if [ `docker service ls | grep -v NAME | grep mysvc | awk '{print $2}' | wc -l` -gt 0 ]; then
7+
docker service rm `docker service ls | grep -v NAME | grep mysvc | awk '{print $2}'`
8+
else
9+
echo "No Service found"
10+
fi
11+
- name: deploy app
12+
command: docker service create --name mysvc --replicas 4 -p 9080:8080 lerndevops/addressbook:{{ build }}

deploy/inv

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[qa]
2+
ip1
3+
ip2
4+
5+
[prod]
6+
ip1
7+
ip2
8+
9+
[qa:vars]
10+
ansible_user=devops
11+
ansible_ssh_pass=devops
12+
ansible_sudo_pass=devops
13+
14+
[prod:vars]
15+
ansible_user=devops
16+
ansible_ssh_pass=devops
17+
ansible_sudo_pass=devops
18+

deploy/sampleapp-deploy-k8s.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: addressbook
5+
labels:
6+
app: addressbookapp
7+
spec:
8+
replicas: 2
9+
selector:
10+
matchLabels:
11+
app: addressbookapp
12+
template:
13+
metadata:
14+
labels:
15+
app: addressbookapp
16+
spec:
17+
containers:
18+
- name: addressbookapp
19+
image: lerndevops/addressbook
20+
ports:
21+
- containerPort: 8080
22+
23+
---
24+
25+
kind: Service
26+
apiVersion: v1
27+
metadata:
28+
name: addressbookapp-svc
29+
spec:
30+
type: NodePort
31+
selector:
32+
app: addressbookapp
33+
ports:
34+
- protocol: TCP
35+
port: 8080
36+
nodePort: 30002

Jenkinsfilek8s jenkinsfile-k8s

File renamed without changes.
File renamed without changes.

Jenkinsfile-win jenkinsfile-win

File renamed without changes.

0 commit comments

Comments
 (0)