Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0c6ea65
added packaging script
huseyin-yigit Oct 10, 2020
77a41c1
added Dcokerfile for microservices
huseyin-yigit Oct 10, 2020
bc1a249
added script for building docker images
huseyin-yigit Oct 11, 2020
9ca2240
added script for building docker images
huseyin-yigit Oct 11, 2020
e543f71
added docker compose file and script for local deployment
huseyin-yigit Oct 11, 2020
19f98c1
added docker compose file and script for local deployment
huseyin-yigit Oct 11, 2020
ddd1184
added cloudformation template for dec server
huseyin-yigit Oct 13, 2020
1931611
added cloudformation template for dev server
huseyin-yigit Oct 13, 2020
209f2ba
updated image id
huseyin-yigit Oct 13, 2020
cb31b78
test java
huseyin-yigit Oct 14, 2020
d63d4dc
updated POM with Jacoco plugin
huseyin-yigit Oct 14, 2020
c49a725
updated pettest.java
huseyin-yigit Oct 15, 2020
6fcf210
updated pettest.java
huseyin-yigit Oct 15, 2020
e2e80c5
updated cfn template
huseyin-yigit Oct 15, 2020
d2e2636
added selenium jobs written in python
huseyin-yigit Oct 15, 2020
b2088db
added jenkins server cfn template
huseyin-yigit Oct 16, 2020
7687d07
added updated pettestjava
huseyin-yigit Oct 16, 2020
0e52b3f
added updated pettestjava
huseyin-yigit Oct 17, 2020
a0c20d3
update petjavatest
huseyin-yigit Oct 17, 2020
13fd47e
added script for petclinic ci-job.sh
huseyin-yigit Oct 17, 2020
a1a9dae
Merge branch 'feature/msp-13' into dev
huseyin-yigit Oct 17, 2020
afba01c
update file
huseyin-yigit Oct 17, 2020
cf85278
added script for creating ECR registry for dev
huseyin-yigit Oct 17, 2020
241bc76
added cloudformation template for Docker Swarm infrastructure
huseyin-yigit Oct 17, 2020
78f8843
added ansible static inventory host.ini for testing
huseyin-yigit Oct 18, 2020
2d81e67
added dev stack dynamic inventory
huseyin-yigit Oct 18, 2020
3acd70d
update aws-ec2yml
huseyin-yigit Oct 18, 2020
a85f69b
added ansible dynamic inventory files for dev environment
huseyin-yigit Oct 18, 2020
d867efb
added ansible playbooks for the dev environment
huseyin-yigit Oct 18, 2020
c6f0e33
added scripts for qa automation environment
huseyin-yigit Oct 21, 2020
cca2eca
added scripts for qa automation environment
huseyin-yigit Oct 21, 2020
e5e284e
Merge branch 'feature/msp-16' into dev
huseyin-yigit Oct 21, 2020
27b4b5c
added scripts for qa automation environment
huseyin-yigit Oct 21, 2020
e245eea
updated ecr.sh
huseyin-yigit Oct 21, 2020
217662d
updated pettestjava
huseyin-yigit Oct 21, 2020
8923143
added scripts for running dummy selenium job
huseyin-yigit Oct 23, 2020
7ec170e
added qa automation pipeline for dev
huseyin-yigit Oct 24, 2020
f78c6b8
updated selemium jobs
huseyin-yigit Oct 24, 2020
a872156
updateds
huseyin-yigit Oct 24, 2020
bddb1a0
added inventory script, qa cfn template and Jenkinsfile to create QA …
huseyin-yigit Oct 24, 2020
04fc429
added build scripts for QA Environment
huseyin-yigit Oct 24, 2020
d2ee6e5
added script for jenkins job to build and deploy app on QA environment
huseyin-yigit Oct 24, 2020
a116d7b
added jenkinsfile petclinic-weekly-qa for release branch
huseyin-yigit Oct 24, 2020
13f74a0
added Configuration YAML Files for Kubernetes Deployment
huseyin-yigit Nov 25, 2020
5450191
added Configuration YAML Files for Kubernetes Deployment
huseyin-yigit Nov 25, 2020
3741657
updated deployment files with init containers
huseyin-yigit Nov 25, 2020
f8c62bf
updated deployment files with init containers
huseyin-yigit Nov 25, 2020
43124ca
added Configuration YAML Files for Kubernetes Deployment
huseyin-yigit Dec 5, 2020
95c31bf
Merge branch 'feature/msp-22' into release
huseyin-yigit Dec 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ansible/inventory/dev_stack_dynamic_inventory_aws_ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugin: aws_ec2
regions:
- "us-east-1"
filters:
tag:app-stack-name: APP_STACK_NAME
tag:environment: dev
keyed_groups:
- key: tags['app-stack-name']
prefix: 'app_stack_'
separator: ''
- key: tags['swarm-role']
prefix: 'role_'
separator: ''
- key: tags['environment']
prefix: 'env_'
separator: ''
- key: tags['server']
separator: ''
hostnames:
- "private-ip-address"
compose:
ansible_user: "'ec2-user'"
11 changes: 11 additions & 0 deletions ansible/inventory/dev_stack_swarm_grand_master_aws_ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugin: aws_ec2
regions:
- "us-east-1"
filters:
tag:app-stack-name: APP_STACK_NAME
tag:environment: dev
tag:swarm-role: grand-master
hostnames:
- "private-ip-address"
compose:
ansible_user: "'ec2-user'"
11 changes: 11 additions & 0 deletions ansible/inventory/dev_stack_swarm_managers_aws_ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugin: aws_ec2
regions:
- "us-east-1"
filters:
tag:app-stack-name: APP_STACK_NAME
tag:environment: dev
tag:swarm-role: manager
hostnames:
- "private-ip-address"
compose:
ansible_user: "'ec2-user'"
11 changes: 11 additions & 0 deletions ansible/inventory/dev_stack_swarm_workers_aws_ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugin: aws_ec2
regions:
- "us-east-1"
filters:
tag:app-stack-name: APP_STACK_NAME
tag:environment: dev
tag:swarm-role: worker
hostnames:
- "private-ip-address"
compose:
ansible_user: "'ec2-user'"
5 changes: 5 additions & 0 deletions ansible/inventory/hosts.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
172.31.18.79 ansible_user=ec2-user
172.31.17.104 ansible_user=ec2-user
172.31.82.199 ansible_user=ec2-user
172.31.27.10 ansible_user=ec2-user
172.31.83.29 ansible_user=ec2-user
22 changes: 22 additions & 0 deletions ansible/inventory/qa_stack_dynamic_inventory_aws_ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugin: aws_ec2
regions:
- "us-east-1"
filters:
tag:app-stack-name: APP_STACK_NAME
tag:environment: qa
keyed_groups:
- key: tags['app-stack-name']
prefix: 'app_stack_'
separator: ''
- key: tags['swarm-role']
prefix: 'role_'
separator: ''
- key: tags['environment']
prefix: 'env_'
separator: ''
- key: tags['server']
separator: ''
hostnames:
- "private-ip-address"
compose:
ansible_user: "'ec2-user'"
14 changes: 14 additions & 0 deletions ansible/playbooks/pb_deploy_app_on_docker_swarm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: role_grand_master
tasks:
- name: Copy docker compose file to grand master
copy:
src: "{{ workspace }}/docker-compose-swarm-dev-tagged.yml"
dest: /home/ec2-user/docker-compose-swarm-dev-tagged.yml
- name: get login credentials for ecr
shell: "export PATH=$PATH:/usr/local/bin/ && aws ecr get-login-password --region {{ aws_region }} | docker login --username AWS --password-stdin {{ ecr_registry }}"
register: output
- name: deploy the app stack on swarm
shell: "docker stack deploy --with-registry-auth -c /home/ec2-user/docker-compose-swarm-dev-tagged.yml {{ app_name }}"
register: output
- debug: msg="{{ output.stdout }}"
14 changes: 14 additions & 0 deletions ansible/playbooks/pb_deploy_app_on_qa_environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: role_grand_master
tasks:
- name: Copy docker compose file to grand master
copy:
src: "{{ workspace }}/docker-compose-swarm-qa-tagged.yml"
dest: /home/ec2-user/docker-compose-swarm-qa-tagged.yml
- name: get login credentials for ecr
shell: "export PATH=$PATH:/usr/local/bin/ && aws ecr get-login-password --region {{ aws_region }} | docker login --username AWS --password-stdin {{ ecr_registry }}"
register: output
- name: deploy the app stack on swarm
shell: "docker stack deploy --with-registry-auth -c /home/ec2-user/docker-compose-swarm-qa-tagged.yml {{ app_name }}"
register: output
- debug: msg="{{ output.stdout }}"
13 changes: 13 additions & 0 deletions ansible/playbooks/pb_initialize_docker_swarm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- hosts: role_grand_master
tasks:
- name: initialize docker swarm
shell: docker swarm init
- name: run the visualizer app for docker swarm
shell: |
docker service create \
--name=viz \
--publish=8088:8080/tcp \
--constraint=node.role==manager \
--mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
dockersamples/visualizer
17 changes: 17 additions & 0 deletions ansible/playbooks/pb_join_docker_swarm_managers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- hosts: role_grand_master
tasks:
- name: Get swarm join-token for managers
shell: docker swarm join-token manager | grep -i 'docker'
register: join_command_for_managers
- debug: msg='{{ join_command_for_managers.stdout.strip() }}'
- name: register grand_master with variable
add_host:
name: "grand_master"
manager_join: "{{ join_command_for_managers.stdout.strip() }}"
- hosts: role_manager
tasks:
- name: Join managers to swarm
shell: "{{ hostvars['grand_master']['manager_join'] }}"
register: result_of_joining
- debug: msg='{{ result_of_joining.stdout }}'
17 changes: 17 additions & 0 deletions ansible/playbooks/pb_join_docker_swarm_workers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- hosts: role_grand_master
tasks:
- name: Get swarm join-token for workers
shell: docker swarm join-token worker | grep -i 'docker'
register: join_command_for_workers
- debug: msg='{{ join_command_for_workers.stdout.strip() }}'
- name: register grand_master with variable
add_host:
name: "grand_master"
worker_join: "{{ join_command_for_workers.stdout.strip() }}"
- hosts: role_worker
tasks:
- name: Join workers to swarm
shell: "{{ hostvars['grand_master']['worker_join'] }}"
register: result_of_joining
- debug: msg='{{ result_of_joining.stdout }}'
10 changes: 10 additions & 0 deletions ansible/playbooks/pb_run_dummy_selenium_job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- hosts: all
tasks:
- name: run dummy selenium job
shell: "docker run --rm -v {{ workspace }}:{{ workspace }} -w {{ workspace }} callahanclarus/selenium-py-chrome:latest python {{ item }}"
with_fileglob: "{{ workspace }}/selenium-jobs/dummy*.py"
register: output
- name: show results
debug: msg="{{ item.stdout }}"
with_items: "{{ output.results }}"
10 changes: 10 additions & 0 deletions ansible/playbooks/pb_run_selenium_jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- hosts: all
tasks:
- name: run all selenium jobs
shell: "docker run --rm --env MASTER_PUBLIC_IP={{ master_public_ip }} -v {{ workspace }}:{{ workspace }} -w {{ workspace }} callahanclarus/selenium-py-chrome:latest python {{ item }}"
register: output
with_fileglob: "{{ workspace }}/selenium-jobs/test*.py"
- name: show results
debug: msg="{{ item.stdout }}"
with_items: "{{ output.results }}"
53 changes: 53 additions & 0 deletions ansible/playbooks/pb_setup_for_all_docker_swarm_instances.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
- hosts: all
tasks:
- name: update os
yum:
name: '*'
state: present
- name: install docker
command: amazon-linux-extras install docker=latest -y
- name: start docker
service:
name: docker
state: started
enabled: yes
- name: add ec2-user to docker group
shell: "usermod -a -G docker ec2-user"
- name: Install Docker Compose (if configured).
get_url:
url: https://github.com/docker/compose/releases/download/1.26.2/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
mode: 0755
- name: uninstall aws cli v1
file:
path: /bin/aws
state: absent
- name: Download awscliv2 installer
unarchive:
src: https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
dest: /tmp
remote_src: yes
creates: /tmp/aws
mode: 0755
- name: Run the installer.
command:
args:
cmd: "/tmp/aws/install"
creates: /usr/local/bin/aws
- name: install ecr credential helper
yum:
name: amazon-ecr-credential-helper
state: present
- name: Create folder for config file of ecr cred helper
file:
path: /home/ec2-user/.docker
state: directory
owner: "ec2-user"
mode: "g+rwx"
- name: create config file with content for ecr creds
copy:
content: '{"credsStore":"ecr-login"}'
dest: /home/ec2-user/.docker/config.json
owner: "ec2-user"
mode: "g+rwx"
4 changes: 4 additions & 0 deletions ansible/scripts/deploy_app_on_docker_swarm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PATH="$PATH:/usr/local/bin"
APP_NAME="petclinic"
envsubst < docker-compose-swarm-dev.yml > docker-compose-swarm-dev-tagged.yml
ansible-playbook -i ./ansible/inventory/dev_stack_dynamic_inventory_aws_ec2.yaml -b --extra-vars "workspace=${WORKSPACE} app_name=${APP_NAME} aws_region=${AWS_REGION} ecr_registry=${ECR_REGISTRY}" ./ansible/playbooks/pb_deploy_app_on_docker_swarm.yaml
5 changes: 5 additions & 0 deletions ansible/scripts/deploy_app_on_qa_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PATH="$PATH:/usr/local/bin"
APP_NAME="petclinic"
sed -i "s/APP_STACK_NAME/${APP_STACK_NAME}/" ./ansible/inventory/qa_stack_dynamic_inventory_aws_ec2.yaml
envsubst < docker-compose-swarm-qa.yml > docker-compose-swarm-qa-tagged.yml
ansible-playbook -i ./ansible/inventory/qa_stack_dynamic_inventory_aws_ec2.yaml -b --extra-vars "workspace=${WORKSPACE} app_name=${APP_NAME} aws_region=${AWS_REGION} ecr_registry=${ECR_REGISTRY}" ./ansible/playbooks/pb_deploy_app_on_qa_environment.yaml
2 changes: 2 additions & 0 deletions ansible/scripts/run_dummy_selenium_job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PATH="$PATH:/usr/local/bin"
ansible-playbook --connection=local --inventory 127.0.0.1, --extra-vars "workspace=${WORKSPACE}" ./ansible/playbooks/pb_run_dummy_selenium_job.yaml
3 changes: 3 additions & 0 deletions ansible/scripts/run_selenium_jobs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PATH="$PATH:/usr/local/bin"
ansible-playbook -vvv --connection=local --inventory 127.0.0.1,
--extra-vars "workspace=${WORKSPACE} master_public_ip=${GRAND_MASTER_PUBLIC_IP}" ./ansible/playbooks/pb_run_selenium_jobs.yaml
12 changes: 12 additions & 0 deletions build-dev-docker-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# build-dev-docker-images
./mvnw clean package
docker build --force-rm -t "petclinic-admin-server:dev" ./spring-petclinic-admin-server
docker build --force-rm -t "petclinic-api-gateway:dev" ./spring-petclinic-api-gateway
docker build --force-rm -t "petclinic-config-server:dev" ./spring-petclinic-config-server
docker build --force-rm -t "petclinic-customers-service:dev" ./spring-petclinic-customers-service
docker build --force-rm -t "petclinic-discovery-server:dev" ./spring-petclinic-discovery-server
docker build --force-rm -t "petclinic-hystrix-dashboard:dev" ./spring-petclinic-hystrix-dashboard
docker build --force-rm -t "petclinic-vets-service:dev" ./spring-petclinic-vets-service
docker build --force-rm -t "petclinic-visits-service:dev" ./spring-petclinic-visits-service
docker build --force-rm -t "petclinic-prometheus-server:dev" ./docker/prometheus
docker build --force-rm -t "petclinic-grafana-server:dev" ./docker/grafana
97 changes: 97 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
version: '2'
services:
config-server:
image: petclinic-config-server:dev
container_name: config-server
mem_limit: 512M
ports:
- 8888:8888
discovery-server:
image: petclinic-discovery-server:dev
container_name: discovery-server
mem_limit: 512M
ports:
- 8761:8761
depends_on:
- config-server
entrypoint: ["./dockerize", "-wait=tcp://config-server:8888", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
customers-service:
image: petclinic-customers-service:dev
container_name: customers-service
mem_limit: 512M
ports:
- 8081:8081
depends_on:
- config-server
- discovery-server
entrypoint: ["./dockerize", "-wait=tcp://discovery-server:8761", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
visits-service:
image: petclinic-visits-service:dev
container_name: visits-service
mem_limit: 512M
ports:
- 8082:8082
depends_on:
- config-server
- discovery-server
entrypoint: ["./dockerize", "-wait=tcp://discovery-server:8761", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
vets-service:
image: petclinic-vets-service:dev
container_name: vets-service
mem_limit: 512M
ports:
- 8083:8083
depends_on:
- config-server
- discovery-server
entrypoint: ["./dockerize", "-wait=tcp://discovery-server:8761", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
api-gateway:
image: petclinic-api-gateway:dev
container_name: api-gateway
mem_limit: 512M
ports:
- 8080:8080
depends_on:
- config-server
- discovery-server
entrypoint: ["./dockerize", "-wait=tcp://discovery-server:8761", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
admin-server:
image: petclinic-admin-server:dev
container_name: admin-server
mem_limit: 512M
ports:
- 9090:9090
depends_on:
- config-server
- discovery-server
entrypoint: ["./dockerize", "-wait=tcp://discovery-server:8761", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
hystrix-dashboard:
image: petclinic-hystrix-dashboard:dev
container_name: hystrix-dashboard
mem_limit: 512M
ports:
- 7979:7979
depends_on:
- config-server
- discovery-server
entrypoint: ["./dockerize", "-wait=tcp://discovery-server:8761", "-timeout=60s", "--", "java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar" ]
tracing-server:
image: openzipkin/zipkin
container_name: tracing-server
mem_limit: 512M
environment:
- JAVA_OPTS=-XX:+UnlockExperimentalVMOptions -Djava.security.egd=file:/dev/./urandom
ports:
- 9411:9411
grafana-server:
image: petclinic-grafana-server:dev
container_name: grafana-server
mem_limit: 256M
ports:
- 3000:3000
prometheus-server:
image: petclinic-prometheus-server:dev
container_name: prometheus-server
mem_limit: 256M
ports:
- 9091:9090
Loading