├── .github └── workflows │ └── blank.yml ├── Jenkinsfile └── deployment-service.yml /.github/workflows/blank.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the "main" branch 8 | push: 9 | branches: [ "main" ] 10 | pull_request: 11 | branches: [ "main" ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-latest 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v4 27 | 28 | # Runs a single command using the runners shell 29 | - name: Run a one-line script 30 | run: echo Hello, world! 31 | 32 | # Runs a set of commands using the runners shell 33 | - name: Run a multi-line script 34 | run: | 35 | echo Add other actions to build, 36 | echo test, and deploy your project. 37 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | 4 | stages { 5 | stage('Deploy To Kubernetes') { 6 | steps { 7 | withKubeConfig(caCertificate: '', clusterName: 'EKS-1', contextName: '', credentialsId: 'k8-token', namespace: 'webapps', restrictKubeConfigAccess: false, serverUrl: 'https://680F9859A4E4B2EC6D8776ECD2DD1F4C.gr7.us-west-2.eks.amazonaws.com') { 8 | sh "kubectl apply -f deployment-service.yml" 9 | sleep 60 10 | 11 | } 12 | } 13 | } 14 | 15 | stage('verify Deployment') { 16 | steps { 17 | withKubeConfig(caCertificate: '', clusterName: 'EKS-1', contextName: '', credentialsId: 'k8-token', namespace: 'webapps', restrictKubeConfigAccess: false, serverUrl: 'https://680F9859A4E4B2EC6D8776ECD2DD1F4C.gr7.us-west-2.eks.amazonaws.com') { 18 | sh "kubectl get svc -n webapps" 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /deployment-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: emailservice 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: emailservice 10 | template: 11 | metadata: 12 | labels: 13 | app: emailservice 14 | spec: 15 | serviceAccountName: default 16 | terminationGracePeriodSeconds: 5 17 | securityContext: 18 | fsGroup: 1000 19 | runAsGroup: 1000 20 | runAsNonRoot: true 21 | runAsUser: 1000 22 | containers: 23 | - name: server 24 | securityContext: 25 | allowPrivilegeEscalation: false 26 | capabilities: 27 | drop: 28 | - ALL 29 | privileged: false 30 | readOnlyRootFilesystem: true 31 | image: vikashashoke/emailservice:latest 32 | ports: 33 | - containerPort: 8080 34 | env: 35 | - name: PORT 36 | value: "8080" 37 | - name: DISABLE_PROFILER 38 | value: "1" 39 | readinessProbe: 40 | periodSeconds: 5 41 | exec: 42 | command: ["/bin/grpc_health_probe", "-addr=:8080"] 43 | livenessProbe: 44 | periodSeconds: 5 45 | exec: 46 | command: ["/bin/grpc_health_probe", "-addr=:8080"] 47 | resources: 48 | requests: 49 | cpu: 100m 50 | memory: 64Mi 51 | limits: 52 | cpu: 200m 53 | memory: 128Mi 54 | --- 55 | apiVersion: v1 56 | kind: Service 57 | metadata: 58 | name: emailservice 59 | spec: 60 | type: ClusterIP 61 | selector: 62 | app: emailservice 63 | ports: 64 | - name: grpc 65 | port: 5000 66 | targetPort: 8080 67 | --- 68 | apiVersion: apps/v1 69 | kind: Deployment 70 | metadata: 71 | name: checkoutservice 72 | spec: 73 | selector: 74 | matchLabels: 75 | app: checkoutservice 76 | template: 77 | metadata: 78 | labels: 79 | app: checkoutservice 80 | spec: 81 | serviceAccountName: default 82 | containers: 83 | - name: server 84 | image: vikashashoke/checkoutservice:latest 85 | ports: 86 | - containerPort: 5050 87 | readinessProbe: 88 | exec: 89 | command: ["/bin/grpc_health_probe", "-addr=:5050"] 90 | livenessProbe: 91 | exec: 92 | command: ["/bin/grpc_health_probe", "-addr=:5050"] 93 | env: 94 | - name: PORT 95 | value: "5050" 96 | - name: PRODUCT_CATALOG_SERVICE_ADDR 97 | value: "productcatalogservice:3550" 98 | - name: SHIPPING_SERVICE_ADDR 99 | value: "shippingservice:50051" 100 | - name: PAYMENT_SERVICE_ADDR 101 | value: "paymentservice:50051" 102 | - name: EMAIL_SERVICE_ADDR 103 | value: "emailservice:5000" 104 | - name: CURRENCY_SERVICE_ADDR 105 | value: "currencyservice:7000" 106 | - name: CART_SERVICE_ADDR 107 | value: "cartservice:7070" 108 | resources: 109 | requests: 110 | cpu: 100m 111 | memory: 64Mi 112 | limits: 113 | cpu: 200m 114 | memory: 128Mi 115 | --- 116 | apiVersion: v1 117 | kind: Service 118 | metadata: 119 | name: checkoutservice 120 | spec: 121 | type: ClusterIP 122 | selector: 123 | app: checkoutservice 124 | ports: 125 | - name: grpc 126 | port: 5050 127 | targetPort: 5050 128 | --- 129 | apiVersion: apps/v1 130 | kind: Deployment 131 | metadata: 132 | name: recommendationservice 133 | spec: 134 | selector: 135 | matchLabels: 136 | app: recommendationservice 137 | template: 138 | metadata: 139 | labels: 140 | app: recommendationservice 141 | spec: 142 | serviceAccountName: default 143 | terminationGracePeriodSeconds: 5 144 | containers: 145 | - name: server 146 | image: vikashashoke/recommendationservice:latest 147 | ports: 148 | - containerPort: 8080 149 | readinessProbe: 150 | periodSeconds: 5 151 | exec: 152 | command: ["/bin/grpc_health_probe", "-addr=:8080"] 153 | livenessProbe: 154 | periodSeconds: 5 155 | exec: 156 | command: ["/bin/grpc_health_probe", "-addr=:8080"] 157 | env: 158 | - name: PORT 159 | value: "8080" 160 | - name: PRODUCT_CATALOG_SERVICE_ADDR 161 | value: "productcatalogservice:3550" 162 | - name: DISABLE_PROFILER 163 | value: "1" 164 | resources: 165 | requests: 166 | cpu: 100m 167 | memory: 220Mi 168 | limits: 169 | cpu: 200m 170 | memory: 450Mi 171 | --- 172 | apiVersion: v1 173 | kind: Service 174 | metadata: 175 | name: recommendationservice 176 | spec: 177 | type: ClusterIP 178 | selector: 179 | app: recommendationservice 180 | ports: 181 | - name: grpc 182 | port: 8080 183 | targetPort: 8080 184 | --- 185 | apiVersion: apps/v1 186 | kind: Deployment 187 | metadata: 188 | name: frontend 189 | spec: 190 | selector: 191 | matchLabels: 192 | app: frontend 193 | template: 194 | metadata: 195 | labels: 196 | app: frontend 197 | annotations: 198 | sidecar.istio.io/rewriteAppHTTPProbers: "true" 199 | spec: 200 | serviceAccountName: default 201 | containers: 202 | - name: server 203 | image: vikashashoke/frontend:latest 204 | ports: 205 | - containerPort: 8080 206 | readinessProbe: 207 | initialDelaySeconds: 10 208 | httpGet: 209 | path: "/_healthz" 210 | port: 8080 211 | httpHeaders: 212 | - name: "Cookie" 213 | value: "shop_session-id=x-readiness-probe" 214 | livenessProbe: 215 | initialDelaySeconds: 10 216 | httpGet: 217 | path: "/_healthz" 218 | port: 8080 219 | httpHeaders: 220 | - name: "Cookie" 221 | value: "shop_session-id=x-liveness-probe" 222 | env: 223 | - name: PORT 224 | value: "8080" 225 | - name: PRODUCT_CATALOG_SERVICE_ADDR 226 | value: "productcatalogservice:3550" 227 | - name: CURRENCY_SERVICE_ADDR 228 | value: "currencyservice:7000" 229 | - name: CART_SERVICE_ADDR 230 | value: "cartservice:7070" 231 | - name: RECOMMENDATION_SERVICE_ADDR 232 | value: "recommendationservice:8080" 233 | - name: SHIPPING_SERVICE_ADDR 234 | value: "shippingservice:50051" 235 | - name: CHECKOUT_SERVICE_ADDR 236 | value: "checkoutservice:5050" 237 | - name: AD_SERVICE_ADDR 238 | value: "adservice:9555" 239 | # # ENV_PLATFORM: One of: local, gcp, aws, azure, onprem, alibaba 240 | # # When not set, defaults to "local" unless running in GKE, otherwies auto-sets to gcp 241 | # - name: ENV_PLATFORM 242 | # value: "aws" 243 | - name: ENABLE_PROFILER 244 | value: "0" 245 | # - name: CYMBAL_BRANDING 246 | # value: "true" 247 | # - name: FRONTEND_MESSAGE 248 | # value: "Replace this with a message you want to display on all pages." 249 | resources: 250 | requests: 251 | cpu: 100m 252 | memory: 64Mi 253 | limits: 254 | cpu: 200m 255 | memory: 128Mi 256 | --- 257 | apiVersion: v1 258 | kind: Service 259 | metadata: 260 | name: frontend 261 | spec: 262 | type: NodePort 263 | selector: 264 | app: frontend 265 | ports: 266 | - name: http 267 | port: 80 268 | targetPort: 8080 269 | --- 270 | apiVersion: v1 271 | kind: Service 272 | metadata: 273 | name: frontend-external 274 | spec: 275 | type: LoadBalancer 276 | selector: 277 | app: frontend 278 | ports: 279 | - name: http 280 | port: 80 281 | targetPort: 8080 282 | --- 283 | apiVersion: apps/v1 284 | kind: Deployment 285 | metadata: 286 | name: paymentservice 287 | spec: 288 | selector: 289 | matchLabels: 290 | app: paymentservice 291 | template: 292 | metadata: 293 | labels: 294 | app: paymentservice 295 | spec: 296 | serviceAccountName: default 297 | terminationGracePeriodSeconds: 5 298 | containers: 299 | - name: server 300 | image: vikashashoke/paymentservice:latest 301 | ports: 302 | - containerPort: 50051 303 | env: 304 | - name: PORT 305 | value: "50051" 306 | - name: DISABLE_PROFILER 307 | value: "1" 308 | readinessProbe: 309 | exec: 310 | command: ["/bin/grpc_health_probe", "-addr=:50051"] 311 | livenessProbe: 312 | exec: 313 | command: ["/bin/grpc_health_probe", "-addr=:50051"] 314 | resources: 315 | requests: 316 | cpu: 100m 317 | memory: 64Mi 318 | limits: 319 | cpu: 200m 320 | memory: 128Mi 321 | --- 322 | apiVersion: v1 323 | kind: Service 324 | metadata: 325 | name: paymentservice 326 | spec: 327 | type: ClusterIP 328 | selector: 329 | app: paymentservice 330 | ports: 331 | - name: grpc 332 | port: 50051 333 | targetPort: 50051 334 | --- 335 | apiVersion: apps/v1 336 | kind: Deployment 337 | metadata: 338 | name: productcatalogservice 339 | spec: 340 | selector: 341 | matchLabels: 342 | app: productcatalogservice 343 | template: 344 | metadata: 345 | labels: 346 | app: productcatalogservice 347 | spec: 348 | serviceAccountName: default 349 | terminationGracePeriodSeconds: 5 350 | containers: 351 | - name: server 352 | image: vikashashoke/productcatalogservice:latest 353 | ports: 354 | - containerPort: 3550 355 | env: 356 | - name: PORT 357 | value: "3550" 358 | - name: DISABLE_PROFILER 359 | value: "1" 360 | readinessProbe: 361 | exec: 362 | command: ["/bin/grpc_health_probe", "-addr=:3550"] 363 | livenessProbe: 364 | exec: 365 | command: ["/bin/grpc_health_probe", "-addr=:3550"] 366 | resources: 367 | requests: 368 | cpu: 100m 369 | memory: 64Mi 370 | limits: 371 | cpu: 200m 372 | memory: 128Mi 373 | --- 374 | apiVersion: v1 375 | kind: Service 376 | metadata: 377 | name: productcatalogservice 378 | spec: 379 | type: ClusterIP 380 | selector: 381 | app: productcatalogservice 382 | ports: 383 | - name: grpc 384 | port: 3550 385 | targetPort: 3550 386 | --- 387 | apiVersion: apps/v1 388 | kind: Deployment 389 | metadata: 390 | name: cartservice 391 | spec: 392 | selector: 393 | matchLabels: 394 | app: cartservice 395 | template: 396 | metadata: 397 | labels: 398 | app: cartservice 399 | spec: 400 | serviceAccountName: default 401 | terminationGracePeriodSeconds: 5 402 | containers: 403 | - name: server 404 | image: vikashashoke/cartservice:latest 405 | ports: 406 | - containerPort: 7070 407 | env: 408 | - name: REDIS_ADDR 409 | value: "redis-cart:6379" 410 | resources: 411 | requests: 412 | cpu: 200m 413 | memory: 64Mi 414 | limits: 415 | cpu: 300m 416 | memory: 128Mi 417 | readinessProbe: 418 | initialDelaySeconds: 15 419 | exec: 420 | command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] 421 | livenessProbe: 422 | initialDelaySeconds: 15 423 | periodSeconds: 10 424 | exec: 425 | command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] 426 | --- 427 | apiVersion: v1 428 | kind: Service 429 | metadata: 430 | name: cartservice 431 | spec: 432 | type: ClusterIP 433 | selector: 434 | app: cartservice 435 | ports: 436 | - name: grpc 437 | port: 7070 438 | targetPort: 7070 439 | --- 440 | apiVersion: apps/v1 441 | kind: Deployment 442 | metadata: 443 | name: loadgenerator 444 | spec: 445 | selector: 446 | matchLabels: 447 | app: loadgenerator 448 | replicas: 1 449 | template: 450 | metadata: 451 | labels: 452 | app: loadgenerator 453 | annotations: 454 | sidecar.istio.io/rewriteAppHTTPProbers: "true" 455 | spec: 456 | serviceAccountName: default 457 | terminationGracePeriodSeconds: 5 458 | restartPolicy: Always 459 | containers: 460 | - name: main 461 | securityContext: 462 | allowPrivilegeEscalation: false 463 | capabilities: 464 | drop: 465 | - ALL 466 | privileged: false 467 | readOnlyRootFilesystem: true 468 | image: vikashashoke/loadgenerator:latest 469 | env: 470 | - name: FRONTEND_ADDR 471 | value: "frontend:80" 472 | - name: USERS 473 | value: "10" 474 | resources: 475 | requests: 476 | cpu: 300m 477 | memory: 256Mi 478 | limits: 479 | cpu: 500m 480 | memory: 512Mi 481 | --- 482 | apiVersion: apps/v1 483 | kind: Deployment 484 | metadata: 485 | name: currencyservice 486 | spec: 487 | selector: 488 | matchLabels: 489 | app: currencyservice 490 | template: 491 | metadata: 492 | labels: 493 | app: currencyservice 494 | spec: 495 | serviceAccountName: default 496 | terminationGracePeriodSeconds: 5 497 | containers: 498 | - name: server 499 | image: vikashashoke/currencyservice:latest 500 | ports: 501 | - name: grpc 502 | containerPort: 7000 503 | env: 504 | - name: PORT 505 | value: "7000" 506 | - name: DISABLE_PROFILER 507 | value: "1" 508 | readinessProbe: 509 | exec: 510 | command: ["/bin/grpc_health_probe", "-addr=:7000"] 511 | livenessProbe: 512 | exec: 513 | command: ["/bin/grpc_health_probe", "-addr=:7000"] 514 | resources: 515 | requests: 516 | cpu: 100m 517 | memory: 64Mi 518 | limits: 519 | cpu: 200m 520 | memory: 128Mi 521 | --- 522 | apiVersion: v1 523 | kind: Service 524 | metadata: 525 | name: currencyservice 526 | spec: 527 | type: ClusterIP 528 | selector: 529 | app: currencyservice 530 | ports: 531 | - name: grpc 532 | port: 7000 533 | targetPort: 7000 534 | --- 535 | apiVersion: apps/v1 536 | kind: Deployment 537 | metadata: 538 | name: shippingservice 539 | spec: 540 | selector: 541 | matchLabels: 542 | app: shippingservice 543 | template: 544 | metadata: 545 | labels: 546 | app: shippingservice 547 | spec: 548 | serviceAccountName: default 549 | containers: 550 | - name: server 551 | image: vikashashoke/shippingservice:latest 552 | ports: 553 | - containerPort: 50051 554 | env: 555 | - name: PORT 556 | value: "50051" 557 | - name: DISABLE_PROFILER 558 | value: "1" 559 | readinessProbe: 560 | periodSeconds: 5 561 | exec: 562 | command: ["/bin/grpc_health_probe", "-addr=:50051"] 563 | livenessProbe: 564 | exec: 565 | command: ["/bin/grpc_health_probe", "-addr=:50051"] 566 | resources: 567 | requests: 568 | cpu: 100m 569 | memory: 64Mi 570 | limits: 571 | cpu: 200m 572 | memory: 128Mi 573 | --- 574 | apiVersion: v1 575 | kind: Service 576 | metadata: 577 | name: shippingservice 578 | spec: 579 | type: ClusterIP 580 | selector: 581 | app: shippingservice 582 | ports: 583 | - name: grpc 584 | port: 50051 585 | targetPort: 50051 586 | --- 587 | apiVersion: apps/v1 588 | kind: Deployment 589 | metadata: 590 | name: redis-cart 591 | spec: 592 | selector: 593 | matchLabels: 594 | app: redis-cart 595 | template: 596 | metadata: 597 | labels: 598 | app: redis-cart 599 | spec: 600 | containers: 601 | - name: redis 602 | image: redis:alpine 603 | ports: 604 | - containerPort: 6379 605 | readinessProbe: 606 | periodSeconds: 5 607 | tcpSocket: 608 | port: 6379 609 | livenessProbe: 610 | periodSeconds: 5 611 | tcpSocket: 612 | port: 6379 613 | volumeMounts: 614 | - mountPath: /data 615 | name: redis-data 616 | resources: 617 | limits: 618 | memory: 256Mi 619 | cpu: 125m 620 | requests: 621 | cpu: 70m 622 | memory: 200Mi 623 | volumes: 624 | - name: redis-data 625 | emptyDir: {} 626 | --- 627 | apiVersion: v1 628 | kind: Service 629 | metadata: 630 | name: redis-cart 631 | spec: 632 | type: ClusterIP 633 | selector: 634 | app: redis-cart 635 | ports: 636 | - name: tcp-redis 637 | port: 6379 638 | targetPort: 6379 639 | --- 640 | apiVersion: apps/v1 641 | kind: Deployment 642 | metadata: 643 | name: adservice 644 | spec: 645 | selector: 646 | matchLabels: 647 | app: adservice 648 | template: 649 | metadata: 650 | labels: 651 | app: adservice 652 | spec: 653 | serviceAccountName: default 654 | terminationGracePeriodSeconds: 5 655 | containers: 656 | - name: server 657 | image: vikashashoke/adservice:latest 658 | ports: 659 | - containerPort: 9555 660 | env: 661 | - name: PORT 662 | value: "9555" 663 | resources: 664 | requests: 665 | cpu: 200m 666 | memory: 180Mi 667 | limits: 668 | cpu: 300m 669 | memory: 300Mi 670 | readinessProbe: 671 | initialDelaySeconds: 20 672 | periodSeconds: 15 673 | exec: 674 | command: ["/bin/grpc_health_probe", "-addr=:9555"] 675 | livenessProbe: 676 | initialDelaySeconds: 20 677 | periodSeconds: 15 678 | exec: 679 | command: ["/bin/grpc_health_probe", "-addr=:9555"] 680 | --- 681 | apiVersion: v1 682 | kind: Service 683 | metadata: 684 | name: adservice 685 | spec: 686 | type: ClusterIP 687 | selector: 688 | app: adservice 689 | ports: 690 | - name: grpc 691 | port: 9555 692 | targetPort: 9555 693 | --------------------------------------------------------------------------------