VilnaCRM-Org/user-service-infrastructure

PoC for basic implementation

Open

#18 opened on Apr 13, 2025

View on GitHub
 (0 comments) (0 reactions) (1 assignee)Python (0 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (0 stars)
PR merge metrics
 (PR metrics pending)

Description

POC for Basic Implementation of the User Service

Description

Implement a proof-of-concept (POC) for the basic user service that will handle user management operations (e.g., user creation and notifications via email). The service should be containerized and deployed with AWS App Runner, and it must integrate with our existing infrastructure components such as RDS for persistent storage and SQS for asynchronous processing. This POC will help validate the connectivity and overall workflow between the user service and the other infrastructure components defined in our Pulumi configuration.

Tasks

  • Review ECR Repository Configuration

    • Confirm that the ECR repository for the user service (user-service-ecr) is set up correctly.
    • [Reference: infrastructure.py#L105]
  • Configure App Runner Service for the User Service

    • Set up the App Runner service’s source configuration to use the user service container from the ECR repository.
    • Verify that the runtime environment variables (SERVER_NAME, TRUSTED_HOSTS, DATABASE_URL) are properly configured.
    • [Reference: infrastructure.py#L145]
  • Validate IAM Role Setup

    • Ensure that IAM roles for App Runner (both for accessing ECR and SQS) are properly set up and attached.
    • Check the apprunner-access-role for ECR access and apprunner-instance-role for SQS interactions.
    • [References: infrastructure.py#L50 and infrastructure.py#L160]
  • Integrate SQS Queues

    • Verify that the SQS queues for send-email and insert-user (with their corresponding DLQs) are configured as intended.
    • Ensure these queues are referenced in the IAM policy for the user service to enable required actions like SendMessage and SendMessageBatch.
    • [Reference: infrastructure.py#L190]
  • Test Database Connectivity

    • Confirm that the DATABASE_URL environment variable is correctly generated and points to the RDS MariaDB instance.
    • Test connection from the deployed user service to the RDS instance to validate proper CRUD operations on user data.
    • [Reference: infrastructure.py#L140]
  • Perform End-to-End Testing

    • Deploy a test container of the user service.
    • Verify that new user registrations result in messages being correctly sent to the configured SQS queues.
    • Validate that these actions trigger the appropriate operations within the database (e.g., user creation).

Acceptance Criteria

  • The ECR repository (user-service-ecr) is confirmed to be accessible and properly configured.
  • The App Runner service deploys the user service container using the correct image and runtime environment variables.
  • IAM roles and policies are validated, ensuring that App Runner has the necessary permissions for ECR access and SQS interactions.
  • The SQS queues (send-email and insert-user) and their dead-letter configurations are correctly set up and functioning.
  • The user service successfully connects to the RDS instance using DATABASE_URL and performs basic user management operations.
  • End-to-end testing demonstrates that user actions (e.g., registration) trigger the expected message flows and database operations.

Contributor guide