Learn how to set up the Pagopa eCommerce platform locally for development and integration testing with our comprehensive guide.
Introduction
In today’s rapidly evolving digital landscape, local development for eCommerce has become essential for businesses aiming to deliver seamless online shopping experiences. Setting up the Pagopa eCommerce platform locally not only streamlines the development process but also facilitates thorough integration testing. This guide provides a step-by-step approach to configuring and running the Pagopa eCommerce platform on your local machine, ensuring a robust environment for development and testing.
Prerequisites
Before diving into the setup, ensure you have the following tools and software installed:
- Docker: Containerization platform to manage and deploy microservices.
- Docker Compose: Tool for defining and running multi-container Docker applications.
- Git: Version control system to clone repositories and manage code versions.
Configuration
The heart of the local development setup lies in the .env file, where various configurations related to containers can be tailored to your needs. Key parameters include:
- Container Ports: Define the ports each service will listen to, such as
MONGO_PORT,REDIS_PORT, and others. - Service Branches: Specify the Git branch or commit SHA for each microservice to run the desired version.
Customizing Ports
Adjusting the ports ensures that services do not conflict with other applications on your machine. For example:
MONGO_PORT=27017
REDIS_PORT=6379
ECOMMERCE_TRANSACTIONS_PORT=8080
Selecting Service Versions
Choose the specific branch or commit SHA for each service to test different versions:
NODO_MOCK_COMMIT_SHA=main
ECOMMERCE_PAYMENT_METHODS_COMMIT_SHA=v1.2.3
Running the Pagopa eCommerce Platform
With configurations in place, you can initiate the platform using Docker Compose:
docker-compose up
Using default settings, the following services will be accessible:
- Nodo Mock: http://localhost:3002/webservices/pof/PagamentiTelematiciPspNodoservice
- Transactions Service: http://localhost:8080/transactions
- Payment Methods Service: http://localhost:8083/payment-methods
- Payment Requests Service: http://localhost:8088/payment-requests
- Helpdesk Commands Service: http://localhost:8087/commands
Additionally, access MongoDB and Redis data through their respective web interfaces:
- Redis Insight: http://localhost:8001
- Mongo Express: http://localhost:8081
Tip: To connect MongoDB with external clients like Mongo Compass, update your hosts file with:
127.0.0.1 pagopa-ecommerce-mongo
Customizing Microservices
Each microservice can be individually configured by editing its specific .env file. This flexibility allows you to tailor services to match your development and testing requirements.
After making changes, rebuild the containers to apply the new configurations:
docker-compose build SERVICE_NAME [--no-cache]
Service Integration Notes
Understanding the functionality of each service enhances your development workflow:
Helpdesk Commands Service
Provides manual operations support, including:
- Refund Operations: Allows manual transaction refunds across various payment gateways.
- Notification Management: Facilitates email notification resending.
- Integration Testing: Verifies transaction state transitions through polling-based tests.
eCommerce CDC Service
Offers real-time Change Data Capture capabilities:
- Transaction Event Processing: Monitors MongoDB for transaction lifecycle events.
- Real-time Updates: Processes transaction state changes promptly.
- Event Streaming: Captures events like transaction creation, authorization, and completion.
- Integration Testing: Ensures comprehensive event processing for transaction flows.
Troubleshooting
Encounter issues during setup? Here’s a quick fix:
If you face output clipping or log limits, adjust your Docker Compose command:
DOCKER_BUILDKIT=1 docker-compose up
This enhances the build process, preventing log overflow and ensuring smoother operations.
Conclusion
Setting up the Pagopa eCommerce platform locally for development and testing is a strategic move for enhancing your eCommerce solutions. By following this guide, you can create a robust development environment tailored to your specific needs, ensuring efficient integration testing and streamlined workflows.
Ready to elevate your local development for eCommerce? Visit BLKDG to discover innovative digital solutions designed to empower your local brand and optimize your online presence.