├── .github └── workflows │ └── ddosify-latency-testing.yml ├── .gitignore ├── 001_django_throttling ├── Dockerfile ├── README.md ├── entrypoint.sh ├── k8s_django.yaml ├── k8s_redis.yaml ├── requirements.txt └── throttling │ ├── core │ ├── __init__.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── throttling.py │ ├── urls.py │ └── views.py │ ├── manage.py │ └── throttling │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── 002_ddosify_latency_testing_github_action ├── ddosify-latency-testing-masterpush-only-europe.yaml ├── ddosify-latency-testing-schedule-all-locations.yaml └── ddosify-latency-testing-schedule-only-europe.yaml ├── 003_auth_flow_load_testing ├── auth_flow.json ├── login_payload.json └── register_payload.json ├── 004_csv_import_blog ├── exchange_body.json ├── fetch_exchange_rates.json ├── test_data.csv └── transaction_replay.json ├── 005_js_web_frameworks_benchmark ├── README.md └── code │ ├── express │ ├── index.js │ ├── package-lock.json │ └── package.json │ ├── fastify │ ├── index.js │ ├── package-lock.json │ └── package.json │ ├── fibonacci_sequence.js │ ├── koa │ ├── index.js │ ├── package-lock.json │ └── package.json │ └── package-lock.json ├── 006_effortless_kubernetes_monitoring_using_ebpf ├── eksctl_cluster.yaml └── sample_apps.yaml ├── 007_exploring-function-tracing-with-ebpf-and-uprobes-part1 ├── program │ ├── go.mod │ ├── main.go │ └── p └── tracker │ ├── README │ ├── bpf.c │ ├── ctx.h │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── tracker.o ├── 008_slow_sql_queries ├── models.py └── sample_apps.yaml ├── 009_kubernetes_hpa └── sample_application.yaml ├── 010_postgres_observability ├── README.md ├── go.mod ├── go.sum ├── images │ └── postgres.png ├── main.go ├── perf │ ├── go.mod │ ├── go.sum │ ├── measure.go │ ├── plot.py │ └── postgresql.conf ├── postgres.c ├── postgres.h ├── test │ ├── client.go │ ├── go.mod │ └── go.sum └── util.go ├── 011_aws-eks-with-monitoring-anteon ├── .editorconfig ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── LICENSE ├── README.md ├── docker-compose.yml ├── docker │ ├── Dockerfile │ ├── grafana │ │ ├── Dockerfile │ │ ├── dashboards │ │ │ └── grafana-petclinic-dashboard.json │ │ ├── grafana.ini │ │ └── provisioning │ │ │ ├── dashboards │ │ │ └── all.yml │ │ │ └── datasources │ │ │ └── all.yml │ └── prometheus │ │ ├── Dockerfile │ │ └── prometheus.yml ├── docs │ ├── application-screenshot.png │ ├── grafana-custom-metrics-dashboard.png │ └── microservices-architecture-diagram.jpg ├── jenkins │ ├── build-prod-docker-images-for-ecr.sh │ ├── deploy_app_on_prod_environment.sh │ ├── jenkinsfile-microservice-app-production │ ├── package-with-maven-container.sh │ ├── prepare-tags-ecr-for-production-docker-images.sh │ └── push-prod-docker-images-to-ecr.sh ├── k8s │ ├── cluster.yaml │ ├── docker-compose.yml │ ├── petclinic_chart-0.0.1.tgz │ ├── petclinic_chart │ │ ├── .helmignore │ │ ├── Chart.yaml │ │ ├── templates │ │ │ ├── admin-server-deployment.yaml │ │ │ ├── admin-server-service.yaml │ │ │ ├── api-gateway-deployment.yaml │ │ │ ├── api-gateway-ingress.yaml │ │ │ ├── api-gateway-service.yaml │ │ │ ├── config-server-deployment.yaml │ │ │ ├── config-server-service.yaml │ │ │ ├── customers-service-deployment.yaml │ │ │ ├── customers-service-service.yaml │ │ │ ├── discovery-server-deployment.yaml │ │ │ ├── discovery-server-service.yaml │ │ │ ├── grafana-server-deployment.yaml │ │ │ ├── grafana-server-service.yaml │ │ │ ├── hystrix-dashboard-deployment.yaml │ │ │ ├── hystrix-dashboard-service.yaml │ │ │ ├── mysql-server-service.yaml │ │ │ ├── prometheus-server-deployment.yaml │ │ │ ├── prometheus-server-service.yaml │ │ │ ├── tracing-server-deployment.yaml │ │ │ ├── tracing-server-service.yaml │ │ │ ├── vets-service-deployment.yaml │ │ │ ├── vets-service-service.yaml │ │ │ ├── visits-service-deployment.yaml │ │ │ └── visits-service-service.yaml │ │ ├── values-template.yaml │ │ └── values.yaml │ └── tls-cluster-issuer-prod.yml ├── mvnw ├── mvnw.cmd ├── pom.xml ├── spring-petclinic-admin-server │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── admin │ │ │ └── SpringBootAdminApplication.java │ │ └── resources │ │ ├── bootstrap.yml │ │ └── logback-spring.xml ├── spring-petclinic-api-gateway │ ├── .gitignore │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── api │ │ │ │ ├── ApiGatewayApplication.java │ │ │ │ ├── application │ │ │ │ ├── CustomersServiceClient.java │ │ │ │ └── VisitsServiceClient.java │ │ │ │ ├── boundary │ │ │ │ └── web │ │ │ │ │ └── ApiGatewayController.java │ │ │ │ └── dto │ │ │ │ ├── OwnerDetails.java │ │ │ │ ├── PetDetails.java │ │ │ │ ├── PetType.java │ │ │ │ ├── VisitDetails.java │ │ │ │ └── Visits.java │ │ ├── less │ │ │ ├── header.less │ │ │ ├── petclinic.less │ │ │ ├── responsive.less │ │ │ └── typography.less │ │ ├── resources │ │ │ ├── application.yml │ │ │ ├── bootstrap.yml │ │ │ ├── logback-spring.xml │ │ │ ├── messages │ │ │ │ ├── messages.properties │ │ │ │ ├── messages_de.properties │ │ │ │ └── messages_en.properties │ │ │ └── static │ │ │ │ ├── fonts │ │ │ │ ├── montserrat-webfont.eot │ │ │ │ ├── montserrat-webfont.svg │ │ │ │ ├── montserrat-webfont.ttf │ │ │ │ ├── montserrat-webfont.woff │ │ │ │ ├── varela_round-webfont.eot │ │ │ │ ├── varela_round-webfont.svg │ │ │ │ ├── varela_round-webfont.ttf │ │ │ │ └── varela_round-webfont.woff │ │ │ │ ├── images │ │ │ │ ├── favicon.ico │ │ │ │ ├── favicon1.png │ │ │ │ ├── pets.png │ │ │ │ ├── pets1.png │ │ │ │ ├── platform-bg.png │ │ │ │ ├── spring-logo-dataflow-mobile.png │ │ │ │ ├── spring-logo-dataflow-mobile1.png │ │ │ │ ├── spring-logo-dataflow.png │ │ │ │ ├── spring-logo-dataflow1.png │ │ │ │ ├── spring-pivotal-logo.png │ │ │ │ └── spring-pivotal-logo1.png │ │ │ │ ├── index.html │ │ │ │ └── scripts │ │ │ │ ├── app.js │ │ │ │ ├── fragments │ │ │ │ ├── footer.html │ │ │ │ ├── nav.html │ │ │ │ └── welcome.html │ │ │ │ ├── owner-details │ │ │ │ ├── owner-details.component.js │ │ │ │ ├── owner-details.controller.js │ │ │ │ ├── owner-details.js │ │ │ │ └── owner-details.template.html │ │ │ │ ├── owner-form │ │ │ │ ├── owner-form.component.js │ │ │ │ ├── owner-form.controller.js │ │ │ │ ├── owner-form.js │ │ │ │ └── owner-form.template.html │ │ │ │ ├── owner-list │ │ │ │ ├── owner-list.component.js │ │ │ │ ├── owner-list.controller.js │ │ │ │ ├── owner-list.js │ │ │ │ └── owner-list.template.html │ │ │ │ ├── pet-form │ │ │ │ ├── pet-form.component.js │ │ │ │ ├── pet-form.controller.js │ │ │ │ ├── pet-form.js │ │ │ │ └── pet-form.template.html │ │ │ │ ├── vet-list │ │ │ │ ├── vet-list.component.js │ │ │ │ ├── vet-list.controller.js │ │ │ │ ├── vet-list.js │ │ │ │ └── vet-list.template.html │ │ │ │ └── visits │ │ │ │ ├── visits.component.js │ │ │ │ ├── visits.controller.js │ │ │ │ ├── visits.js │ │ │ │ └── visits.template.html │ │ └── wro │ │ │ ├── wro.properties │ │ │ └── wro.xml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── api │ │ │ ├── ApiGatewayApplicationTests.java │ │ │ └── application │ │ │ └── VisitsServiceClientTest.java │ │ ├── jmeter │ │ └── petclinic_test_plan.jmx │ │ └── resources │ │ └── bootstrap-test.yml ├── spring-petclinic-config-server │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── config │ │ │ │ └── ConfigServerApplication.java │ │ └── resources │ │ │ └── bootstrap.yml │ │ └── test │ │ └── java │ │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── config │ │ └── PetclinicConfigServerApplicationTests.java ├── spring-petclinic-customers-service │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── customers │ │ │ │ ├── CustomersServiceApplication.java │ │ │ │ ├── model │ │ │ │ ├── Owner.java │ │ │ │ ├── OwnerRepository.java │ │ │ │ ├── Pet.java │ │ │ │ ├── PetRepository.java │ │ │ │ └── PetType.java │ │ │ │ └── web │ │ │ │ ├── OwnerResource.java │ │ │ │ ├── PetDetails.java │ │ │ │ ├── PetRequest.java │ │ │ │ ├── PetResource.java │ │ │ │ └── ResourceNotFoundException.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── bootstrap.yml │ │ │ ├── db │ │ │ ├── hsqldb │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── mysql │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── logback-spring.xml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── customers │ │ │ └── web │ │ │ └── PetResourceTest.java │ │ └── resources │ │ ├── application-test.yml │ │ └── bootstrap-test.yml ├── spring-petclinic-discovery-server │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── discovery │ │ │ │ └── DiscoveryServerApplication.java │ │ └── resources │ │ │ └── bootstrap.yml │ │ └── test │ │ └── java │ │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── discovery │ │ └── DiscoveryServerApplicationTests.java ├── spring-petclinic-hystrix-dashboard │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── dashboard │ │ │ │ └── HystrixDashboardApplication.java │ │ └── resources │ │ │ ├── bootstrap.yml │ │ │ └── logback-spring.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── dashboard │ │ └── HystrixDashboardApplicationTests.java ├── spring-petclinic-vets-service │ ├── .gitignore │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── vets │ │ │ │ ├── VetsServiceApplication.java │ │ │ │ ├── model │ │ │ │ ├── Specialty.java │ │ │ │ ├── Vet.java │ │ │ │ └── VetRepository.java │ │ │ │ ├── system │ │ │ │ ├── CacheConfig.java │ │ │ │ └── VetsProperties.java │ │ │ │ └── web │ │ │ │ └── VetResource.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── bootstrap.yml │ │ │ ├── db │ │ │ ├── hsqldb │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── mysql │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── logback-spring.xml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── vets │ │ │ └── web │ │ │ └── VetResourceTest.java │ │ └── resources │ │ ├── application-test.yml │ │ └── bootstrap-test.yml ├── spring-petclinic-visits-service │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── visits │ │ │ │ ├── VisitsServiceApplication.java │ │ │ │ ├── model │ │ │ │ ├── Visit.java │ │ │ │ └── VisitRepository.java │ │ │ │ └── web │ │ │ │ └── VisitResource.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── bootstrap.yml │ │ │ ├── db │ │ │ ├── hsqldb │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── mysql │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── logback-spring.xml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── visits │ │ │ └── web │ │ │ └── VisitResourceTest.java │ │ └── resources │ │ ├── application-test.yml │ │ └── bootstrap-test.yml └── templates │ ├── admin-server-deployment.yaml │ ├── admin-server-service.yaml │ ├── api-gateway-deployment.yaml │ ├── api-gateway-ingress.yaml │ ├── api-gateway-service.yaml │ ├── config-server-deployment.yaml │ ├── config-server-service.yaml │ ├── customers-service-deployment.yaml │ ├── customers-service-service.yaml │ ├── discovery-server-deployment.yaml │ ├── discovery-server-service.yaml │ ├── grafana-server-deployment.yaml │ ├── grafana-server-service.yaml │ ├── hystrix-dashboard-deployment.yaml │ ├── hystrix-dashboard-service.yaml │ ├── mysql-server-deployment.yaml │ ├── mysql-server-service.yaml │ ├── prometheus-server-deployment.yaml │ ├── prometheus-server-service.yaml │ ├── tracing-server-deployment.yaml │ ├── tracing-server-service.yaml │ ├── vets-service-deployment.yaml │ ├── vets-service-service.yaml │ ├── visits-service-deployment.yaml │ └── visits-service-service.yaml ├── 011_redis_observability ├── README.md ├── go.mod ├── go.sum ├── main.go ├── perf │ ├── go.mod │ ├── go.sum │ ├── measure.go │ └── plot.py ├── redis.c ├── redis.h ├── test │ ├── client.go │ ├── go.mod │ └── go.sum └── util.go ├── 012_ssl_observability ├── README.md ├── go.mod ├── go.sum ├── main.go ├── perf │ ├── plot.py │ └── run.sh ├── ssl.c ├── ssl.h ├── test │ ├── go.mod │ ├── main.go │ ├── server.crt │ └── server.key └── vmlinux.h └── README.md /.github/workflows/ddosify-latency-testing.yml: -------------------------------------------------------------------------------- 1 | name: "Ddosify Latency Testing" 2 | 3 | on: 4 | # schedule: 5 | # - cron: '0 * * * *' # Every one hour. The shortest interval is once every 5 minutes 6 | workflow_dispatch: 7 | 8 | jobs: 9 | latency-test: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Ddosify Latency Test 14 | uses: ddosify/ddosify-latency-action@v1 15 | # highlight-start 16 | with: 17 | api_key: ${{ secrets.DDOSIFY_API_KEY }} 18 | target: "https://app.servdown.com" 19 | locations: '["*"]' 20 | failIf: "EU.*>50" 21 | # highlight-end 22 | -------------------------------------------------------------------------------- /001_django_throttling/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9.10-slim 2 | 3 | COPY ./requirements.txt . 4 | RUN pip --no-cache-dir install -r requirements.txt 5 | 6 | WORKDIR /workspace 7 | COPY . /workspace 8 | 9 | CMD ["/workspace/entrypoint.sh"] 10 | -------------------------------------------------------------------------------- /001_django_throttling/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # cd throttling && gunicorn --workers 1 --bind 0.0.0.0:9018 throttling.wsgi 4 | cd throttling && gunicorn --workers 6 --bind 0.0.0.0:9018 throttling.wsgi 5 | -------------------------------------------------------------------------------- /001_django_throttling/k8s_django.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: throttling-deployment 5 | labels: 6 | app: throttling 7 | spec: 8 | replicas: 6 9 | selector: 10 | matchLabels: 11 | app: throttling 12 | template: 13 | metadata: 14 | labels: 15 | app: throttling 16 | appType: ddosify 17 | spec: 18 | containers: 19 | - name: throttling 20 | image: django_throttling:latest 21 | imagePullPolicy: Never 22 | ports: 23 | - containerPort: 9018 24 | name: throttling-port 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: throttling-service 30 | spec: 31 | type: NodePort 32 | selector: 33 | app: throttling 34 | ports: 35 | - protocol: TCP 36 | port: 9018 37 | targetPort: 9018 38 | nodePort: 31534 39 | -------------------------------------------------------------------------------- /001_django_throttling/k8s_redis.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: redis-deployment 5 | labels: 6 | app: redis 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: redis 12 | template: 13 | metadata: 14 | labels: 15 | app: redis 16 | appType: ddosify 17 | spec: 18 | containers: 19 | - name: redis 20 | image: redis:6.2.7 21 | imagePullPolicy: Always 22 | ports: 23 | - containerPort: 6379 24 | name: redis-port 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: redis-service 30 | spec: 31 | type: NodePort 32 | selector: 33 | app: redis 34 | ports: 35 | - protocol: TCP 36 | port: 6379 37 | targetPort: 6379 38 | nodePort: 31514 39 | -------------------------------------------------------------------------------- /001_django_throttling/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==4.0.7 2 | djangorestframework==3.13.1 3 | gunicorn==20.1.0 4 | redis==4.3.4 5 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/001_django_throttling/throttling/core/__init__.py -------------------------------------------------------------------------------- /001_django_throttling/throttling/core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'core' 7 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/core/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/001_django_throttling/throttling/core/migrations/__init__.py -------------------------------------------------------------------------------- /001_django_throttling/throttling/core/throttling.py: -------------------------------------------------------------------------------- 1 | from rest_framework.throttling import SimpleRateThrottle 2 | from django.core.cache import caches 3 | 4 | class ConcurrencyThrottleApiKey(SimpleRateThrottle): 5 | cache = caches['alternate'] # use redis cache. Delete if you want to use default Django cache 6 | rate = "1/s" 7 | 8 | def get_cache_key(self, request, view): 9 | return request.query_params['api_key'] 10 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/core/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | import core.views as core_views 3 | 4 | urlpatterns = [ 5 | path('', core_views.DjangoThrottlingAPIView.as_view(), name="throtling"), 6 | ] 7 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/core/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework import status 2 | from rest_framework.generics import GenericAPIView 3 | from rest_framework.response import Response 4 | 5 | from core import throttling 6 | 7 | 8 | class DjangoThrottlingAPIView(GenericAPIView): 9 | lookup_field = 'id' 10 | throttle_classes = [throttling.ConcurrencyThrottleApiKey] 11 | 12 | def get(self, request): 13 | return Response("ok", status=status.HTTP_200_OK) 14 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'throttling.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/throttling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/001_django_throttling/throttling/throttling/__init__.py -------------------------------------------------------------------------------- /001_django_throttling/throttling/throttling/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for throttling project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'throttling.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/throttling/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path, include 2 | 3 | urlpatterns = [ 4 | path('', include('core.urls')), 5 | ] 6 | -------------------------------------------------------------------------------- /001_django_throttling/throttling/throttling/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for throttling project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'throttling.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /002_ddosify_latency_testing_github_action/ddosify-latency-testing-masterpush-only-europe.yaml: -------------------------------------------------------------------------------- 1 | name: "Ddosify Latency Testing" 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | jobs: 8 | latency-test: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Ddosify Latency Test 13 | uses: ddosify/ddosify-latency-action@v1 14 | with: 15 | api_key: ${{ secrets.DDOSIFY_API_KEY }} # Store DDOSIFY_API_KEY as secret 16 | target: "https://app.servdown.com" # Target Endpoint for latency testing 17 | locations: '["EU.*"]' # (optional) Only Europe cities 18 | failIf: "EU.*>100" # (optional) If any of Europe (EU) city's latency is greater than 100ms, fail the pipeline 19 | -------------------------------------------------------------------------------- /002_ddosify_latency_testing_github_action/ddosify-latency-testing-schedule-all-locations.yaml: -------------------------------------------------------------------------------- 1 | name: "Ddosify Latency Testing" 2 | 3 | on: 4 | schedule: 5 | - cron: '0 * * * *' # Every one hour. The shortest interval is once every 5 minutes 6 | 7 | jobs: 8 | latency-test: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Ddosify Latency Test 13 | uses: ddosify/ddosify-latency-action@v1 14 | with: 15 | api_key: ${{ secrets.DDOSIFY_API_KEY }} # Store DDOSIFY_API_KEY as secret 16 | target: "https://app.servdown.com" # Target Endpoint for latency testing 17 | locations: '["*"]' # (optional) All the cities 18 | failIf: "EU.*>100" # (optional) If any of Europe (EU) city's latency is greater than 100ms, fail the pipeline 19 | -------------------------------------------------------------------------------- /002_ddosify_latency_testing_github_action/ddosify-latency-testing-schedule-only-europe.yaml: -------------------------------------------------------------------------------- 1 | name: "Ddosify Latency Testing" 2 | 3 | on: 4 | schedule: 5 | - cron: '0 * * * *' # Every one hour. The shortest interval is once every 5 minutes 6 | 7 | jobs: 8 | latency-test: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Ddosify Latency Test 13 | uses: ddosify/ddosify-latency-action@v1 14 | with: 15 | api_key: ${{ secrets.DDOSIFY_API_KEY }} # Store DDOSIFY_API_KEY as secret 16 | target: "https://app.servdown.com" # Target Endpoint for latency testing 17 | locations: '["EU.*"]' # (optional) Only Europe cities 18 | failIf: "EU.*>100" # (optional) If any of Europe (EU) city's latency is greater than 100ms, fail the pipeline 19 | -------------------------------------------------------------------------------- /003_auth_flow_load_testing/auth_flow.json: -------------------------------------------------------------------------------- 1 | { 2 | "iteration_count": 50, 3 | "duration": 10, 4 | "load_type": "linear", 5 | "env": { 6 | "baseUrl": "https://testserver.ddosify.com/account", 7 | "username": "{{_randomUserName}}", 8 | "email": "{{_randomEmail}}", 9 | "password": "{{_randomPassword}}" 10 | }, 11 | "steps": [ 12 | { 13 | "id": 1, 14 | "name": "Register", 15 | "url": "{{baseUrl}}/register/", 16 | "method": "POST", 17 | "headers": { 18 | "Content-Type": "application/json" 19 | }, 20 | "payload_file": "./register_payload.json", 21 | "sleep": "1000-2500" 22 | }, 23 | { 24 | "id": 2, 25 | "name": "Login", 26 | "url": "{{baseUrl}}/login/", 27 | "method": "POST", 28 | "headers": { 29 | "Content-Type": "application/json" 30 | }, 31 | "payload_file": "./login_payload.json", 32 | "sleep": "1000-2500", 33 | "capture_env": { 34 | "access_token": {"from": "body", "json_path": "tokens.access"} 35 | } 36 | }, 37 | { 38 | "id": 3, 39 | "name": "Account", 40 | "url": "{{baseUrl}}/user/", 41 | "method": "GET", 42 | "sleep": "1000-2500", 43 | "headers": { 44 | "Authorization": "Bearer {{access_token}}" 45 | } 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /003_auth_flow_load_testing/login_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "username": "{{username}}", 3 | "password": "{{password}}" 4 | } -------------------------------------------------------------------------------- /003_auth_flow_load_testing/register_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "username": "{{username}}", 3 | "email": "{{email}}", 4 | "password": "{{password}}" 5 | } -------------------------------------------------------------------------------- /004_csv_import_blog/exchange_body.json: -------------------------------------------------------------------------------- 1 | { 2 | "amount": "{{data.transactions.amount}}", 3 | "base": "{{data.transactions.base_currency}}", 4 | "target": "{{data.transactions.target_currency}}" 5 | } -------------------------------------------------------------------------------- /004_csv_import_blog/fetch_exchange_rates.json: -------------------------------------------------------------------------------- 1 | { 2 | "iteration_count": 1000, 3 | "duration": 10, 4 | "load_type": "incremental", 5 | "env": { 6 | "currencies": ["AED","ARS","AUD","BGN","BHD","BRL", 7 | "CAD","CHF","CNY","DKK","DZD","EUR", 8 | "FKP","INR","JEP","JPY","KES","KWD", 9 | "KZT","MXN","NZD","RUB","SEK","SGD", 10 | "TRY","USD"], 11 | "baseUrl": "https://testserver.ddosify.com/exchange_rate" 12 | }, 13 | "steps": [ 14 | { 15 | "id": 1, 16 | "name": "Random Currency Fetch", 17 | "url": "{{baseUrl}}/{{rand(currencies)}}/{{rand(currencies)}}/" 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /004_csv_import_blog/transaction_replay.json: -------------------------------------------------------------------------------- 1 | { 2 | "iteration_count": 1000, 3 | "duration": 60, 4 | "load_type": "waved", 5 | "env": { 6 | "baseUrl": "https://testserver.ddosify.com/exchange/" 7 | }, 8 | "data": { 9 | "transactions": { 10 | "path": "./test_data.csv", 11 | "vars": { 12 | "0": { 13 | "tag": "api_key" 14 | }, 15 | "1": { 16 | "tag": "amount", 17 | "type": "float" 18 | }, 19 | "2": { 20 | "tag": "base_currency" 21 | }, 22 | "3": { 23 | "tag": "target_currency" 24 | } 25 | }, 26 | "delimiter": ",", 27 | "allow_quota": false, 28 | "order": "sequential", 29 | "skip_first_line": false, 30 | "skip_empty_line": true 31 | } 32 | }, 33 | "steps": [ 34 | { 35 | "id": 1, 36 | "name": "Exchange", 37 | "url": "{{baseUrl}}", 38 | "method": "POST", 39 | "headers": { 40 | "X-API-KEY": "{{data.transactions.api_key}}", 41 | "Content-Type": "application/json" 42 | }, 43 | "payload_file": "./exchange_body.json" 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/express/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { fibonacciSequence } = require('../fibonacci_sequence.js'); 3 | const app = express(); 4 | const port = 8000; 5 | 6 | app.get('/', (req, res) => { 7 | res.end(); 8 | }); 9 | 10 | app.get('/:number', (req, res) => { 11 | const num = req.params.number; 12 | res.send({result: fibonacciSequence(num)}); 13 | }); 14 | 15 | app.listen(port, () => { 16 | console.log(`Express server listening at ${port}`); 17 | }); 18 | -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/express/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.18.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/fastify/index.js: -------------------------------------------------------------------------------- 1 | const fastify = require('fastify')(); 2 | const { fibonacciSequence } = require('../fibonacci_sequence.js'); 3 | 4 | const port = 8000; 5 | 6 | fastify.get('/', function (request, reply) { 7 | return ''; 8 | }); 9 | 10 | fastify.get('/:number', (request, reply) => { 11 | const num = request.params.number; 12 | return fibonacciSequence(num); 13 | }); 14 | 15 | fastify.listen({port: port, host: '0.0.0.0'}, (err, address) => { 16 | if (err) { 17 | fastify.log.error(err); 18 | process.exit(1); 19 | } 20 | fastify.log.info(`Fastify server listening at ${address}`); 21 | }); 22 | -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/fastify/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fastify", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "fastify": "^4.15.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/fibonacci_sequence.js: -------------------------------------------------------------------------------- 1 | function fibonacciSequence(num) { 2 | let result = []; 3 | let num1 = 0; 4 | let num2 = 1; 5 | let nextTerm; 6 | for (let i = 1; i <= num; i++) { 7 | result.push(num1); 8 | nextTerm = num1 + num2; 9 | num1 = num2; 10 | num2 = nextTerm; 11 | } 12 | 13 | return result; 14 | } 15 | 16 | module.exports = { fibonacciSequence } -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/koa/index.js: -------------------------------------------------------------------------------- 1 | const Koa = require('koa'); 2 | const Router = require('koa-router'); 3 | const { fibonacciSequence } = require('../fibonacci_sequence'); 4 | const app = new Koa(); 5 | const router = new Router(); 6 | const port = 8000; 7 | 8 | router.get('/', async (ctx, next) => { 9 | ctx.body = ''; 10 | }); 11 | 12 | router.get('/:number', async (ctx) => { 13 | const num = ctx.params.number; 14 | ctx.body = fibonacciSequence(num); 15 | }); 16 | 17 | app.use(router.routes()).use(router.allowedMethods()); 18 | 19 | app.listen(port, "0.0.0.0", () => { 20 | console.log(`Koa server listening at ${port}`); 21 | }); 22 | -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/koa/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "koa", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "koa": "^2.14.1", 13 | "koa-router": "^12.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /005_js_web_frameworks_benchmark/code/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "code", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": {} 6 | } 7 | -------------------------------------------------------------------------------- /006_effortless_kubernetes_monitoring_using_ebpf/eksctl_cluster.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: eksctl.io/v1alpha5 2 | kind: ClusterConfig 3 | 4 | metadata: 5 | name: ddosify-k8s-test-blog 6 | region: us-west-1 7 | vpc: 8 | clusterEndpoints: 9 | publicAccess: true 10 | privateAccess: false 11 | 12 | managedNodeGroups: 13 | - name: managed-ng-ddosify-k8s-test-blog 14 | amiFamily: "AmazonLinux2" 15 | instanceType: c5.large 16 | minSize: 1 17 | maxSize: 3 18 | desiredCapacity: 2 19 | volumeSize: 30 20 | iam: 21 | attachPolicyARNs: 22 | - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy 23 | - arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy 24 | - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly 25 | withAddonPolicies: 26 | ebs: true 27 | addons: 28 | - name: vpc-cni 29 | serviceAccountRoleARN: arn:aws:iam::aws:policy/AmazonEKSCNIAccess 30 | - name: aws-ebs-csi-driver 31 | serviceAccountRoleARN: arn:aws:iam::aws:policy/AmazonEKS_CSI_Driver 32 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/program/go.mod: -------------------------------------------------------------------------------- 1 | module p 2 | 3 | go 1.20 4 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/program/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/rand" 6 | "time" 7 | ) 8 | 9 | //go:noinline 10 | func Greet(name string) { 11 | fmt.Println("Hello, " + name) 12 | } 13 | 14 | func main() { 15 | names := []string{"Mauro", "Lucas", "Kerem"} 16 | tick := time.Tick(1 * time.Second) 17 | 18 | for range tick { 19 | Greet(names[rand.Intn(len(names))]) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/program/p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/007_exploring-function-tracing-with-ebpf-and-uprobes-part1/program/p -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/README: -------------------------------------------------------------------------------- 1 | 2 | > clang -target bpf -O2 -g -o tracker.o -c bpf.c -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/bpf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ctx.h" 4 | 5 | char __license[] SEC("license") = "Dual MIT/GPL"; 6 | 7 | #define GO_PARAM1(x) ((x)->ax) 8 | #define GO_PARAM2(x) ((x)->bx) 9 | #define GO_PARAM3(x) ((x)->cx) 10 | 11 | struct greet_event { 12 | char param[6]; 13 | }; 14 | 15 | struct { 16 | __uint(type, BPF_MAP_TYPE_RINGBUF); 17 | __uint(max_entries, 256 * 1024); 18 | } greet_params SEC(".maps"); 19 | 20 | SEC("uprobe/go_test_greet") 21 | int BPF_UPROBE(go_test_greet) { 22 | struct greet_event *e; 23 | 24 | /* reserve sample from BPF ringbuf */ 25 | e = bpf_ringbuf_reserve(&greet_params, sizeof(*e), 0); 26 | if (!e) 27 | return 0; 28 | 29 | /* fill in event data */ 30 | bpf_probe_read_str(&e->param, sizeof(e->param), (void*)GO_PARAM1(ctx)); 31 | 32 | bpf_ringbuf_submit(e, 0); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/ctx.h: -------------------------------------------------------------------------------- 1 | struct pt_regs { 2 | long unsigned int r15; 3 | long unsigned int r14; 4 | long unsigned int r13; 5 | long unsigned int r12; 6 | long unsigned int bp; 7 | long unsigned int bx; 8 | long unsigned int r11; 9 | long unsigned int r10; 10 | long unsigned int r9; 11 | long unsigned int r8; 12 | long unsigned int ax; 13 | long unsigned int cx; 14 | long unsigned int dx; 15 | long unsigned int si; 16 | long unsigned int di; 17 | long unsigned int orig_ax; 18 | long unsigned int ip; 19 | long unsigned int cs; 20 | long unsigned int flags; 21 | long unsigned int sp; 22 | long unsigned int ss; 23 | }; -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/go.mod: -------------------------------------------------------------------------------- 1 | module t 2 | 3 | go 1.20 4 | 5 | require github.com/cilium/ebpf v0.12.3 6 | 7 | require ( 8 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect 9 | golang.org/x/sys v0.14.1-0.20231108175955-e4099bfacb8c // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/go.sum: -------------------------------------------------------------------------------- 1 | github.com/cilium/ebpf v0.12.3 h1:8ht6F9MquybnY97at+VDZb3eQQr8ev79RueWeVaEcG4= 2 | github.com/cilium/ebpf v0.12.3/go.mod h1:TctK1ivibvI3znr66ljgi4hqOT8EYQjz1KWBfb1UVgM= 3 | github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA= 4 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 5 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 6 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 7 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= 8 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= 9 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= 10 | golang.org/x/sys v0.14.1-0.20231108175955-e4099bfacb8c h1:3kC/TjQ+xzIblQv39bCOyRk8fbEeJcDHwbyxPUU2BpA= 11 | golang.org/x/sys v0.14.1-0.20231108175955-e4099bfacb8c/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 12 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "debug/elf" 5 | "log" 6 | "unsafe" 7 | 8 | "github.com/cilium/ebpf" 9 | "github.com/cilium/ebpf/link" 10 | "github.com/cilium/ebpf/ringbuf" 11 | "github.com/cilium/ebpf/rlimit" 12 | ) 13 | 14 | const SymbolName = "main.Greet" 15 | 16 | type GreetEvent struct { 17 | Msg [6]byte 18 | } 19 | 20 | func main() { 21 | if err := rlimit.RemoveMemlock(); err != nil { 22 | log.Fatal(err) 23 | } 24 | 25 | path := "../program/p" 26 | // open in elf format in order to get the symbols 27 | ef, err := elf.Open(path) 28 | if err != nil { 29 | log.Fatal(err) 30 | } 31 | defer ef.Close() 32 | 33 | ex, err := link.OpenExecutable(path) 34 | if err != nil { 35 | log.Fatal(err) 36 | } 37 | 38 | coll, err := ebpf.LoadCollection("tracker.o") 39 | if err != nil { 40 | log.Fatal(err) 41 | } 42 | 43 | greetEvents, err := ringbuf.NewReader(coll.Maps["greet_params"]) 44 | if err != nil { 45 | log.Fatal(err) 46 | } 47 | 48 | go func() { 49 | countMap := map[string]uint64{} 50 | for { 51 | event, err := greetEvents.Read() 52 | if err != nil { 53 | log.Fatal(err) 54 | } 55 | greetEvent := (*GreetEvent)(unsafe.Pointer(&event.RawSample[0])) 56 | countMap[string(greetEvent.Msg[:])]++ 57 | log.Printf("COUNT: %v", countMap) 58 | } 59 | }() 60 | 61 | _, err = ex.Uprobe(SymbolName, coll.Programs["go_test_greet"], &link.UprobeOptions{}) 62 | if err != nil { 63 | log.Fatal(err) 64 | } 65 | 66 | for { 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/tracker.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/007_exploring-function-tracing-with-ebpf-and-uprobes-part1/tracker/tracker.o -------------------------------------------------------------------------------- /009_kubernetes_hpa/sample_application.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: testserver 5 | labels: 6 | name: testserver 7 | --- 8 | apiVersion: apps/v1 9 | kind: Deployment 10 | metadata: 11 | name: testserver-deployment 12 | namespace: testserver 13 | labels: 14 | app: testserver 15 | spec: 16 | replicas: 1 17 | selector: 18 | matchLabels: 19 | app: testserver 20 | template: 21 | metadata: 22 | labels: 23 | app: testserver 24 | spec: 25 | containers: 26 | - name: testserver 27 | image: ddosify/djangotestapp:kubernetes-autoscaler-blog 28 | command: ["/workspace/start_scripts/start_app.sh"] 29 | imagePullPolicy: Always 30 | ports: 31 | - containerPort: 8200 32 | resources: 33 | requests: 34 | memory: "256Mi" 35 | cpu: "250m" 36 | limits: 37 | memory: "2048Mi" 38 | cpu: "2000m" 39 | --- 40 | apiVersion: v1 41 | kind: Service 42 | metadata: 43 | name: testserver-service 44 | namespace: testserver 45 | spec: 46 | selector: 47 | app: testserver 48 | ports: 49 | - protocol: TCP 50 | port: 8200 51 | targetPort: 8200 52 | type: LoadBalancer -------------------------------------------------------------------------------- /010_postgres_observability/README.md: -------------------------------------------------------------------------------- 1 | # PostgresQL eBPF 2 | 3 | This is a demo code, for showcasing Observability of the PostgreSQL protocol using eBPF. This code is inspired by Alaz, Kubernetes eBPF agent, developed by Anteon. 4 | 5 | postgres 6 | 7 | In order to try it out locally: 8 | 9 | - Run eBPF program using 10 | ``` 11 | go generate 12 | go build 13 | sudo ./postgres 14 | ``` 15 | - Run the PostgresQL Container using 16 | ``` 17 | docker run --name my-postgres-container -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 --memory=4g --cpus=4 -v ./postgresql.conf:/etc/postgresql/postgresql.conf -e POSTGRES_CONFIG_FILE=/etc/postgresql/postgresql.conf postgres 18 | ``` 19 | - Run client inside `/test` using 20 | ``` 21 | go run client.go 22 | ``` 23 | - In another shell, inspect eBPF program logs using 24 | ``` 25 | sudo cat /sys/kernel/debug/tracing/trace_pipe 26 | ``` 27 | -------------------------------------------------------------------------------- /010_postgres_observability/go.mod: -------------------------------------------------------------------------------- 1 | module postgres 2 | 3 | go 1.22.4 4 | 5 | require github.com/cilium/ebpf v0.15.0 6 | 7 | require ( 8 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect 9 | golang.org/x/sys v0.15.0 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /010_postgres_observability/go.sum: -------------------------------------------------------------------------------- 1 | github.com/cilium/ebpf v0.15.0 h1:7NxJhNiBT3NG8pZJ3c+yfrVdHY8ScgKD27sScgjLMMk= 2 | github.com/cilium/ebpf v0.15.0/go.mod h1:DHp1WyrLeiBh19Cf/tfiSMhqheEiK8fXFZ4No0P1Hso= 3 | github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= 4 | github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= 5 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 6 | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 7 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 8 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 9 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 10 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 11 | github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= 12 | github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= 13 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= 14 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= 15 | golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= 16 | golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 17 | -------------------------------------------------------------------------------- /010_postgres_observability/images/postgres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/010_postgres_observability/images/postgres.png -------------------------------------------------------------------------------- /010_postgres_observability/perf/go.mod: -------------------------------------------------------------------------------- 1 | module perf-postgres 2 | 3 | go 1.22.4 4 | 5 | require github.com/lib/pq v1.10.9 6 | -------------------------------------------------------------------------------- /010_postgres_observability/perf/go.sum: -------------------------------------------------------------------------------- 1 | github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= 2 | github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 3 | -------------------------------------------------------------------------------- /010_postgres_observability/perf/plot.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | 3 | # Latency values in milliseconds 4 | operations = ['INSERT', 'UPDATE', 'DELETE', 'QUERY'] 5 | latency_with_ebpf = [1.1720, 1.2338, 1.2062, 0.33706] 6 | latency_without_ebpf = [1.1410, 1.2014, 1.1550, 0.3175] 7 | 8 | x = range(len(operations)) 9 | 10 | # Create the plot 11 | fig, ax = plt.subplots() 12 | 13 | # Plotting the values 14 | ax.bar(x, latency_with_ebpf, width=0.4, label='With eBPF', align='center') 15 | ax.bar(x, latency_without_ebpf, width=0.4, label='Without eBPF', align='edge') 16 | 17 | # Adding labels and title 18 | ax.set_xlabel('Operation') 19 | ax.set_ylabel('Latency (ms)') 20 | ax.set_title('PostgreSQL Latency Comparison with and without eBPF') 21 | ax.set_xticks(x) 22 | ax.set_xticklabels(operations) 23 | ax.legend() 24 | 25 | # Display the plot 26 | plt.tight_layout() 27 | plt.show() 28 | -------------------------------------------------------------------------------- /010_postgres_observability/perf/postgresql.conf: -------------------------------------------------------------------------------- 1 | # PostgreSQL configuration file - postgresql.conf 2 | 3 | shared_buffers = 1GB # recommended: 25% of total memory 4 | effective_cache_size = 3GB # recommended: 75% of total memory 5 | work_mem = 64MB # recommended: 2-4MB per CPU core 6 | maintenance_work_mem = 512MB # recommended: 10% of total memory 7 | -------------------------------------------------------------------------------- /010_postgres_observability/test/go.mod: -------------------------------------------------------------------------------- 1 | module pg-client 2 | 3 | go 1.22.4 4 | 5 | require github.com/lib/pq v1.10.9 6 | -------------------------------------------------------------------------------- /010_postgres_observability/test/go.sum: -------------------------------------------------------------------------------- 1 | github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= 2 | github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | indent_style = space 9 | 10 | [*.{java,xml}] 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/.gitignore: -------------------------------------------------------------------------------- 1 | # Maven 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | # Jenv 6 | .java-version 7 | 8 | # Eclipse 9 | .settings/ 10 | .classpath 11 | .project 12 | 13 | # IntelliJ IDEA 14 | .idea 15 | *.iml 16 | 17 | # Branch switching 18 | generated/ 19 | 20 | #VS Code 21 | .factorypath 22 | .project 23 | 24 | # Terraform 25 | **/.terraform/ 26 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.4/maven-wrapper-0.5.4.jar 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2002-2017 the original author or authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/README.md: -------------------------------------------------------------------------------- 1 | # eks-monitoring-with-anteon 2 | For EKS monitoring with Anteon article series 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | VOLUME /tmp 3 | ARG DOCKERIZE_VERSION 4 | ARG ARTIFACT_NAME 5 | ARG EXPOSED_PORT 6 | ENV SPRING_PROFILES_ACTIVE docker 7 | 8 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 9 | RUN tar xzf dockerize.tar.gz 10 | RUN chmod +x dockerize 11 | ADD ${ARTIFACT_NAME}.jar /app.jar 12 | RUN touch /app.jar 13 | EXPOSE ${EXPOSED_PORT} 14 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 15 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/grafana/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grafana/grafana 2 | ADD ./provisioning /etc/grafana/provisioning 3 | ADD ./grafana.ini /etc/grafana/grafana.ini 4 | ADD ./dashboards /var/lib/grafana/dashboards 5 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/grafana/grafana.ini: -------------------------------------------------------------------------------- 1 | ##################### Spring Petclinic Microservices Grafana Configuration ##################### 2 | 3 | # possible values : production, development 4 | app_mode = development 5 | 6 | #################################### Paths #################################### 7 | [paths] 8 | # folder that contains provisioning config files that grafana will apply on startup and while running. 9 | provisioning = /etc/grafana/provisioning 10 | 11 | #################################### Server #################################### 12 | [server] 13 | # enable gzip 14 | enable_gzip = true 15 | 16 | #################################### Anonymous Auth ########################## 17 | # Anonymous authentication has been enabled in the Petclinic sample with Admin role 18 | # Do not do that in Production environment 19 | [auth.anonymous] 20 | # enable anonymous access 21 | enabled = true 22 | 23 | # specify organization name that should be used for unauthenticated users 24 | org_name = Main Org. 25 | 26 | # specify role for unauthenticated users 27 | org_role = Admin 28 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/grafana/provisioning/dashboards/all.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'default' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards 10 | options: 11 | path: /var/lib/grafana/dashboards 12 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/grafana/provisioning/datasources/all.yml: -------------------------------------------------------------------------------- 1 | # config file version 2 | apiVersion: 1 3 | 4 | # list of datasources to insert/update depending what's available in the database 5 | datasources: 6 | - name: Prometheus 7 | type: prometheus 8 | access: proxy 9 | org_id: 1 10 | url: http://prometheus-server:9090 11 | is_default: true 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/prometheus/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM prom/prometheus:v2.4.2 2 | ADD prometheus.yml /etc/prometheus/ 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docker/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | # my global config 2 | global: 3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. 4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. 5 | # scrape_timeout is set to the global default (10s). 6 | 7 | # A scrape configuration containing exactly one endpoint to scrape: 8 | # Here it's Prometheus itself. 9 | scrape_configs: 10 | - job_name: prometheus 11 | static_configs: 12 | - targets: ['localhost:9090'] 13 | 14 | - job_name: api-gateway 15 | metrics_path: /actuator/prometheus 16 | static_configs: 17 | - targets: ['api-gateway:8080'] 18 | 19 | - job_name: customers-service 20 | metrics_path: /actuator/prometheus 21 | static_configs: 22 | - targets: ['customers-service:8081'] 23 | 24 | - job_name: visits-service 25 | metrics_path: /actuator/prometheus 26 | static_configs: 27 | - targets: ['visits-service:8082'] 28 | 29 | - job_name: vets-service 30 | metrics_path: /actuator/prometheus 31 | static_configs: 32 | - targets: ['vets-service:8083'] 33 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docs/application-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/docs/application-screenshot.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docs/grafana-custom-metrics-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/docs/grafana-custom-metrics-dashboard.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/docs/microservices-architecture-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/docs/microservices-architecture-diagram.jpg -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/jenkins/build-prod-docker-images-for-ecr.sh: -------------------------------------------------------------------------------- 1 | docker build --force-rm -t "${IMAGE_TAG_ADMIN_SERVER}" "${WORKSPACE}/spring-petclinic-admin-server" 2 | docker build --force-rm -t "${IMAGE_TAG_API_GATEWAY}" "${WORKSPACE}/spring-petclinic-api-gateway" 3 | docker build --force-rm -t "${IMAGE_TAG_CONFIG_SERVER}" "${WORKSPACE}/spring-petclinic-config-server" 4 | docker build --force-rm -t "${IMAGE_TAG_CUSTOMERS_SERVICE}" "${WORKSPACE}/spring-petclinic-customers-service" 5 | docker build --force-rm -t "${IMAGE_TAG_DISCOVERY_SERVER}" "${WORKSPACE}/spring-petclinic-discovery-server" 6 | docker build --force-rm -t "${IMAGE_TAG_HYSTRIX_DASHBOARD}" "${WORKSPACE}/spring-petclinic-hystrix-dashboard" 7 | docker build --force-rm -t "${IMAGE_TAG_VETS_SERVICE}" "${WORKSPACE}/spring-petclinic-vets-service" 8 | docker build --force-rm -t "${IMAGE_TAG_VISITS_SERVICE}" "${WORKSPACE}/spring-petclinic-visits-service" 9 | docker build --force-rm -t "${IMAGE_TAG_GRAFANA_SERVICE}" "${WORKSPACE}/docker/grafana" 10 | docker build --force-rm -t "${IMAGE_TAG_PROMETHEUS_SERVICE}" "${WORKSPACE}/docker/prometheus" -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/jenkins/deploy_app_on_prod_environment.sh: -------------------------------------------------------------------------------- 1 | echo 'Deploying App on Kubernetes' 2 | envsubst < k8s/petclinic_chart/values-template.yaml > k8s/petclinic_chart/values.yaml 3 | sed -i s/HELM_VERSION/${BUILD_NUMBER}/ k8s/petclinic_chart/Chart.yaml 4 | AWS_REGION=$AWS_REGION helm repo add stable-petclinic s3://microservices-app-helm-charts/stable/myapp/ || echo "repository name already exists" 5 | AWS_REGION=$AWS_REGION helm repo update 6 | helm package k8s/petclinic_chart 7 | AWS_REGION=$AWS_REGION helm s3 push --force petclinic_chart-${BUILD_NUMBER}.tgz stable-petclinic 8 | kubectl create ns petclinic-prod-ns || echo "namespace petclinic-prod-ns already exists" 9 | kubectl delete secret regcred -n petclinic-prod-ns || echo "there is no regcred secret in petclinic-prod-ns namespace" 10 | kubectl create secret generic regcred -n petclinic-prod-ns --from-file=.dockerconfigjson=/var/lib/jenkins/.docker/config.json --type=kubernetes.io/dockerconfigjson 11 | AWS_REGION=$AWS_REGION helm repo update 12 | AWS_REGION=$AWS_REGION helm upgrade --install petclinic-app-release stable-petclinic/petclinic_chart --version ${BUILD_NUMBER} --namespace petclinic-prod-ns -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/jenkins/package-with-maven-container.sh: -------------------------------------------------------------------------------- 1 | docker run --rm -v $HOME/.m2:/root/.m2 -v $WORKSPACE:/app -w /app maven:3.6-openjdk-11 mvn clean package -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/jenkins/prepare-tags-ecr-for-production-docker-images.sh: -------------------------------------------------------------------------------- 1 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-admin-server/target/maven-archiver/pom.properties && echo $version) 2 | export IMAGE_TAG_ADMIN_SERVER="${ECR_REGISTRY}/${APP_REPO_NAME}:admin-server-v${MVN_VERSION}-b${BUILD_NUMBER}" 3 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-api-gateway/target/maven-archiver/pom.properties && echo $version) 4 | export IMAGE_TAG_API_GATEWAY="${ECR_REGISTRY}/${APP_REPO_NAME}:api-gateway-v${MVN_VERSION}-b${BUILD_NUMBER}" 5 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-config-server/target/maven-archiver/pom.properties && echo $version) 6 | export IMAGE_TAG_CONFIG_SERVER="${ECR_REGISTRY}/${APP_REPO_NAME}:config-server-v${MVN_VERSION}-b${BUILD_NUMBER}" 7 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-customers-service/target/maven-archiver/pom.properties && echo $version) 8 | export IMAGE_TAG_CUSTOMERS_SERVICE="${ECR_REGISTRY}/${APP_REPO_NAME}:customers-service-v${MVN_VERSION}-b${BUILD_NUMBER}" 9 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-discovery-server/target/maven-archiver/pom.properties && echo $version) 10 | export IMAGE_TAG_DISCOVERY_SERVER="${ECR_REGISTRY}/${APP_REPO_NAME}:discovery-server-v${MVN_VERSION}-b${BUILD_NUMBER}" 11 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-hystrix-dashboard/target/maven-archiver/pom.properties && echo $version) 12 | export IMAGE_TAG_HYSTRIX_DASHBOARD="${ECR_REGISTRY}/${APP_REPO_NAME}:hystrix-dashboard-v${MVN_VERSION}-b${BUILD_NUMBER}" 13 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-vets-service/target/maven-archiver/pom.properties && echo $version) 14 | export IMAGE_TAG_VETS_SERVICE="${ECR_REGISTRY}/${APP_REPO_NAME}:vets-service-v${MVN_VERSION}-b${BUILD_NUMBER}" 15 | MVN_VERSION=$(. ${WORKSPACE}/spring-petclinic-visits-service/target/maven-archiver/pom.properties && echo $version) 16 | export IMAGE_TAG_VISITS_SERVICE="${ECR_REGISTRY}/${APP_REPO_NAME}:visits-service-v${MVN_VERSION}-b${BUILD_NUMBER}" 17 | export IMAGE_TAG_GRAFANA_SERVICE="${ECR_REGISTRY}/${APP_REPO_NAME}:grafana-service" 18 | export IMAGE_TAG_PROMETHEUS_SERVICE="${ECR_REGISTRY}/${APP_REPO_NAME}:prometheus-service" -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/jenkins/push-prod-docker-images-to-ecr.sh: -------------------------------------------------------------------------------- 1 | aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${ECR_REGISTRY} 2 | docker push "${IMAGE_TAG_ADMIN_SERVER}" 3 | docker push "${IMAGE_TAG_API_GATEWAY}" 4 | docker push "${IMAGE_TAG_CONFIG_SERVER}" 5 | docker push "${IMAGE_TAG_CUSTOMERS_SERVICE}" 6 | docker push "${IMAGE_TAG_DISCOVERY_SERVER}" 7 | docker push "${IMAGE_TAG_HYSTRIX_DASHBOARD}" 8 | docker push "${IMAGE_TAG_VETS_SERVICE}" 9 | docker push "${IMAGE_TAG_VISITS_SERVICE}" 10 | docker push "${IMAGE_TAG_GRAFANA_SERVICE}" 11 | docker push "${IMAGE_TAG_PROMETHEUS_SERVICE}" -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/cluster.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: eksctl.io/v1alpha5 2 | kind: ClusterConfig 3 | 4 | metadata: 5 | name: vet-clinic-cluster 6 | region: us-east-1 7 | availabilityZones: ["us-east-1a", "us-east-1b", "us-east-1c"] 8 | managedNodeGroups: 9 | - name: ng-1 10 | instanceType: t3a.medium 11 | desiredCapacity: 2 12 | minSize: 2 13 | maxSize: 3 14 | volumeSize: 8 -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart-0.0.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart-0.0.1.tgz -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: petclinic_chart 3 | description: A Helm chart for Kubernetes 4 | 5 | # A chart can be either an 'application' or a 'library' chart. 6 | # 7 | # Application charts are a collection of templates that can be packaged into versioned archives 8 | # to be deployed. 9 | # 10 | # Library charts provide useful utilities or functions for the chart developer. They're included as 11 | # a dependency of application charts to inject those utilities and functions into the rendering 12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 13 | type: application 14 | 15 | # This is the chart version. This version number should be incremented each time you make changes 16 | # to the chart and its templates, including the app version. 17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 18 | version: HELM_VERSION 19 | 20 | # This is the version number of the application being deployed. This version number should be 21 | # incremented each time you make changes to the application. Versions are not expected to 22 | # follow Semantic Versioning. They should reflect the version the application is using. 23 | # It is recommended to use it with quotes. 24 | appVersion: "0.1.0" 25 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/admin-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: admin-server 11 | name: admin-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: admin-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: admin-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_ADMIN_SERVER }}' 30 | name: admin-server 31 | ports: 32 | - containerPort: 9090 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/admin-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: admin-server 11 | name: admin-server 12 | spec: 13 | ports: 14 | - name: "9090" 15 | port: 9090 16 | targetPort: 9090 17 | selector: 18 | io.kompose.service: admin-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/api-gateway-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 8 | kompose.service.nodeport.port: "30001" 9 | kompose.service.type: nodeport 10 | kompose.version: 1.26.1 (a9d05d509) 11 | creationTimestamp: null 12 | labels: 13 | io.kompose.service: api-gateway 14 | name: api-gateway 15 | spec: 16 | replicas: 1 17 | selector: 18 | matchLabels: 19 | io.kompose.service: api-gateway 20 | strategy: {} 21 | template: 22 | metadata: 23 | annotations: 24 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 25 | kompose.image-pull-secret: regcred 26 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 27 | kompose.service.nodeport.port: "30001" 28 | kompose.service.type: nodeport 29 | kompose.version: 1.26.1 (a9d05d509) 30 | creationTimestamp: null 31 | labels: 32 | io.kompose.service: api-gateway 33 | spec: 34 | containers: 35 | - image: '{{ .Values.IMAGE_TAG_API_GATEWAY }}' 36 | name: api-gateway 37 | ports: 38 | - containerPort: 8080 39 | resources: {} 40 | initContainers: 41 | - name: init-discovery-server 42 | image: busybox 43 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 44 | imagePullSecrets: 45 | - name: regcred 46 | restartPolicy: Always 47 | status: {} 48 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/api-gateway-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 8 | kompose.service.nodeport.port: "30001" 9 | kompose.service.type: nodeport 10 | kompose.version: 1.26.1 (a9d05d509) 11 | creationTimestamp: null 12 | labels: 13 | io.kompose.service: api-gateway 14 | name: api-gateway 15 | spec: 16 | ingressClassName: nginx 17 | rules: 18 | - host: '{{ .Values.DNS_NAME }}' 19 | http: 20 | paths: 21 | - backend: 22 | service: 23 | name: api-gateway 24 | port: 25 | number: 8080 26 | path: / 27 | pathType: Prefix 28 | status: 29 | loadBalancer: {} 30 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/api-gateway-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 8 | kompose.service.nodeport.port: "30001" 9 | kompose.service.type: nodeport 10 | kompose.version: 1.26.1 (a9d05d509) 11 | creationTimestamp: null 12 | labels: 13 | io.kompose.service: api-gateway 14 | name: api-gateway 15 | spec: 16 | ports: 17 | - name: "8080" 18 | nodePort: 30001 19 | port: 8080 20 | targetPort: 8080 21 | selector: 22 | io.kompose.service: api-gateway 23 | type: NodePort 24 | status: 25 | loadBalancer: {} 26 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/config-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: config-server 11 | name: config-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: config-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: config-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_CONFIG_SERVER }}' 30 | name: config-server 31 | ports: 32 | - containerPort: 8888 33 | resources: {} 34 | imagePullSecrets: 35 | - name: regcred 36 | restartPolicy: Always 37 | status: {} 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/config-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: config-server 11 | name: config-server 12 | spec: 13 | ports: 14 | - name: "8888" 15 | port: 8888 16 | targetPort: 8888 17 | selector: 18 | io.kompose.service: config-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/customers-service-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: customers-service 11 | name: customers-service 12 | spec: 13 | replicas: 2 14 | selector: 15 | matchLabels: 16 | io.kompose.service: customers-service 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: customers-service 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_CUSTOMERS_SERVICE }}' 30 | name: customers-service 31 | ports: 32 | - containerPort: 8081 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/customers-service-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: customers-service 11 | name: customers-service 12 | spec: 13 | ports: 14 | - name: "8081" 15 | port: 8081 16 | targetPort: 8081 17 | selector: 18 | io.kompose.service: customers-service 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/discovery-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: discovery-server 11 | name: discovery-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: discovery-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: discovery-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_DISCOVERY_SERVER }}' 30 | name: discovery-server 31 | ports: 32 | - containerPort: 8761 33 | resources: {} 34 | initContainers: 35 | - name: init-config-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z config-server:8888; do echo waiting for config-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/discovery-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: discovery-server 11 | name: discovery-server 12 | spec: 13 | ports: 14 | - name: "8761" 15 | port: 8761 16 | targetPort: 8761 17 | selector: 18 | io.kompose.service: discovery-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/grafana-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: grafana-server 11 | name: grafana-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: grafana-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: grafana-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_GRAFANA_SERVICE }}' 30 | name: grafana-server 31 | ports: 32 | - containerPort: 3000 33 | resources: {} 34 | imagePullSecrets: 35 | - name: regcred 36 | restartPolicy: Always 37 | status: {} 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/grafana-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: grafana-server 11 | name: grafana-server 12 | spec: 13 | ports: 14 | - name: "3000" 15 | port: 3000 16 | targetPort: 3000 17 | selector: 18 | io.kompose.service: grafana-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/hystrix-dashboard-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: hystrix-dashboard 11 | name: hystrix-dashboard 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: hystrix-dashboard 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: hystrix-dashboard 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_HYSTRIX_DASHBOARD }}' 30 | name: hystrix-dashboard 31 | ports: 32 | - containerPort: 7979 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/hystrix-dashboard-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: hystrix-dashboard 11 | name: hystrix-dashboard 12 | spec: 13 | ports: 14 | - name: "7979" 15 | port: 7979 16 | targetPort: 7979 17 | selector: 18 | io.kompose.service: hystrix-dashboard 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/mysql-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose-local-db.yml 6 | kompose.version: 1.26.1 (a9d05d509) 7 | labels: 8 | io.kompose.service: mysql-server 9 | name: mysql-server 10 | spec: 11 | type: ExternalName 12 | externalName: petclinic.clua0w36hpqf.us-east-1.rds.amazonaws.com 13 | # Change this line with the endpoint of your RDS. -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/prometheus-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: prometheus-server 11 | name: prometheus-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: prometheus-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: prometheus-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_PROMETHEUS_SERVICE }}' 30 | name: prometheus-server 31 | ports: 32 | - containerPort: 9090 33 | resources: {} 34 | imagePullSecrets: 35 | - name: regcred 36 | restartPolicy: Always 37 | status: {} 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/prometheus-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: prometheus-server 11 | name: prometheus-server 12 | spec: 13 | ports: 14 | - name: "9091" 15 | port: 9091 16 | targetPort: 9090 17 | selector: 18 | io.kompose.service: prometheus-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/tracing-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.version: 1.26.1 (a9d05d509) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: tracing-server 10 | name: tracing-server 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | io.kompose.service: tracing-server 16 | strategy: {} 17 | template: 18 | metadata: 19 | annotations: 20 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 21 | kompose.version: 1.26.1 (a9d05d509) 22 | creationTimestamp: null 23 | labels: 24 | io.kompose.service: tracing-server 25 | spec: 26 | containers: 27 | - env: 28 | - name: JAVA_OPTS 29 | value: -XX:+UnlockExperimentalVMOptions -Djava.security.egd=file:/dev/./urandom 30 | image: openzipkin/zipkin 31 | name: tracing-server 32 | ports: 33 | - containerPort: 9411 34 | resources: {} 35 | restartPolicy: Always 36 | status: {} 37 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/tracing-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.version: 1.26.1 (a9d05d509) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: tracing-server 10 | name: tracing-server 11 | spec: 12 | ports: 13 | - name: "9411" 14 | port: 9411 15 | targetPort: 9411 16 | selector: 17 | io.kompose.service: tracing-server 18 | status: 19 | loadBalancer: {} 20 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/vets-service-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: vets-service 11 | name: vets-service 12 | spec: 13 | replicas: 2 14 | selector: 15 | matchLabels: 16 | io.kompose.service: vets-service 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: vets-service 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_VETS_SERVICE }}' 30 | name: vets-service 31 | ports: 32 | - containerPort: 8083 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/vets-service-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: vets-service 11 | name: vets-service 12 | spec: 13 | ports: 14 | - name: "8083" 15 | port: 8083 16 | targetPort: 8083 17 | selector: 18 | io.kompose.service: vets-service 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/visits-service-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: visits-service 11 | name: visits-service 12 | spec: 13 | replicas: 2 14 | selector: 15 | matchLabels: 16 | io.kompose.service: visits-service 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: visits-service 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_VISITS_SERVICE }}' 30 | name: visits-service 31 | ports: 32 | - containerPort: 8082 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/templates/visits-service-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: visits-service 11 | name: visits-service 12 | spec: 13 | ports: 14 | - name: "8082" 15 | port: 8082 16 | targetPort: 8082 17 | selector: 18 | io.kompose.service: visits-service 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/petclinic_chart/values-template.yaml: -------------------------------------------------------------------------------- 1 | IMAGE_TAG_CONFIG_SERVER: "${IMAGE_TAG_CONFIG_SERVER}" 2 | IMAGE_TAG_DISCOVERY_SERVER: "${IMAGE_TAG_DISCOVERY_SERVER}" 3 | IMAGE_TAG_CUSTOMERS_SERVICE: "${IMAGE_TAG_CUSTOMERS_SERVICE}" 4 | IMAGE_TAG_VISITS_SERVICE: "${IMAGE_TAG_VISITS_SERVICE}" 5 | IMAGE_TAG_VETS_SERVICE: "${IMAGE_TAG_VETS_SERVICE}" 6 | IMAGE_TAG_API_GATEWAY: "${IMAGE_TAG_API_GATEWAY}" 7 | IMAGE_TAG_ADMIN_SERVER: "${IMAGE_TAG_ADMIN_SERVER}" 8 | IMAGE_TAG_HYSTRIX_DASHBOARD: "${IMAGE_TAG_HYSTRIX_DASHBOARD}" 9 | IMAGE_TAG_GRAFANA_SERVICE: "${IMAGE_TAG_GRAFANA_SERVICE}" 10 | IMAGE_TAG_PROMETHEUS_SERVICE: "${IMAGE_TAG_PROMETHEUS_SERVICE}" 11 | DNS_NAME: "vetclinic.akkaya.link" -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/k8s/tls-cluster-issuer-prod.yml: -------------------------------------------------------------------------------- 1 | apiVersion: cert-manager.io/v1 2 | kind: ClusterIssuer 3 | metadata: 4 | name: letsencrypt-prod 5 | namespace: cert-manager 6 | spec: 7 | acme: 8 | # The ACME server URL 9 | server: https://acme-v02.api.letsencrypt.org/directory 10 | # Email address used for ACME registration 11 | email: akkaya3.aws@gmail.com 12 | # Name of a secret used to store the ACME account private key 13 | privateKeySecretRef: 14 | name: letsencrypt-prod 15 | # Enable the HTTP-01 challenge provider 16 | solvers: 17 | - http01: 18 | ingress: 19 | class: nginx -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-admin-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=9090 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-admin-server/src/main/java/org/springframework/samples/petclinic/admin/SpringBootAdminApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.admin; 17 | 18 | import de.codecentric.boot.admin.server.config.EnableAdminServer; 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | 23 | @SpringBootApplication 24 | @EnableAdminServer 25 | @EnableDiscoveryClient 26 | public class SpringBootAdminApplication { 27 | public static void main(String[] args) { 28 | SpringApplication.run(SpringBootAdminApplication.class, args); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-admin-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: admin-server 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-admin-server/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=8080 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/ApiGatewayApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | import org.springframework.cloud.client.loadbalancer.LoadBalanced; 23 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 24 | import org.springframework.context.annotation.Bean; 25 | import org.springframework.web.client.RestTemplate; 26 | 27 | /** 28 | * @author Maciej Szarlinski 29 | */ 30 | @EnableZuulProxy 31 | @EnableDiscoveryClient 32 | @EnableCircuitBreaker 33 | @SpringBootApplication 34 | public class ApiGatewayApplication { 35 | 36 | public static void main(String[] args) { 37 | SpringApplication.run(ApiGatewayApplication.class, args); 38 | } 39 | 40 | @Bean 41 | @LoadBalanced 42 | RestTemplate loadBalancedRestTemplate() { 43 | return new RestTemplate(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/CustomersServiceClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api.application; 17 | 18 | import lombok.RequiredArgsConstructor; 19 | import org.springframework.samples.petclinic.api.dto.OwnerDetails; 20 | import org.springframework.stereotype.Component; 21 | import org.springframework.web.client.RestTemplate; 22 | 23 | /** 24 | * @author Maciej Szarlinski 25 | */ 26 | @Component 27 | @RequiredArgsConstructor 28 | public class CustomersServiceClient { 29 | 30 | private final RestTemplate loadBalancedRestTemplate; 31 | 32 | public OwnerDetails getOwner(final int ownerId) { 33 | return loadBalancedRestTemplate.getForObject("http://customers-service/owners/{ownerId}", OwnerDetails.class, ownerId); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/OwnerDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import com.fasterxml.jackson.annotation.JsonIgnore; 19 | import lombok.Data; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import static java.util.stream.Collectors.toList; 25 | 26 | /** 27 | * @author Maciej Szarlinski 28 | */ 29 | @Data 30 | public class OwnerDetails { 31 | 32 | private int id; 33 | 34 | private String firstName; 35 | 36 | private String lastName; 37 | 38 | private String address; 39 | 40 | private String city; 41 | 42 | private String telephone; 43 | 44 | private final List pets = new ArrayList<>(); 45 | 46 | @JsonIgnore 47 | public List getPetIds() { 48 | return pets.stream() 49 | .map(PetDetails::getId) 50 | .collect(toList()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/PetDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | /** 24 | * @author Maciej Szarlinski 25 | */ 26 | @Data 27 | public class PetDetails { 28 | 29 | private int id; 30 | 31 | private String name; 32 | 33 | private String birthDate; 34 | 35 | private PetType type; 36 | 37 | private final List visits = new ArrayList<>(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/PetType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.Data; 19 | 20 | /** 21 | * @author Maciej Szarlinski 22 | */ 23 | @Data 24 | public class PetType { 25 | 26 | private String name; 27 | } 28 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/VisitDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.NoArgsConstructor; 19 | import lombok.Value; 20 | 21 | /** 22 | * @author Maciej Szarlinski 23 | */ 24 | @Value 25 | @NoArgsConstructor 26 | public class VisitDetails { 27 | 28 | private Integer id = null; 29 | 30 | private Integer petId = null; 31 | 32 | private String date = null; 33 | 34 | private String description = null; 35 | } 36 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/Visits.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import java.util.List; 19 | 20 | import lombok.NoArgsConstructor; 21 | import lombok.Value; 22 | 23 | /** 24 | * @author Maciej Szarlinski 25 | */ 26 | @Value 27 | @NoArgsConstructor 28 | public class Visits { 29 | 30 | private List items = null; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/less/header.less: -------------------------------------------------------------------------------- 1 | .navbar { 2 | border-top: 4px solid #6db33f; 3 | background-color: #34302d; 4 | margin-bottom: 0px; 5 | border-bottom: 0; 6 | border-left: 0; 7 | border-right: 0; 8 | } 9 | 10 | .navbar a.navbar-brand { 11 | background: url("../images/spring-logo-dataflow.png") -1px -1px no-repeat; 12 | margin: 12px 0 6px; 13 | width: 229px; 14 | height: 46px; 15 | display: inline-block; 16 | text-decoration: none; 17 | padding: 0; 18 | } 19 | 20 | .navbar a.navbar-brand span { 21 | display: block; 22 | width: 229px; 23 | height: 46px; 24 | background: url("../images/spring-logo-dataflow.png") -1px -48px no-repeat; 25 | opacity: 0; 26 | -moz-transition: opacity 0.12s ease-in-out; 27 | -webkit-transition: opacity 0.12s ease-in-out; 28 | -o-transition: opacity 0.12s ease-in-out; 29 | } 30 | 31 | .navbar a:hover.navbar-brand span { 32 | opacity: 1; 33 | } 34 | 35 | .navbar li > a, .navbar-text { 36 | font-family: "montserratregular", sans-serif; 37 | text-shadow: none; 38 | font-size: 14px; 39 | 40 | /* line-height: 14px; */ 41 | padding: 28px 20px; 42 | transition: all 0.15s; 43 | -webkit-transition: all 0.15s; 44 | -moz-transition: all 0.15s; 45 | -o-transition: all 0.15s; 46 | -ms-transition: all 0.15s; 47 | } 48 | 49 | .navbar li > a { 50 | text-transform: uppercase; 51 | } 52 | 53 | .navbar .navbar-text { 54 | margin-top: 0; 55 | margin-bottom: 0; 56 | } 57 | .navbar li:hover > a { 58 | color: #eeeeee; 59 | background-color: #6db33f; 60 | } 61 | 62 | .navbar-toggle { 63 | border-width: 0; 64 | 65 | .icon-bar + .icon-bar { 66 | margin-top: 3px; 67 | } 68 | .icon-bar { 69 | width: 19px; 70 | height: 3px; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/less/responsive.less: -------------------------------------------------------------------------------- 1 | @media (max-width: 768px) { 2 | .navbar-toggle { 3 | position:absolute; 4 | z-index: 9999; 5 | left:0px; 6 | top:0px; 7 | } 8 | 9 | .navbar a.navbar-brand { 10 | display: block; 11 | margin: 0 auto 0 auto; 12 | width: 148px; 13 | height: 50px; 14 | float: none; 15 | background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat; 16 | } 17 | 18 | .homepage-billboard .homepage-subtitle { 19 | font-size: 21px; 20 | line-height: 21px; 21 | } 22 | 23 | .navbar a.navbar-brand span { 24 | display: none; 25 | } 26 | 27 | .navbar { 28 | border-top-width: 0; 29 | } 30 | 31 | .xd-container { 32 | margin-top: 20px; 33 | margin-bottom: 30px; 34 | } 35 | 36 | .index-page--subtitle { 37 | margin-top: 10px; 38 | margin-bottom: 30px; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/less/typography.less: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'varela_roundregular'; 3 | 4 | src: url('../fonts/varela_round-webfont.eot'); 5 | src: url('../fonts/varela_round-webfont.eot?#iefix') format('embedded-opentype'), 6 | url('../fonts/varela_round-webfont.woff') format('woff'), 7 | url('../fonts/varela_round-webfont.ttf') format('truetype'), 8 | url('../fonts/varela_round-webfont.svg#varela_roundregular') format('svg'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | 13 | @font-face { 14 | font-family: 'montserratregular'; 15 | src: url('../fonts/montserrat-webfont.eot'); 16 | src: url('../fonts/montserrat-webfont.eot?#iefix') format('embedded-opentype'), 17 | url('../fonts/montserrat-webfont.woff') format('woff'), 18 | url('../fonts/montserrat-webfont.ttf') format('truetype'), 19 | url('../fonts/montserrat-webfont.svg#montserratregular') format('svg'); 20 | font-weight: normal; 21 | font-style: normal; 22 | } 23 | 24 | body, h1, h2, h3, p, input { 25 | margin: 0; 26 | font-weight: 400; 27 | font-family: "varela_roundregular", sans-serif; 28 | color: #34302d; 29 | } 30 | 31 | h1 { 32 | font-size: 24px; 33 | line-height: 30px; 34 | font-family: "montserratregular", sans-serif; 35 | } 36 | 37 | h2 { 38 | font-size: 18px; 39 | font-weight: 700; 40 | line-height: 24px; 41 | margin-bottom: 10px; 42 | font-family: "montserratregular", sans-serif; 43 | } 44 | 45 | h3 { 46 | font-size: 16px; 47 | line-height: 24px; 48 | margin-bottom: 10px; 49 | font-weight: 700; 50 | } 51 | 52 | p { 53 | //font-size: 15px; 54 | //line-height: 24px; 55 | } 56 | 57 | strong { 58 | font-weight: 700; 59 | font-family: "montserratregular", sans-serif; 60 | } 61 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | zuul: 2 | prefix: /api 3 | ignoredServices: '*' 4 | routes: 5 | vets-service: /vet/** 6 | visits-service: /visit/** 7 | customers-service: /customer/** 8 | api-gateway: /gateway/** 9 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: api-gateway 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/messages/messages.properties: -------------------------------------------------------------------------------- 1 | required=is required 2 | notFound=has not been found 3 | duplicate=is already in use 4 | nonNumeric=must be all numeric 5 | duplicateFormSubmission=Duplicate form submission is not allowed 6 | typeMismatch.date=invalid date 7 | typeMismatch.birthDate=invalid date 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/messages/messages_de.properties: -------------------------------------------------------------------------------- 1 | required=muss angegeben werden 2 | notFound=wurde nicht gefunden 3 | duplicate=ist bereits vergeben 4 | nonNumeric=darf nur numerisch sein 5 | duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt 6 | typeMismatch.date=ung�ltiges Datum 7 | typeMismatch.birthDate=ung�ltiges Datum 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/messages/messages_en.properties: -------------------------------------------------------------------------------- 1 | # This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/favicon.ico -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/favicon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/favicon1.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/pets.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/pets1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/pets1.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/platform-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/platform-bg.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile1.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow1.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo1.png -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* App Module */ 3 | var petClinicApp = angular.module('petClinicApp', [ 4 | 'ui.router', 'layoutNav', 'layoutFooter', 'layoutWelcome', 5 | 'ownerList', 'ownerDetails', 'ownerForm', 'petForm', 'visits', 'vetList']); 6 | 7 | petClinicApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', function( 8 | $stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { 9 | 10 | // safari turns to be lazy sending the Cache-Control header 11 | $httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache'; 12 | 13 | $locationProvider.hashPrefix('!'); 14 | 15 | $urlRouterProvider.otherwise('/welcome'); 16 | $stateProvider 17 | .state('app', { 18 | abstract: true, 19 | url: '', 20 | template: '' 21 | }) 22 | .state('welcome', { 23 | parent: 'app', 24 | url: '/welcome', 25 | template: '' 26 | }); 27 | }]); 28 | 29 | ['welcome', 'nav', 'footer'].forEach(function(c) { 30 | var mod = 'layout' + c.toUpperCase().substring(0, 1) + c.substring(1); 31 | angular.module(mod, []); 32 | angular.module(mod).component(mod, { 33 | templateUrl: "scripts/fragments/" + c + ".html" 34 | }); 35 | }); -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/fragments/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Sponsored by Pivotal
5 |
6 |
-------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/fragments/welcome.html: -------------------------------------------------------------------------------- 1 |

Welcome to Petclinic

2 | 3 |
4 |
5 | pets logo 6 |
7 |
-------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .component('ownerDetails', { 5 | templateUrl: 'scripts/owner-details/owner-details.template.html', 6 | controller: 'OwnerDetailsController' 7 | }); 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { 5 | var self = this; 6 | 7 | $http.get('api/gateway/owners/' + $stateParams.ownerId).then(function (resp) { 8 | self.owner = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerDetails', { 7 | parent: 'app', 8 | url: '/owners/details/:ownerId', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .component('ownerForm', { 5 | templateUrl: 'scripts/owner-form/owner-form.template.html', 6 | controller: 'OwnerFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .controller('OwnerFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | var ownerId = $stateParams.ownerId || 0; 8 | 9 | if (!ownerId) { 10 | self.owner = {}; 11 | } else { 12 | $http.get("api/customer/owners/" + ownerId).then(function (resp) { 13 | self.owner = resp.data; 14 | }); 15 | } 16 | 17 | self.submitOwnerForm = function () { 18 | var id = self.owner.id; 19 | var req; 20 | if (id) { 21 | req = $http.put("api/customer/owners/" + id, self.owner); 22 | } else { 23 | req = $http.post("api/customer/owners", self.owner); 24 | } 25 | 26 | req.then(function () { 27 | $state.go('owners'); 28 | }, function (response) { 29 | var error = response.data; 30 | alert(error.error + "\r\n" + error.errors.map(function (e) { 31 | return e.field + ": " + e.defaultMessage; 32 | }).join("\r\n")); 33 | }); 34 | }; 35 | }]); 36 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerNew', { 7 | parent: 'app', 8 | url: '/owners/new', 9 | template: '' 10 | }) 11 | .state('ownerEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/edit', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.template.html: -------------------------------------------------------------------------------- 1 |

Owner

2 |
3 |
4 | 5 | 6 | First name is required. 7 |
8 | 9 |
10 | 11 | 12 | Last name is required. 13 |
14 | 15 | 16 |
17 | 18 | 19 | Address is required. 20 |
21 | 22 |
23 | 24 | 25 | City is required. 26 |
27 | 28 |
29 | 30 | 31 | Telephone is required. 32 |
33 | 34 |
35 | 36 |
37 |
38 | 39 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .component('ownerList', { 5 | templateUrl: 'scripts/owner-list/owner-list.template.html', 6 | controller: 'OwnerListController' 7 | }); 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .controller('OwnerListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get('api/customer/owners').then(function (resp) { 8 | self.owners = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('owners', { 7 | parent: 'app', 8 | url: '/owners', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.template.html: -------------------------------------------------------------------------------- 1 |

Owners

2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 |
NameCityTelephone
22 | 23 | {{owner.firstName}} {{owner.lastName}} 24 | 25 | {{owner.city}}{{owner.telephone}}
32 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm') 4 | .component('petForm', { 5 | templateUrl: 'scripts/pet-form/pet-form.template.html', 6 | controller: 'PetFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('petNew', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/new-pet', 9 | template: '' 10 | }) 11 | .state('petEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/pets/:petId', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.template.html: -------------------------------------------------------------------------------- 1 |

Pet

2 | 3 |
4 |
5 | 6 |
7 |

{{$ctrl.pet.owner}}

8 |
9 |
10 | 11 |
12 | 13 |
14 | 15 | Name is required. 16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | birth date is required. 24 |
25 |
26 | 27 |
28 | 29 |
30 | 33 |
34 |
35 | 36 |
37 |
38 | 41 |
42 |
43 |
44 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .component('vetList', { 5 | templateUrl: 'scripts/vet-list/vet-list.template.html', 6 | controller: 'VetListController' 7 | }); 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .controller('VetListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get('api/vet/vets').then(function (resp) { 8 | self.vetList = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('vets', { 7 | parent: 'app', 8 | url: '/vets', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.template.html: -------------------------------------------------------------------------------- 1 |

Veterinarians

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameSpecialties
{{vet.firstName}} {{vet.lastName}}{{specialty.name + ' '}}
16 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .component('visits', { 5 | templateUrl: 'scripts/visits/visits.template.html', 6 | controller: 'VisitsController' 7 | }); 8 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .controller('VisitsController', ['$http', '$state', '$stateParams', '$filter', function ($http, $state, $stateParams, $filter) { 5 | var self = this; 6 | var petId = $stateParams.petId || 0; 7 | var url = "api/visit/owners/" + ($stateParams.ownerId || 0) + "/pets/" + petId + "/visits"; 8 | self.date = new Date(); 9 | self.desc = ""; 10 | 11 | $http.get(url).then(function (resp) { 12 | self.visits = resp.data; 13 | }); 14 | 15 | self.submit = function () { 16 | var data = { 17 | date: $filter('date')(self.date, "yyyy-MM-dd"), 18 | description: self.desc 19 | }; 20 | 21 | $http.post(url, data).then(function () { 22 | $state.go("owners", { ownerId: $stateParams.ownerId }); 23 | }, function (response) { 24 | var error = response.data; 25 | alert(error.error + "\r\n" + error.errors.map(function (e) { 26 | return e.field + ": " + e.defaultMessage; 27 | }).join("\r\n")); 28 | }); 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('visits', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/pets/:petId/visits', 9 | template: '' 10 | }) 11 | }]); 12 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.template.html: -------------------------------------------------------------------------------- 1 |

Visits

2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | 12 | 13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 |

Previous Visits

22 | 23 | 24 | 25 | 26 | 27 |
{{v.date}}{{v.description}}
-------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/wro/wro.properties: -------------------------------------------------------------------------------- 1 | #List of preProcessors 2 | preProcessors=lessCssImport 3 | #List of postProcessors 4 | postProcessors=less4j -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/main/wro/wro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | classpath:META-INF/resources/webjars/bootstrap/3.3.7-1/less/bootstrap.less 4 | /petclinic.less 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/test/java/org/springframework/samples/petclinic/api/ApiGatewayApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.api; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | import org.springframework.test.context.ActiveProfiles; 6 | 7 | @ActiveProfiles("test") 8 | @SpringBootTest 9 | class ApiGatewayApplicationTests { 10 | 11 | @Test 12 | void contextLoads() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-api-gateway/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-config-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=8888 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-config-server/src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.config; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.config.server.EnableConfigServer; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @EnableConfigServer 26 | @SpringBootApplication 27 | public class ConfigServerApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(ConfigServerApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-config-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server.port: 8888 2 | spring: 3 | cloud: 4 | config: 5 | server: 6 | git: 7 | uri: https://github.com/james-clarusway/petclinic-microservices-configs.git 8 | --- 9 | spring: 10 | profiles: local 11 | cloud: 12 | config: 13 | server: 14 | git: 15 | uri: file:///${GIT_REPO} 16 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-config-server/src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.config; 17 | 18 | import org.junit.jupiter.api.Test; 19 | import org.springframework.boot.test.context.SpringBootTest; 20 | 21 | @SpringBootTest 22 | class PetclinicConfigServerApplicationTests { 23 | 24 | @Test 25 | void contextLoads() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=8081 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/CustomersServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @EnableDiscoveryClient 26 | @SpringBootApplication 27 | public class CustomersServiceApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(CustomersServiceApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/OwnerRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.model; 17 | 18 | import org.springframework.data.jpa.repository.JpaRepository; 19 | 20 | /** 21 | * Repository class for Owner domain objects All method names are compliant with Spring Data naming 22 | * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation 23 | * 24 | * @author Ken Krebs 25 | * @author Juergen Hoeller 26 | * @author Sam Brannen 27 | * @author Michael Isvy 28 | * @author Maciej Szarlinski 29 | */ 30 | public interface OwnerRepository extends JpaRepository { } 31 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/PetType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.model; 17 | 18 | import javax.persistence.Column; 19 | import javax.persistence.Entity; 20 | import javax.persistence.GeneratedValue; 21 | import javax.persistence.GenerationType; 22 | import javax.persistence.Id; 23 | import javax.persistence.Table; 24 | 25 | /** 26 | * @author Juergen Hoeller 27 | * Can be Cat, Dog, Hamster... 28 | */ 29 | @Entity 30 | @Table(name = "types") 31 | public class PetType { 32 | @Id 33 | @GeneratedValue(strategy = GenerationType.IDENTITY) 34 | private Integer id; 35 | 36 | @Column(name = "name") 37 | private String name; 38 | 39 | public Integer getId() { 40 | return id; 41 | } 42 | 43 | public void setId(final Integer id) { 44 | this.id = id; 45 | } 46 | 47 | public String getName() { 48 | return this.name; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import org.springframework.format.annotation.DateTimeFormat; 23 | import org.springframework.samples.petclinic.customers.model.Pet; 24 | import org.springframework.samples.petclinic.customers.model.PetType; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetDetails { 31 | 32 | private long id; 33 | 34 | private String name; 35 | 36 | private String owner; 37 | 38 | @DateTimeFormat(pattern = "yyyy-MM-dd") 39 | private Date birthDate; 40 | 41 | private PetType type; 42 | 43 | PetDetails(Pet pet) { 44 | this.id = pet.getId(); 45 | this.name = pet.getName(); 46 | this.owner = pet.getOwner().getFirstName() + " " + pet.getOwner().getLastName(); 47 | this.birthDate = pet.getBirthDate(); 48 | this.type = pet.getType(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import javax.validation.constraints.Size; 23 | 24 | import com.fasterxml.jackson.annotation.JsonFormat; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetRequest { 31 | private int id; 32 | 33 | @JsonFormat(pattern = "yyyy-MM-dd") 34 | private Date birthDate; 35 | 36 | @Size(min = 1) 37 | private String name; 38 | 39 | private int typeId; 40 | } 41 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.web; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 7 | public class ResourceNotFoundException extends RuntimeException { 8 | 9 | public ResourceNotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/resources/application.properties -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: customers-service 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/resources/db/hsqldb/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE pets IF EXISTS; 2 | DROP TABLE types IF EXISTS; 3 | DROP TABLE owners IF EXISTS; 4 | 5 | CREATE TABLE types ( 6 | id INTEGER IDENTITY PRIMARY KEY, 7 | name VARCHAR(80) 8 | ); 9 | CREATE INDEX types_name ON types (name); 10 | 11 | CREATE TABLE owners ( 12 | id INTEGER IDENTITY PRIMARY KEY, 13 | first_name VARCHAR(30), 14 | last_name VARCHAR(30), 15 | address VARCHAR(255), 16 | city VARCHAR(80), 17 | telephone VARCHAR(20) 18 | ); 19 | CREATE INDEX owners_last_name ON owners (last_name); 20 | 21 | CREATE TABLE pets ( 22 | id INTEGER IDENTITY PRIMARY KEY, 23 | name VARCHAR(30), 24 | birth_date DATE, 25 | type_id INTEGER NOT NULL, 26 | owner_id INTEGER NOT NULL 27 | ); 28 | ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners (id); 29 | ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types (id); 30 | CREATE INDEX pets_name ON pets (name); 31 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS petclinic; 2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | 4 | USE petclinic; 5 | 6 | CREATE TABLE IF NOT EXISTS types ( 7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 8 | name VARCHAR(80), 9 | INDEX(name) 10 | ) engine=InnoDB; 11 | 12 | CREATE TABLE IF NOT EXISTS owners ( 13 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 14 | first_name VARCHAR(30), 15 | last_name VARCHAR(30), 16 | address VARCHAR(255), 17 | city VARCHAR(80), 18 | telephone VARCHAR(20), 19 | INDEX(last_name) 20 | ) engine=InnoDB; 21 | 22 | CREATE TABLE IF NOT EXISTS pets ( 23 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 24 | name VARCHAR(30), 25 | birth_date DATE, 26 | type_id INT(4) UNSIGNED NOT NULL, 27 | owner_id INT(4) UNSIGNED NOT NULL, 28 | INDEX(name), 29 | FOREIGN KEY (owner_id) REFERENCES owners(id), 30 | FOREIGN KEY (type_id) REFERENCES types(id) 31 | ) engine=InnoDB; 32 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto: none 2 | 3 | spring: 4 | datasource: 5 | schema: classpath*:db/hsqldb/schema.sql 6 | data: classpath*:db/hsqldb/data.sql 7 | 8 | logging.level.org.springframework: INFO 9 | 10 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-customers-service/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-discovery-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=8761 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-discovery-server/src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.discovery; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @EnableEurekaServer 26 | @SpringBootApplication 27 | public class DiscoveryServerApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(DiscoveryServerApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-discovery-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: discovery-server 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-discovery-server/src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.discovery; 17 | 18 | import org.junit.jupiter.api.Test; 19 | import org.springframework.boot.test.context.SpringBootTest; 20 | 21 | @SpringBootTest 22 | class DiscoveryServerApplicationTests { 23 | 24 | @Test 25 | void contextLoads() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-hystrix-dashboard/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=7979 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-hystrix-dashboard/src/main/java/org/springframework/samples/petclinic/dashboard/HystrixDashboardApplication.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.dashboard; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | 11 | @SpringBootApplication 12 | @EnableDiscoveryClient 13 | @EnableHystrixDashboard 14 | @Controller 15 | public class HystrixDashboardApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(HystrixDashboardApplication.class, args); 19 | } 20 | 21 | @RequestMapping("/") 22 | public String home() { 23 | return "forward:/hystrix"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-hystrix-dashboard/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: hystrix-dashboard 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-hystrix-dashboard/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-hystrix-dashboard/src/test/java/org/springframework/samples/petclinic/dashboard/HystrixDashboardApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.dashboard; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class HystrixDashboardApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=8083 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/VetsServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | import org.springframework.samples.petclinic.vets.system.VetsProperties; 23 | 24 | /** 25 | * @author Maciej Szarlinski 26 | */ 27 | @EnableDiscoveryClient 28 | @SpringBootApplication 29 | @EnableConfigurationProperties(VetsProperties.class) 30 | public class VetsServiceApplication { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(VetsServiceApplication.class, args); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Specialty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.model; 17 | 18 | import javax.persistence.Column; 19 | import javax.persistence.Entity; 20 | import javax.persistence.GeneratedValue; 21 | import javax.persistence.GenerationType; 22 | import javax.persistence.Id; 23 | import javax.persistence.Table; 24 | 25 | /** 26 | * Models a {@link Vet Vet's} specialty (for example, dentistry). 27 | * 28 | * @author Juergen Hoeller 29 | */ 30 | @Entity 31 | @Table(name = "specialties") 32 | public class Specialty { 33 | @Id 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) 35 | private Integer id; 36 | 37 | @Column(name = "name") 38 | private String name; 39 | 40 | public Integer getId() { 41 | return id; 42 | } 43 | 44 | public void setId(final Integer id) { 45 | this.id = id; 46 | } 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public void setName(final String name) { 53 | this.name = name; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/VetRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.model; 17 | 18 | import org.springframework.data.jpa.repository.JpaRepository; 19 | 20 | /** 21 | * Repository class for Vet domain objects All method names are compliant with Spring Data naming 22 | * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation 23 | * 24 | * @author Ken Krebs 25 | * @author Juergen Hoeller 26 | * @author Sam Brannen 27 | * @author Michael Isvy 28 | * @author Maciej Szarlinski 29 | */ 30 | public interface VetRepository extends JpaRepository { 31 | } 32 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/system/CacheConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.system; 17 | 18 | import org.springframework.cache.annotation.EnableCaching; 19 | import org.springframework.context.annotation.Configuration; 20 | import org.springframework.context.annotation.Profile; 21 | 22 | /** 23 | * Cache could be disable in unit test. 24 | * @author Maciej Szarlinski 25 | */ 26 | @Configuration 27 | @EnableCaching 28 | @Profile("production") 29 | class CacheConfig { 30 | } 31 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/system/VetsProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.system; 17 | 18 | import lombok.Data; 19 | 20 | import org.springframework.boot.context.properties.ConfigurationProperties; 21 | 22 | /** 23 | * Typesafe custom configuration. 24 | * 25 | * @author Maciej Szarlinski 26 | */ 27 | @Data 28 | @ConfigurationProperties(prefix = "vets") 29 | public class VetsProperties { 30 | 31 | private Cache cache; 32 | 33 | @Data 34 | public static class Cache { 35 | 36 | private int ttl; 37 | 38 | private int heapSize; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/web/VetResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.vets.web; 17 | 18 | import lombok.RequiredArgsConstructor; 19 | 20 | import java.util.List; 21 | 22 | import org.springframework.samples.petclinic.vets.model.Vet; 23 | import org.springframework.samples.petclinic.vets.model.VetRepository; 24 | import org.springframework.web.bind.annotation.GetMapping; 25 | import org.springframework.web.bind.annotation.RequestMapping; 26 | import org.springframework.web.bind.annotation.RestController; 27 | 28 | /** 29 | * @author Juergen Hoeller 30 | * @author Mark Fisher 31 | * @author Ken Krebs 32 | * @author Arjen Poutsma 33 | * @author Maciej Szarlinski 34 | */ 35 | @RequestMapping("/vets") 36 | @RestController 37 | @RequiredArgsConstructor 38 | class VetResource { 39 | 40 | private final VetRepository vetRepository; 41 | 42 | @GetMapping 43 | public List showResourcesVetList() { 44 | return vetRepository.findAll(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=production 2 | spring.cache.cache-names=vets 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: vets-service 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/db/hsqldb/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO vets VALUES (1, 'James', 'Carter'); 2 | INSERT INTO vets VALUES (2, 'Helen', 'Leary'); 3 | INSERT INTO vets VALUES (3, 'Linda', 'Douglas'); 4 | INSERT INTO vets VALUES (4, 'Rafael', 'Ortega'); 5 | INSERT INTO vets VALUES (5, 'Henry', 'Stevens'); 6 | INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins'); 7 | 8 | INSERT INTO specialties VALUES (1, 'radiology'); 9 | INSERT INTO specialties VALUES (2, 'surgery'); 10 | INSERT INTO specialties VALUES (3, 'dentistry'); 11 | 12 | INSERT INTO vet_specialties VALUES (2, 1); 13 | INSERT INTO vet_specialties VALUES (3, 2); 14 | INSERT INTO vet_specialties VALUES (3, 3); 15 | INSERT INTO vet_specialties VALUES (4, 2); 16 | INSERT INTO vet_specialties VALUES (5, 1); 17 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/db/hsqldb/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE vet_specialties IF EXISTS; 2 | DROP TABLE vets IF EXISTS; 3 | DROP TABLE specialties IF EXISTS; 4 | 5 | CREATE TABLE vets ( 6 | id INTEGER IDENTITY PRIMARY KEY, 7 | first_name VARCHAR(30), 8 | last_name VARCHAR(30) 9 | ); 10 | CREATE INDEX vets_last_name ON vets (last_name); 11 | 12 | CREATE TABLE specialties ( 13 | id INTEGER IDENTITY PRIMARY KEY, 14 | name VARCHAR(80) 15 | ); 16 | CREATE INDEX specialties_name ON specialties (name); 17 | 18 | CREATE TABLE vet_specialties ( 19 | vet_id INTEGER NOT NULL, 20 | specialty_id INTEGER NOT NULL 21 | ); 22 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY (vet_id) REFERENCES vets (id); 23 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id); 24 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/db/mysql/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO vets VALUES (1, 'James', 'Carter'); 2 | INSERT IGNORE INTO vets VALUES (2, 'Helen', 'Leary'); 3 | INSERT IGNORE INTO vets VALUES (3, 'Linda', 'Douglas'); 4 | INSERT IGNORE INTO vets VALUES (4, 'Rafael', 'Ortega'); 5 | INSERT IGNORE INTO vets VALUES (5, 'Henry', 'Stevens'); 6 | INSERT IGNORE INTO vets VALUES (6, 'Sharon', 'Jenkins'); 7 | 8 | INSERT IGNORE INTO specialties VALUES (1, 'radiology'); 9 | INSERT IGNORE INTO specialties VALUES (2, 'surgery'); 10 | INSERT IGNORE INTO specialties VALUES (3, 'dentistry'); 11 | 12 | INSERT IGNORE INTO vet_specialties VALUES (2, 1); 13 | INSERT IGNORE INTO vet_specialties VALUES (3, 2); 14 | INSERT IGNORE INTO vet_specialties VALUES (3, 3); 15 | INSERT IGNORE INTO vet_specialties VALUES (4, 2); 16 | INSERT IGNORE INTO vet_specialties VALUES (5, 1); 17 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS petclinic; 2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | 4 | USE petclinic; 5 | 6 | CREATE TABLE IF NOT EXISTS vets ( 7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 8 | first_name VARCHAR(30), 9 | last_name VARCHAR(30), 10 | INDEX(last_name) 11 | ) engine=InnoDB; 12 | 13 | CREATE TABLE IF NOT EXISTS specialties ( 14 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 15 | name VARCHAR(80), 16 | INDEX(name) 17 | ) engine=InnoDB; 18 | 19 | CREATE TABLE IF NOT EXISTS vet_specialties ( 20 | vet_id INT(4) UNSIGNED NOT NULL, 21 | specialty_id INT(4) UNSIGNED NOT NULL, 22 | FOREIGN KEY (vet_id) REFERENCES vets(id), 23 | FOREIGN KEY (specialty_id) REFERENCES specialties(id), 24 | UNIQUE (vet_id,specialty_id) 25 | ) engine=InnoDB; 26 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto: none 2 | 3 | spring: 4 | datasource: 5 | schema: classpath*:db/hsqldb/schema.sql 6 | data: classpath*:db/hsqldb/data.sql 7 | 8 | vets: 9 | cache: 10 | ttl: 10 11 | heap-size: 10 12 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-vets-service/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG DOCKERIZE_VERSION=v0.6.1 3 | ARG EXPOSED_PORT=8082 4 | ENV SPRING_PROFILES_ACTIVE docker,mysql 5 | ADD https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz dockerize.tar.gz 6 | RUN tar -xzf dockerize.tar.gz 7 | RUN chmod +x dockerize 8 | ADD ./target/*.jar /app.jar 9 | EXPOSE ${EXPOSED_PORT} 10 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/VisitsServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.visits; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @EnableDiscoveryClient 26 | @SpringBootApplication 27 | public class VisitsServiceApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(VisitsServiceApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/model/VisitRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.springframework.samples.petclinic.visits.model; 17 | 18 | import java.util.List; 19 | 20 | import org.springframework.data.jpa.repository.JpaRepository; 21 | 22 | /** 23 | * Repository class for Visit domain objects All method names are compliant with Spring Data naming conventions so this interface can easily be extended for Spring 24 | * Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation 25 | * 26 | * @author Ken Krebs 27 | * @author Juergen Hoeller 28 | * @author Sam Brannen 29 | * @author Michael Isvy 30 | * @author Maciej Szarlinski 31 | */ 32 | public interface VisitRepository extends JpaRepository { 33 | 34 | List findByPetId(int petId); 35 | 36 | List findByPetIdIn(Iterable petIds); 37 | } 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getanteon/blog_examples/295259e2f88e972f1ad7267a6d9e89124217c966/011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/application.properties -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | uri: http://localhost:8888 5 | application: 6 | name: visits-service 7 | --- 8 | spring: 9 | profiles: docker 10 | cloud: 11 | config: 12 | uri: http://config-server:8888 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/db/hsqldb/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot'); 2 | INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot'); 3 | INSERT INTO visits VALUES (3, 8, '2013-01-03', 'neutered'); 4 | INSERT INTO visits VALUES (4, 7, '2013-01-04', 'spayed'); 5 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/db/hsqldb/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE visits IF EXISTS; 2 | 3 | CREATE TABLE visits ( 4 | id INTEGER IDENTITY PRIMARY KEY, 5 | pet_id INTEGER NOT NULL, 6 | visit_date DATE, 7 | description VARCHAR(8192) 8 | ); 9 | 10 | CREATE INDEX visits_pet_id ON visits (pet_id); 11 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/db/mysql/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO visits VALUES (1, 7, '2010-03-04', 'rabies shot'); 2 | INSERT IGNORE INTO visits VALUES (2, 8, '2011-03-04', 'rabies shot'); 3 | INSERT IGNORE INTO visits VALUES (3, 8, '2009-06-04', 'neutered'); 4 | INSERT IGNORE INTO visits VALUES (4, 7, '2008-09-04', 'spayed'); 5 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS petclinic; 2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | 4 | USE petclinic; 5 | 6 | CREATE TABLE IF NOT EXISTS visits ( 7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 8 | pet_id INT(4) UNSIGNED NOT NULL, 9 | visit_date DATE, 10 | description VARCHAR(8192), 11 | FOREIGN KEY (pet_id) REFERENCES pets(id) 12 | ) engine=InnoDB; 13 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto: none 2 | 3 | spring: 4 | datasource: 5 | schema: classpath*:db/hsqldb/schema.sql 6 | data: classpath*:db/hsqldb/data.sql 7 | 8 | logging.level.org.springframework: INFO 9 | 10 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/spring-petclinic-visits-service/src/test/resources/bootstrap-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/admin-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: admin-server 11 | name: admin-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: admin-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: admin-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_ADMIN_SERVER }}' 30 | name: admin-server 31 | ports: 32 | - containerPort: 9090 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/admin-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: admin-server 11 | name: admin-server 12 | spec: 13 | ports: 14 | - name: "9090" 15 | port: 9090 16 | targetPort: 9090 17 | selector: 18 | io.kompose.service: admin-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/api-gateway-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 8 | kompose.service.nodeport.port: "30001" 9 | kompose.service.type: nodeport 10 | kompose.version: 1.26.1 (a9d05d509) 11 | creationTimestamp: null 12 | labels: 13 | io.kompose.service: api-gateway 14 | name: api-gateway 15 | spec: 16 | replicas: 1 17 | selector: 18 | matchLabels: 19 | io.kompose.service: api-gateway 20 | strategy: {} 21 | template: 22 | metadata: 23 | annotations: 24 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 25 | kompose.image-pull-secret: regcred 26 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 27 | kompose.service.nodeport.port: "30001" 28 | kompose.service.type: nodeport 29 | kompose.version: 1.26.1 (a9d05d509) 30 | creationTimestamp: null 31 | labels: 32 | io.kompose.service: api-gateway 33 | spec: 34 | containers: 35 | - image: '{{ .Values.IMAGE_TAG_API_GATEWAY }}' 36 | name: api-gateway 37 | ports: 38 | - containerPort: 8080 39 | resources: {} 40 | initContainers: 41 | - name: init-discovery-server 42 | image: busybox 43 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 44 | imagePullSecrets: 45 | - name: regcred 46 | restartPolicy: Always 47 | status: {} 48 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/api-gateway-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 8 | kompose.service.nodeport.port: "30001" 9 | kompose.service.type: nodeport 10 | kompose.version: 1.26.1 (a9d05d509) 11 | creationTimestamp: null 12 | labels: 13 | io.kompose.service: api-gateway 14 | name: api-gateway 15 | spec: 16 | ingressClassName: nginx 17 | rules: 18 | - host: '{{ .Values.DNS_NAME }}' 19 | http: 20 | paths: 21 | - backend: 22 | service: 23 | name: api-gateway 24 | port: 25 | number: 8080 26 | path: / 27 | pathType: Prefix 28 | status: 29 | loadBalancer: {} 30 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/api-gateway-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.service.expose: '{{ .Values.DNS_NAME }}' 8 | kompose.service.nodeport.port: "30001" 9 | kompose.service.type: nodeport 10 | kompose.version: 1.26.1 (a9d05d509) 11 | creationTimestamp: null 12 | labels: 13 | io.kompose.service: api-gateway 14 | name: api-gateway 15 | spec: 16 | ports: 17 | - name: "8080" 18 | nodePort: 30001 19 | port: 8080 20 | targetPort: 8080 21 | selector: 22 | io.kompose.service: api-gateway 23 | type: NodePort 24 | status: 25 | loadBalancer: {} 26 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/config-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: config-server 11 | name: config-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: config-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: config-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_CONFIG_SERVER }}' 30 | name: config-server 31 | ports: 32 | - containerPort: 8888 33 | resources: {} 34 | imagePullSecrets: 35 | - name: regcred 36 | restartPolicy: Always 37 | status: {} 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/config-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: config-server 11 | name: config-server 12 | spec: 13 | ports: 14 | - name: "8888" 15 | port: 8888 16 | targetPort: 8888 17 | selector: 18 | io.kompose.service: config-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/customers-service-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: customers-service 11 | name: customers-service 12 | spec: 13 | replicas: 2 14 | selector: 15 | matchLabels: 16 | io.kompose.service: customers-service 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: customers-service 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_CUSTOMERS_SERVICE }}' 30 | name: customers-service 31 | ports: 32 | - containerPort: 8081 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/customers-service-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: customers-service 11 | name: customers-service 12 | spec: 13 | ports: 14 | - name: "8081" 15 | port: 8081 16 | targetPort: 8081 17 | selector: 18 | io.kompose.service: customers-service 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/discovery-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: discovery-server 11 | name: discovery-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: discovery-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: discovery-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_DISCOVERY_SERVER }}' 30 | name: discovery-server 31 | ports: 32 | - containerPort: 8761 33 | resources: {} 34 | initContainers: 35 | - name: init-config-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z config-server:8888; do echo waiting for config-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/discovery-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: discovery-server 11 | name: discovery-server 12 | spec: 13 | ports: 14 | - name: "8761" 15 | port: 8761 16 | targetPort: 8761 17 | selector: 18 | io.kompose.service: discovery-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/grafana-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: grafana-server 11 | name: grafana-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: grafana-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: grafana-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_GRAFANA_SERVICE }}' 30 | name: grafana-server 31 | ports: 32 | - containerPort: 3000 33 | resources: {} 34 | imagePullSecrets: 35 | - name: regcred 36 | restartPolicy: Always 37 | status: {} 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/grafana-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: grafana-server 11 | name: grafana-server 12 | spec: 13 | ports: 14 | - name: "3000" 15 | port: 3000 16 | targetPort: 3000 17 | selector: 18 | io.kompose.service: grafana-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/hystrix-dashboard-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: hystrix-dashboard 11 | name: hystrix-dashboard 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: hystrix-dashboard 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: hystrix-dashboard 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_HYSTRIX_DASHBOARD }}' 30 | name: hystrix-dashboard 31 | ports: 32 | - containerPort: 7979 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/hystrix-dashboard-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: hystrix-dashboard 11 | name: hystrix-dashboard 12 | spec: 13 | ports: 14 | - name: "7979" 15 | port: 7979 16 | targetPort: 7979 17 | selector: 18 | io.kompose.service: hystrix-dashboard 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/mysql-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.version: 1.26.1 (a9d05d509) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: mysql-server 10 | name: mysql-server 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | io.kompose.service: mysql-server 16 | strategy: {} 17 | template: 18 | metadata: 19 | annotations: 20 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 21 | kompose.version: 1.26.1 (a9d05d509) 22 | creationTimestamp: null 23 | labels: 24 | io.kompose.service: mysql-server 25 | spec: 26 | containers: 27 | - env: 28 | - name: MYSQL_DATABASE 29 | value: petclinic 30 | - name: MYSQL_ROOT_PASSWORD 31 | value: petclinic 32 | image: mysql:5.7.8 33 | name: mysql-server 34 | ports: 35 | - containerPort: 3306 36 | resources: {} 37 | restartPolicy: Always 38 | status: {} 39 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/mysql-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.version: 1.26.1 (a9d05d509) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: mysql-server 10 | name: mysql-server 11 | spec: 12 | ports: 13 | - name: "3306" 14 | port: 3306 15 | targetPort: 3306 16 | selector: 17 | io.kompose.service: mysql-server 18 | status: 19 | loadBalancer: {} 20 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/prometheus-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: prometheus-server 11 | name: prometheus-server 12 | spec: 13 | replicas: 1 14 | selector: 15 | matchLabels: 16 | io.kompose.service: prometheus-server 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: prometheus-server 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_PROMETHEUS_SERVICE }}' 30 | name: prometheus-server 31 | ports: 32 | - containerPort: 9090 33 | resources: {} 34 | imagePullSecrets: 35 | - name: regcred 36 | restartPolicy: Always 37 | status: {} 38 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/prometheus-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: prometheus-server 11 | name: prometheus-server 12 | spec: 13 | ports: 14 | - name: "9091" 15 | port: 9091 16 | targetPort: 9090 17 | selector: 18 | io.kompose.service: prometheus-server 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/tracing-server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.version: 1.26.1 (a9d05d509) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: tracing-server 10 | name: tracing-server 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | io.kompose.service: tracing-server 16 | strategy: {} 17 | template: 18 | metadata: 19 | annotations: 20 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 21 | kompose.version: 1.26.1 (a9d05d509) 22 | creationTimestamp: null 23 | labels: 24 | io.kompose.service: tracing-server 25 | spec: 26 | containers: 27 | - env: 28 | - name: JAVA_OPTS 29 | value: -XX:+UnlockExperimentalVMOptions -Djava.security.egd=file:/dev/./urandom 30 | image: openzipkin/zipkin 31 | name: tracing-server 32 | ports: 33 | - containerPort: 9411 34 | resources: {} 35 | restartPolicy: Always 36 | status: {} 37 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/tracing-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.version: 1.26.1 (a9d05d509) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: tracing-server 10 | name: tracing-server 11 | spec: 12 | ports: 13 | - name: "9411" 14 | port: 9411 15 | targetPort: 9411 16 | selector: 17 | io.kompose.service: tracing-server 18 | status: 19 | loadBalancer: {} 20 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/vets-service-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: vets-service 11 | name: vets-service 12 | spec: 13 | replicas: 2 14 | selector: 15 | matchLabels: 16 | io.kompose.service: vets-service 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: vets-service 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_VETS_SERVICE }}' 30 | name: vets-service 31 | ports: 32 | - containerPort: 8083 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/vets-service-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: vets-service 11 | name: vets-service 12 | spec: 13 | ports: 14 | - name: "8083" 15 | port: 8083 16 | targetPort: 8083 17 | selector: 18 | io.kompose.service: vets-service 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/visits-service-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: visits-service 11 | name: visits-service 12 | spec: 13 | replicas: 2 14 | selector: 15 | matchLabels: 16 | io.kompose.service: visits-service 17 | strategy: {} 18 | template: 19 | metadata: 20 | annotations: 21 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 22 | kompose.image-pull-secret: regcred 23 | kompose.version: 1.26.1 (a9d05d509) 24 | creationTimestamp: null 25 | labels: 26 | io.kompose.service: visits-service 27 | spec: 28 | containers: 29 | - image: '{{ .Values.IMAGE_TAG_VISITS_SERVICE }}' 30 | name: visits-service 31 | ports: 32 | - containerPort: 8082 33 | resources: {} 34 | initContainers: 35 | - name: init-discovery-server 36 | image: busybox 37 | command: ['sh', '-c', 'until nc -z discovery-server:8761; do echo waiting for discovery-server; sleep 2; done;'] 38 | imagePullSecrets: 39 | - name: regcred 40 | restartPolicy: Always 41 | status: {} 42 | -------------------------------------------------------------------------------- /011_aws-eks-with-monitoring-anteon/templates/visits-service-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert -f docker-compose.yml -o petclinic_chart/templates 6 | kompose.image-pull-secret: regcred 7 | kompose.version: 1.26.1 (a9d05d509) 8 | creationTimestamp: null 9 | labels: 10 | io.kompose.service: visits-service 11 | name: visits-service 12 | spec: 13 | ports: 14 | - name: "8082" 15 | port: 8082 16 | targetPort: 8082 17 | selector: 18 | io.kompose.service: visits-service 19 | status: 20 | loadBalancer: {} 21 | -------------------------------------------------------------------------------- /011_redis_observability/README.md: -------------------------------------------------------------------------------- 1 | # Redis eBPF 2 | This is a demo code, for showcasing Observability of the RESP protocol using eBPF. This code is inspired by Alaz, Kubernetes eBPF agent, developed by Anteon. 3 | 4 | ## Prerequisites 5 | 6 | Install dependencies using: 7 | ``` 8 | sudo apt install libbpf-dev llvm clang linux-tools-common gcc-multilib 9 | ``` 10 | 11 | ## Run it 12 | 13 | In order to try it out locally: 14 | 15 | - Run eBPF program using 16 | ``` 17 | go generate 18 | go build 19 | sudo ./redis 20 | ``` 21 | - Run the Redis Container using 22 | ``` 23 | docker run --name redis-server -d --memory 4g --cpus 4 -p 6379:6379 redis 24 | ``` 25 | - Run client inside `/test` using 26 | ``` 27 | go run client.go 28 | ``` 29 | - In another shell, inspect eBPF program logs using 30 | ``` 31 | sudo cat /sys/kernel/debug/tracing/trace_pipe 32 | ``` 33 | -------------------------------------------------------------------------------- /011_redis_observability/go.mod: -------------------------------------------------------------------------------- 1 | module redis 2 | 3 | go 1.22.4 4 | 5 | require github.com/cilium/ebpf v0.15.0 6 | 7 | require ( 8 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect 9 | golang.org/x/sys v0.15.0 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /011_redis_observability/go.sum: -------------------------------------------------------------------------------- 1 | github.com/cilium/ebpf v0.15.0 h1:7NxJhNiBT3NG8pZJ3c+yfrVdHY8ScgKD27sScgjLMMk= 2 | github.com/cilium/ebpf v0.15.0/go.mod h1:DHp1WyrLeiBh19Cf/tfiSMhqheEiK8fXFZ4No0P1Hso= 3 | github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= 4 | github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= 5 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 6 | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 7 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 8 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 9 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 10 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 11 | github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= 12 | github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= 13 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= 14 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= 15 | golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= 16 | golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 17 | -------------------------------------------------------------------------------- /011_redis_observability/perf/go.mod: -------------------------------------------------------------------------------- 1 | module perf-redis-ebpf 2 | 3 | go 1.22.4 4 | 5 | require github.com/go-redis/redis/v8 v8.11.5 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.1.2 // indirect 9 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /011_redis_observability/perf/plot.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | 3 | # Latency values in microseconds 4 | operations = ['SET', 'UPDATE', 'DELETE', 'GET', 'PUBLISH'] 5 | latency_with_ebpf = [140.768, 140.303, 140.629, 69.858, 140.077] 6 | latency_without_ebpf = [125.951, 126.011, 126.065, 62.689, 121.525] 7 | 8 | x = range(len(operations)) 9 | 10 | # Create the plot 11 | fig, ax = plt.subplots() 12 | 13 | # Plotting the values 14 | bar_width = 0.35 15 | ax.bar(x, latency_with_ebpf, width=bar_width, label='With eBPF', align='center') 16 | ax.bar([p + bar_width for p in x], latency_without_ebpf, width=bar_width, label='Without eBPF', align='center') 17 | 18 | # Adding labels and title 19 | ax.set_xlabel('Operation') 20 | ax.set_ylabel('Latency (µs)') 21 | ax.set_title('RESP Protocol Latency Comparison with and without eBPF') 22 | ax.set_xticks([p + bar_width/2 for p in x]) 23 | ax.set_xticklabels(operations) 24 | ax.legend() 25 | 26 | # Display the plot 27 | plt.tight_layout() 28 | plt.show() 29 | -------------------------------------------------------------------------------- /011_redis_observability/test/go.mod: -------------------------------------------------------------------------------- 1 | module redis-client 2 | 3 | go 1.22.4 4 | 5 | require github.com/go-redis/redis/v8 v8.11.5 6 | 7 | require ( 8 | github.com/cespare/xxhash/v2 v2.1.2 // indirect 9 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /012_ssl_observability/README.md: -------------------------------------------------------------------------------- 1 | # What Insights Can eBPF Provide into Real-Time SSL/TLS Encrypted Traffic and How? 2 | 3 | ## Prerequisites 4 | 5 | Install dependencies using: 6 | ``` 7 | sudo apt install libbpf-dev llvm clang linux-tools-common gcc-multilib 8 | ``` 9 | 10 | ## Run it 11 | 12 | - Run eBPF Program 13 | 14 | ``` 15 | go generate 16 | go build 17 | sudo ./ssl-ebpf 18 | ``` 19 | 20 | - Run HTTPS Server in `/test` directory: 21 | 22 | ``` 23 | go run main.go 24 | ``` 25 | 26 | - Then you can make requests using `curl`: 27 | 28 | ``` 29 | curl -X GET https://localhost:4445 --insecure --http1.1 30 | curl -X POST https://localhost:4445 --insecure --http1.1 31 | curl -X PUT https://localhost:4445 --insecure --http1.1 32 | curl -X PATCH https://localhost:4445 --insecure --http1.1 33 | curl -X DELETE https://localhost:4445 --insecure --http1.1 34 | curl -X CONNECT https://localhost:4445 --insecure --http1.1 35 | curl -X OPTIONS https://localhost:4445 --insecure --http1.1 36 | curl -X TRACE https://localhost:4445 --insecure --http1.1 37 | ``` 38 | -------------------------------------------------------------------------------- /012_ssl_observability/go.mod: -------------------------------------------------------------------------------- 1 | module ssl-ebpf 2 | 3 | go 1.22.4 4 | 5 | require ( 6 | github.com/cilium/ebpf v0.15.0 7 | golang.org/x/sys v0.21.0 8 | ) 9 | 10 | require golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect 11 | -------------------------------------------------------------------------------- /012_ssl_observability/go.sum: -------------------------------------------------------------------------------- 1 | github.com/cilium/ebpf v0.15.0 h1:7NxJhNiBT3NG8pZJ3c+yfrVdHY8ScgKD27sScgjLMMk= 2 | github.com/cilium/ebpf v0.15.0/go.mod h1:DHp1WyrLeiBh19Cf/tfiSMhqheEiK8fXFZ4No0P1Hso= 3 | github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= 4 | github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= 5 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 6 | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 7 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 8 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 9 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 10 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 11 | github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= 12 | github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= 13 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI= 14 | golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= 15 | golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= 16 | golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 17 | -------------------------------------------------------------------------------- /012_ssl_observability/perf/plot.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | from matplotlib.ticker import FormatStrFormatter 3 | 4 | # Latency values in microseconds 5 | latency_with_ebpf = [7.6] 6 | latency_without_ebpf = [7.4] 7 | 8 | # Create the plot 9 | fig, ax = plt.subplots() 10 | 11 | # Plotting the values 12 | ax.bar(1, latency_with_ebpf, width=0.4, label='With eBPF', align='center') 13 | ax.bar(1, latency_without_ebpf, width=0.4, label='Without eBPF', align='edge') 14 | ax.yaxis.set_major_formatter(FormatStrFormatter('%.2f')) 15 | 16 | # Adding labels and title 17 | ax.set_xlabel('Operations - (GET,POST,PUT,PATCH,DELETE,CONNECT,OPTIONS,TRACE)') 18 | ax.set_ylabel('Average Latency (µs)') 19 | ax.set_xticklabels([]) 20 | ax.set_title('HTTPS Latency Comparison with and without eBPF') 21 | ax.legend() 22 | 23 | # Display the plot 24 | plt.tight_layout() 25 | plt.show() 26 | -------------------------------------------------------------------------------- /012_ssl_observability/perf/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commands=( 4 | "curl -w '%{time_total}\n' -o /dev/null -s -X GET https://localhost:4445 --insecure --http1.1" 5 | "curl -w '%{time_total}\n' -o /dev/null -s -X POST https://localhost:4445 --insecure --http1.1" 6 | "curl -w '%{time_total}\n' -o /dev/null -s -X PUT https://localhost:4445 --insecure --http1.1" 7 | "curl -w '%{time_total}\n' -o /dev/null -s -X PATCH https://localhost:4445 --insecure --http1.1" 8 | "curl -w '%{time_total}\n' -o /dev/null -s -X DELETE https://localhost:4445 --insecure --http1.1" 9 | "curl -w '%{time_total}\n' -o /dev/null -s -X CONNECT https://localhost:4445 --insecure --http1.1" 10 | "curl -w '%{time_total}\n' -o /dev/null -s -X OPTIONS https://localhost:4445 --insecure --http1.1" 11 | "curl -w '%{time_total}\n' -o /dev/null -s -X TRACE https://localhost:4445 --insecure --http1.1" 12 | ) 13 | 14 | total_time=0 15 | total_requests=0 16 | 17 | for i in {1..10000} 18 | do 19 | for cmd in "${commands[@]}" 20 | do 21 | response_time=$(eval "$cmd") 22 | total_time=$(echo "$total_time + $response_time" | bc) 23 | total_requests=$((total_requests + 1)) 24 | done 25 | done 26 | 27 | average_time=$(echo "scale=4; $total_time / $total_requests" | bc) 28 | echo "Average response time: $average_time seconds" 29 | -------------------------------------------------------------------------------- /012_ssl_observability/test/go.mod: -------------------------------------------------------------------------------- 1 | module ssl-server-test 2 | 3 | go 1.22.4 4 | -------------------------------------------------------------------------------- /012_ssl_observability/test/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "crypto/tls" 5 | "log" 6 | "net/http" 7 | ) 8 | 9 | var ( 10 | CertFilePath = "server.crt" 11 | KeyFilePath = "server.key" 12 | ) 13 | 14 | func httpRequestHandler(w http.ResponseWriter, req *http.Request) { 15 | switch req.Method { 16 | case http.MethodGet: 17 | w.Write([]byte("GET request received\n")) 18 | case http.MethodPost: 19 | w.Write([]byte("POST request received\n")) 20 | case http.MethodPut: 21 | w.Write([]byte("PUT request received\n")) 22 | case http.MethodPatch: 23 | w.Write([]byte("PATCH request received\n")) 24 | case http.MethodDelete: 25 | w.Write([]byte("DELETE request received\n")) 26 | case http.MethodHead: 27 | w.Header().Set("Content-Type", "text/plain") 28 | case http.MethodConnect: 29 | w.Write([]byte("CONNECT request received\n")) 30 | case http.MethodOptions: 31 | w.Header().Set("Allow", "GET, POST, PUT, PATCH, DELETE, HEAD, CONNECT, OPTIONS, TRACE") 32 | w.WriteHeader(http.StatusNoContent) 33 | case http.MethodTrace: 34 | w.Write([]byte("TRACE request received\n")) 35 | default: 36 | w.WriteHeader(http.StatusMethodNotAllowed) 37 | w.Write([]byte("Method not allowed\n")) 38 | } 39 | } 40 | 41 | func main() { 42 | // load tls certificates 43 | serverTLSCert, err := tls.LoadX509KeyPair(CertFilePath, KeyFilePath) 44 | if err != nil { 45 | log.Fatalf("Error loading certificate and key file: %v", err) 46 | } 47 | 48 | tlsConfig := &tls.Config{ 49 | Certificates: []tls.Certificate{serverTLSCert}, 50 | } 51 | server := http.Server{ 52 | Addr: "localhost:4445", 53 | Handler: http.HandlerFunc(httpRequestHandler), 54 | TLSConfig: tlsConfig, 55 | } 56 | defer server.Close() 57 | log.Fatal(server.ListenAndServeTLS("", "")) 58 | } 59 | -------------------------------------------------------------------------------- /012_ssl_observability/test/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICGzCCAaCgAwIBAgIUf+GnLOzafDzBV7jTkz5nLefoZUcwCgYIKoZIzj0EAwIw 3 | RDELMAkGA1UEBhMCU0kxEjAQBgNVBAgMCUxqdWJsamFuYTEhMB8GA1UECgwYSW50 4 | ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMB4XDTI0MDcwMjIwMTQwMloXDTM0MDYzMDIw 5 | MTQwMlowRDELMAkGA1UEBhMCU0kxEjAQBgNVBAgMCUxqdWJsamFuYTEhMB8GA1UE 6 | CgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMHYwEAYHKoZIzj0CAQYFK4EEACID 7 | YgAElqfk5o285zMf0hJyF0+zlV4c5csnnaGtAegFLNXhDKmHnwjEcbKT8lw8OsJb 8 | MXrD6X6yM9ItBsSd3mB44mmxUAdXKSxYDdX3n6rBgKfuHhOlnXlj73qck11i5aCU 9 | Ok60o1MwUTAdBgNVHQ4EFgQUuybbhhvRsI25GNipEg2cwtT3fTQwHwYDVR0jBBgw 10 | FoAUuybbhhvRsI25GNipEg2cwtT3fTQwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjO 11 | PQQDAgNpADBmAjEA4z4INq80Vy2Vv58t4C/POj1Ii78UA2lCGqtjgCr8W+URRZPx 12 | 4FEogE1VrJMEwxNPAjEAtyeL1pT4ua4HxPJxZo0+uuTGJcXaX7ElcZeAQHHHjX1F 13 | bqLc+piquxgVBnnCErRf 14 | -----END CERTIFICATE----- 15 | -------------------------------------------------------------------------------- /012_ssl_observability/test/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BgUrgQQAIg== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MIGkAgEBBDA7DbKKLF/w0W3niwMHzCDy46HFywUPDoG1z+DZ0aJhFNVGUTRNxxGG 6 | EOn/XKl5Px2gBwYFK4EEACKhZANiAASWp+TmjbznMx/SEnIXT7OVXhzlyyedoa0B 7 | 6AUs1eEMqYefCMRxspPyXDw6wlsxesPpfrIz0i0GxJ3eYHjiabFQB1cpLFgN1fef 8 | qsGAp+4eE6WdeWPvepyTXWLloJQ6TrQ= 9 | -----END EC PRIVATE KEY----- 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blog Examples 2 | 3 | This repository contains example codes and config files from [Ddosify Blog](https://ddosify.com/blog). 4 | --------------------------------------------------------------------------------