Thực hiện deploy để kiểm thử

Thực hiện deploy để kiểm thử"

  1. Trong productsservice project chúng ta chọn biểu tượng Grade và chọn jar để đóng gói project

Architect

  1. Tiếp theo chúng ta cần tạo một image mới. Mở DockerFile chọn Edit dockerfile

Architect

  1. Trong giao diện Edit Dockerfile. Thay đổi image tag là 1.1.0 để tạo một Docker image mới sau chọn chọn Run

Architect

  1. Push image vừa tạo lên ECR Repository bằng cách mở AWS Toolkit chọn ERC và sau đó chọn productsservice. Cuối cùng click phải chọn Push to Repository

Architect

  1. Trong popup Push to ECR chọn Local image là productsservice:1.0.0Remote Tag1.1.0 và chọn Push

Architect

  1. Kiểm tra image vừa push trên giao điện ECR

Architect

  1. Mở FCJ2024_CDK project. Sau đó mở file ProductsServiceStack và thay đổi tag trong phần fargateTaskDefinition.addContainer1.1.0

Architect

  1. Tiếp theo, sử dụng cdk deploy --all --require-approval never

Architect

  1. Tiếp theo ta cần kiểm tra xem task definition mới của chúng ta có chạy hay không bằng cách mở giao điện ECS chọn CLuster sau đó chọn ECommerce và cuối cùng là chọn task

Architect

  1. Truy cập giao điện DymanoBD để kiểm tra product table đã được tạo hạy chưa

Architect

  1. Access the API Gateway interface to verify the created methods.

    Architect

  2. In the API Gateway interface, navigate to Stages and copy the Invoke URL for testing the API in Postman.

    Architect

  3. To add a product using the POST method, open Postman and create a POST request with the endpoint Invoke URL/product.

    Architect

  4. Next, pass parameters by selecting Body and choosing raw. Then enter the data in the following format:

    {
        "name": "Product1",
        "code": "COD1",
        "model": "Model1",
        "price": 10.50
    }
    

    Press Send to submit the request. Similarly, you can add more product data.

Architect

  1. Tiếp theo chúng ta sẽ lấy tất cả product đã tạo bằng phương thức GET với đường dẫn là Invoke URL/product

Architect

  1. Làm tương tự với các phương thức còn lại.

  2. Next, retrieve all created products using the GET method with the endpoint Invoke URL/product.

    Architect

  3. Similarly, perform the same steps for the remaining methods.