Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/msp 17 #11

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
12ae836
added packaging script
vildan71 Oct 10, 2020
faf01a5
added Dockerfiles for microservices
vildan71 Oct 10, 2020
cb148ad
added script for building docker images
vildan71 Oct 11, 2020
b5059b3
v2
vildan71 Oct 11, 2020
a12072f
added docker compose file and script for local deployment
vildan71 Oct 11, 2020
c03f7d9
changed dockerfile
vildan71 Oct 11, 2020
da5330f
added cloudformation template
vildan71 Oct 13, 2020
903262c
added cloudformation template for dev server
vildan71 Oct 13, 2020
38b6ce8
git push origin devMerge branch 'feature/msp-5' into dev
vildan71 Oct 13, 2020
4b49c9f
added cloudformation template for dev server
vildan71 Oct 13, 2020
599ab8b
added cloudformation template for dev server
vildan71 Oct 13, 2020
9c80c73
added 3 UTs for customer-service
vildan71 Oct 14, 2020
d57ed90
updated POM with Jacoco plugin
vildan71 Oct 14, 2020
c11e6dc
update pettest.java file
vildan71 Oct 14, 2020
290e007
updated dev-server-for-petclinic-app-cfn-template.yml
vildan71 Oct 14, 2020
6bf2886
updated PetTest.java
vildan71 Oct 14, 2020
f1facd5
updated POM with Jacoco plugin
vildan71 Oct 14, 2020
5c3d541
updated POM with Jacoco plugin
vildan71 Oct 14, 2020
546d7de
updated POM with Jacoco plugin
vildan71 Oct 14, 2020
f9216d2
updated build-dev-docker-images.sh and docker-compose-local.yml files
vildan71 Oct 15, 2020
43e8a1f
reupload PetTest.java file
vildan71 Oct 15, 2020
2650435
pettest.java
vildan71 Oct 15, 2020
b2c33b5
pettest.java
vildan71 Oct 15, 2020
4c015ac
updated dev-server cfn template
vildan71 Oct 15, 2020
cd5f7ed
added selenium jobs written in python
vildan71 Oct 15, 2020
212c7e8
git push origin devMerge branch 'feature/msp-10' into dev
vildan71 Oct 15, 2020
ea47338
added jenkins server cfn template
vildan71 Oct 16, 2020
873953e
added script for petclinic-ci-job
vildan71 Oct 17, 2020
bcbaac4
added script for creating ECR registry for dev
vildan71 Oct 17, 2020
e6f1879
added cloudformation template for Docker Swarm infrastructure
vildan71 Oct 17, 2020
5792d1a
added cloudformation template for Docker Swarm infrastructure
vildan71 Oct 18, 2020
a6f2d5c
hello
vildan71 Oct 18, 2020
6557cde
added ansible static inventory host.ini for testing
vildan71 Oct 18, 2020
dbffe01
added ansible static inventory hosts.ini for testing
vildan71 Oct 19, 2020
b0b3719
added ansible dynamic inventory files for dev environment
vildan71 Oct 20, 2020
5f1c0f2
added scripts for qa automation environment
vildan71 Oct 21, 2020
0cb2921
added scripts for qa automation environment
vildan71 Oct 21, 2020
4a15162
added scripts for qa automation environment
vildan71 Oct 21, 2020
ca18392
added scripts for running dummy selenium job
vildan71 Oct 23, 2020
f544426
added qa automation pipeline for dev
vildan71 Oct 24, 2020
86df828
added qa automation pipeline for dev
vildan71 Oct 25, 2020
8b70c3d
added qa automation pipeline for dev
vildan71 Dec 9, 2020
001da80
updated selenium jobs
vildan71 Dec 13, 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.83.80 ansible_user=ec2-user
172.31.86.251 ansible_user=ec2-user
172.31.84.195 ansible_user=ec2-user
172.31.82.149 ansible_user=ec2-user
172.31.87.90 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 }}"
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
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 }}"
54 changes: 54 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,54 @@
---
- 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
2 changes: 2 additions & 0 deletions ansible/scripts/run_dummy_selenium_jobs.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
2 changes: 2 additions & 0 deletions ansible/scripts/run_selenium_jobs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
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
108 changes: 108 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
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