25
25
- [ Asynchronous Microservices Components] ( #asynchronous-microservices-components )
26
26
- [ Bridging Synchronous and Asynchronous Components In DriveDeposits Microservices] ( #bridging-synchronous-and-asynchronous-components-in-drivedeposits-microservices )
27
27
- [ Deployment of Microservices] ( #deployment-of-microservices )
28
- - Serverless: AWS using SAM which uses CloudFormation under the
29
- hood [ #serverless-aws-using-sam-which-uses-cloudformation-under-the-hood ]
30
- - Server-based: Run the REST and gRPC servers Natively, With Docker Compose And
31
- Kubernetes ![ #server-based-run-the-rest-and-grpc-servers-natively-with-docker-compose-and-kubernetes ]
28
+ - [ Serverless: AWS using SAM which uses CloudFormation under the hood ] ( #serverless-aws-using-sam-which-uses-cloudformation-under-the-hood )
29
+ - [ Server-based: Run the REST and gRPC servers Natively, With Docker Compose And Kubernetes! ] ( #server-based-run-the-rest-and-grpc-servers-natively-with-docker-compose-and-kubernetes )
30
+ - [ Test microservices integration ] ( #test-microservices-integration )
31
+ - [ Test AWS Lambda microservice directly ] ( #test-aws-lambda-microservice-directly )
32
32
- [ Hybrid Integration Testing Tool] ( #hybrid-integration-testing-tool )
33
33
- [ Running Tests] ( #running-tests )
34
34
- [ Integration tests] ( #integration-tests )
@@ -296,7 +296,7 @@ microservices ecosystem.
296
296
297
297
### Deployment of Microservices
298
298
299
- - Serverless: AWS using SAM which uses CloudFormation under the hood
299
+ #### Serverless: AWS using SAM which uses CloudFormation under the hood
300
300
301
301
This project uses SAM (Serverless Application Model) for deploying the following AWS resources that support our
302
302
microservices architecture:
@@ -313,146 +313,156 @@ microservices application.
313
313
This project also utilizes the [ Justfile] ( https://github.com/casey/just ) for managing project-level recipes and
314
314
microservices deployment tasks.
315
315
316
- #### Deploy all serverless microservices and AWS resources
316
+ - ** Deploy all serverless microservices and AWS resources**
317
317
318
318
` just deploy-drive-deposits-dynamodb-queries `
319
319
320
320
This command calls dependent recipes to deploy the entire microservices ecosystem, including the event bus, event rules
321
321
with lambda targets, and lambda functions for queries.
322
322
323
- #### Delete all serverless microservices and AWS resources
323
+ - ** Delete all serverless microservices and AWS resources**
324
324
325
325
` just deployed-delete-drive-deposits-event-bus `
326
326
327
327
This command calls dependent recipes to delete all deployed microservices and resources, including event rules, lambda
328
328
targets, event bus, and query-related resources.
329
329
330
- #### Deploy event bridge with event rules and target lambda microservices components
330
+ - ** Deploy event bridge with event rules and target lambda microservices components**
331
331
332
332
` just deploy-drive-deposits-event-rules `
333
333
334
334
This command deploys the event-driven components of our microservices architecture, including EventBridge, EventBus, and
335
335
related resources.
336
336
337
- #### Deploy Lambda Function with API Gateway and DynamoDB Reader microservices components
337
+ - ** Deploy Lambda Function with API Gateway and DynamoDB Reader microservices components**
338
338
339
339
` just deploy-drive-deposits-dynamodb-queries-only `
340
340
341
- - Server-based: Run the REST and gRPC servers Natively, With Docker Compose And Kubernetes!
342
- - ** Natively** (without Docker)
341
+ #### Server-based: Run the REST and gRPC servers Natively, With Docker Compose And Kubernetes!
343
342
344
- ` just run-drive-deposits-grpc-server `
343
+ - ** Natively ** (without Docker)
345
344
346
- ` just run-drive-deposits-rest- grpc-gateway -server `
345
+ ` just run-drive-deposits-grpc-server `
347
346
348
- - ** Docker Compose**
349
- Start Docker Desktop first.
347
+ ` just run-drive-deposits-rest-grpc-gateway-server `
350
348
351
- Then run:
349
+ - ** Docker Compose**
350
+ Start Docker Desktop first.
352
351
353
- ` just compose-up-grpc-server `
352
+ Then run:
354
353
355
- ` just compose-up-rest -server `
354
+ ` just compose-up-grpc -server `
356
355
357
- - ** Kubernetes** (It uses local images to show k8s for local)
358
- Install and start Colima with Kubernetes enabled:
359
- ``` bash
360
- brew install colima
361
- colima start --cpu 2 --memory 4 --kubernetes
362
- ```
363
- When you run colima start --kubernetes, Colima automatically:
356
+ ` just compose-up-rest-server `
364
357
365
- Creates a new Docker context named " colima"
366
- Creates a new Kubernetes context
367
- Sets both contexts as current/active
368
- Updates ~ /.docker/config.json for Docker context
369
- Updates ~ /.kube/config for Kubernetes context
358
+ - ** Kubernetes** (It uses local images to show k8s for local)
359
+ Install and start Colima with Kubernetes enabled:
360
+ ``` bash
361
+ brew install colima
362
+ colima start --cpu 2 --memory 4 --kubernetes
363
+ ```
364
+ When you run colima start --kubernetes, Colima automatically:
365
+
366
+ Creates a new Docker context named "colima"
367
+ Creates a new Kubernetes context
368
+ Sets both contexts as current/active
369
+ Updates ~ /.docker/config.json for Docker context
370
+ Updates ~ /.kube/config for Kubernetes context
371
+
372
+ List all available Docker and Kubernetes contexts:
373
+ ``` bash
374
+ docker context list
375
+ kubectl config get-contexts
376
+ ```
370
377
371
- List all available Docker and Kubernetes contexts :
378
+ Verify your Docker and Kubernetes context :
372
379
```bash
373
- docker context list
374
- kubectl config get-contexts
380
+ docker context show
381
+ kubectl config current-context
375
382
```
383
+ Docker also stores context information in ~/.docker/config.json and Kubernetes stores context information in ~
384
+ /.kube/config.
376
385
377
- Verify your Docker and Kubernetes context:
378
- ` ` ` bash
379
- docker context show
380
- kubectl config current-context
381
- ` ` `
382
- Docker also stores context information in ~ /.docker/config.json and Kubernetes stores context information in ~
383
- /.kube/config.
384
-
385
- You can always switch back to Colima' s context when needed using:
386
- ```bash
387
- docker context use colima
388
- kubectl config use-context colima
389
- ```
386
+ You can always switch back to Colima's context when needed using:
387
+ ```bash
388
+ docker context use colima
389
+ kubectl config use-context colima
390
+ ```
390
391
391
- Install Helm if not already installed:
392
+ Install Helm if not already installed:
392
393
393
- ```bash
394
- brew install helm
395
- ```
394
+ ```bash
395
+ brew install helm
396
+ ```
396
397
397
- Add and update the nginx-ingress Helm repository:
398
+ Add and update the nginx-ingress Helm repository:
398
399
399
- ```bash
400
- helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
401
- helm repo update
402
- helm repo list
403
- ```
400
+ ```bash
401
+ helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
402
+ helm repo update
403
+ helm repo list
404
+ ```
404
405
405
- Install the nginx-ingress controller:
406
+ Install the nginx-ingress controller:
406
407
407
- ```bash
408
- helm install ingress-nginx ingress-nginx/ingress-nginx
409
- ```
408
+ ```bash
409
+ helm install ingress-nginx ingress-nginx/ingress-nginx
410
+ ```
410
411
411
- Monitor the nginx ingress controller logs:
412
+ Monitor the nginx ingress controller logs:
412
413
413
- ```bash
414
- kubectl logs -l app.kubernetes.io/name=ingress-nginx -f
415
- ```
414
+ ```bash
415
+ kubectl logs -l app.kubernetes.io/name=ingress-nginx -f
416
+ ```
416
417
417
- Only if using ingress controller:
418
- Add the domain to your /etc/hosts:
418
+ Only if using ingress controller:
419
+ Add the domain to your /etc/hosts:
419
420
420
- ```bash
421
- echo "127.0.0.1 api.drivedeposits.local" | sudo tee -a /etc/hosts
422
- ```
421
+ ```bash
422
+ echo "127.0.0.1 api.drivedeposits.local" | sudo tee -a /etc/hosts
423
+ ```
423
424
424
- Create AWS credentials secret for the gRPC server:
425
+ Create AWS credentials secret for the gRPC server:
425
426
426
- ```bash
427
- kubectl create secret generic aws-credentials \
428
- --from-literal=AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
429
- --from-literal=AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
430
- --from-literal=AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
431
- ```
427
+ ``` bash
428
+ kubectl create secret generic aws-credentials \
429
+ --from-literal=AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
430
+ --from-literal=AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
431
+ --from-literal=AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
432
+ ```
432
433
433
- To verify the secret:
434
+ To verify the secret:
434
435
435
- ```bash
436
- kubectl get secret aws-credentials -o json
437
- ```
436
+ ` ` ` bash
437
+ kubectl get secret aws-credentials -o json
438
+ ` ` `
438
439
439
- Deploy the services:
440
+ Deploy the services:
440
441
441
- ```bash
442
- just k8s-grpc-server
443
- just k8s-rest-server
444
- ```
442
+ ` ` ` bash
443
+ just k8s-grpc-server
444
+ just k8s-rest-server
445
+ ` ` `
445
446
446
- The REST API will now be accessible at http://api.drivedeposits.local
447
+ The REST API will now be accessible at http://api.drivedeposits.local
447
448
448
449
# ### Test microservices integration
449
450
450
451
In justfile set
452
+
451
453
for native and docker-compose:
454
+
455
+ ` ` ` justfile
452
456
rest_gateway_server_host := " http://localhost:3000"
457
+ ` ` `
458
+
453
459
And
460
+
454
461
for k8s with ingress:
462
+
463
+ ` ` ` justfile
455
464
rest_gateway_server_host := " http://api.drivedeposits.local"
465
+ ` ` `
456
466
457
467
Send an HTTP request to the REST gateway server, which communicates with other microservices:
458
468
@@ -517,11 +527,8 @@ This streamlined approach significantly enhances development efficiency and syst
517
527
518
528
# ### AWS Populated with Basic Data for Queries Lambda
519
529
520
- ##### Using REST gateway and gRPC Servers: start
521
-
522
- `just run-drive-deposits-grpc-server`
523
-
524
- `just run-drive-deposits-rest-grpc-gateway-server`
530
+ See [Deployment of Microservices](# deployment-of-microservices) section for deploying the microservices and AWS
531
+ resources.
525
532
526
533
# #### send curl post requests to populate
527
534
0 commit comments