import subprocess

# List of microservices and their corresponding ports
microservices = [
    ("product_service", "8001"),
    ("customer_service", "8002"),
    # Add other microservices here
]

# Loop through each microservice and run it in the background
for service, port in microservices:
    command = [
        "uvicorn", f"{service}.asgi:application", "--host", "0.0.0.0", f"--port={port}"
    ]
    subprocess.Popen(command)

print("All microservices are now running.")
