Bu rehber, ECommerce API'sini yerel geliştirme ortamında ve production'da nasıl çalıştıracağınızı gösterir.
git clone <repository-url>
cd ECommerce.Solution# Tüm infrastructure servislerini başlat
docker-compose up -d postgres redis elasticsearch rabbitmq
# Servislerin durumunu kontrol et
docker-compose ps# Migration'ları uygula
dotnet ef database update --project src/Infrastructure/ECommerce.Infrastructure --startup-project src/Presentation/ECommerce.WebAPI --context ECommerceDbContext# Development ortamında çalıştır
ASPNETCORE_ENVIRONMENT=Development dotnet run --project src/Presentation/ECommerce.WebAPI
# Windows PowerShell için:
$env:ASPNETCORE_ENVIRONMENT="Development"; dotnet run --project src/Presentation/ECommerce.WebAPIUygulama başarıyla başladıktan sonra:
- API Base URL: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger
- Health Checks: http://localhost:8080/health
- Health Checks UI: http://localhost:8080/healthchecks-ui
- Tarayıcınızda http://localhost:8080/swagger adresine gidin
- Tüm API endpoint'lerini görebilirsiniz
GET /api/v1.0/products- Ürünleri listeleGET /api/v1.0/products/search- Ürün araPOST /api/v1.0/products- Yeni ürün oluşturPUT /api/v1.0/products/{id}- Ürün güncelleDELETE /api/v1.0/products/{id}- Ürün sil
GET /api/v1.0/orders- Siparişleri listeleGET /api/v1.0/orders/{id}- Sipariş detayıPOST /api/v1.0/orders- Yeni sipariş oluşturPUT /api/v1.0/orders/{id}/status- Sipariş durumu güncelle
GET /api/v1.0/customers- Müşterileri listeleGET /api/v1.0/customers/{id}- Müşteri detayıPOST /api/v1.0/customers- Yeni müşteri kaydet
POST /api/v1.0/customers
{
"firstName": "Ahmet",
"lastName": "Yılmaz",
"email": "ahmet@example.com",
"phoneNumber": "+905551234567"
}POST /api/v1.0/products
{
"name": "Kablosuz Kulaklık",
"description": "Yüksek kaliteli kablosuz kulaklık",
"price": 299.99,
"currency": "TRY",
"stockQuantity": 50,
"categoryId": "123e4567-e89b-12d3-a456-426614174000"
}POST /api/v1.0/orders
{
"customerId": "123e4567-e89b-12d3-a456-426614174001",
"items": [
{
"productId": "123e4567-e89b-12d3-a456-426614174000",
"quantity": 2,
"unitPrice": 299.99
}
],
"shippingAddress": {
"street": "Atatürk Cad. No:123",
"city": "İstanbul",
"state": "İstanbul",
"postalCode": "34000",
"country": "Türkiye"
}
}Eğer RabbitMQ bağlantı hatası alıyorsanız:
# RabbitMQ'yu yeniden başlat
docker-compose restart rabbitmq
# Logları kontrol et
docker-compose logs rabbitmqElasticsearch tek node'da çalıştığı için "yellow" durumda olabilir. Bu normal bir durumdur.
Health check'leri kontrol etmek için:
- http://localhost:8080/health - Basit health check
- http://localhost:8080/health/detailed - Detaylı health check
Tüm uygulamayı Docker ile çalıştırmak için:
# Tüm servisleri başlat (uygulama dahil)
docker-compose up -d
# Logları takip et
docker-compose logs -f ecommerce-api-
Development Environment: Uygulama development modunda çalışırken detaylı loglar ve Swagger UI aktiftir.
-
Database: PostgreSQL veritabanı otomatik olarak oluşturulur ve migration'lar uygulanır.
-
Caching: Redis cache servisi aktiftir ve API response'ları cache'lenir.
-
Search: Elasticsearch search servisi aktiftir ve ürün aramaları için kullanılır.
-
Messaging: RabbitMQ event messaging için kullanılır.
- Health Checks UI: http://localhost:8080/healthchecks-ui
- RabbitMQ Management: http://localhost:15672 (guest/guest)
- Elasticsearch: http://localhost:9200
Production deployment için docker-compose.prod.yml dosyasını kullanın:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -dHerhangi bir sorun yaşarsanız:
- GitHub Issues'da yeni bir issue açın
- Logları kontrol edin:
docker-compose logs - Health check'leri kontrol edin: http://localhost:8080/health