Eshoponcontainers: Database issue

Created on 23 Jan 2018  路  4Comments  路  Source: dotnet-architecture/eShopOnContainers

i am not able to understand the database flow can anyone explain me how the database is created or how the data flow will go.?

Most helpful comment

The connection string used is the one in the docker-compose.override:
https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/docker-compose.override.yml
So, this one:
ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}

"sql.data" is the internal service name that is resolved within the Docker host.
If you want to connect from the outside (i.e. SQL Server Manager), you should be able to do it using localhost and the published post, as it is configured in the same file:
sql.data:
environment:
- SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
ports:
- "5433:1433"

So, localhost,5433

Closing this issue.

All 4 comments

  • Each microservice has/owns each own database.
  • There鈥檚 a container per each type of database: SQL Server, MongoDB, Redis
  • The client apps (web, mobile, etc) talk to each microservice.
  • The databases are created and populated with sample data by using EF Migrations, from code, the first time each microservice is started.

Jut to clarify some of the points mentioned by @CESARDELATORRE

  1. Code in Program.cs of each microservice creates and seeds the database if needed.
  2. Each microservice uses its own database, all of them against the same SQL Server (although this is not mandatory). So we have only one SQL Server container.
  3. Redis is used only in Basket microservice as a cache
  4. MongoDb is used in locations microservice
  5. Client apps (Xamarin, web) calls microservices via http rest-like calls
  6. Microservices communicate between them using RabbitMQ in a event-based model

Hope this makes it clear!

@eiximenis Great explanation.
If I am running the WebSpa with vs 2017 by F5 option . Docker running in the background.
How can I connect the SQL SERVER to the tcp ip defined in the appsettings json ?
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word",

Anyone connected to the db's of the project?

The connection string used is the one in the docker-compose.override:
https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/docker-compose.override.yml
So, this one:
ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}

"sql.data" is the internal service name that is resolved within the Docker host.
If you want to connect from the outside (i.e. SQL Server Manager), you should be able to do it using localhost and the published post, as it is configured in the same file:
sql.data:
environment:
- SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
ports:
- "5433:1433"

So, localhost,5433

Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings