microsoft/TailwindTraders-Backend

Running locally with docker-compose up fails

StefH opened this issue · 3 comments

StefH commented

After running docker-compose up, not all containers are up and running:
image

It seems that there is an error connecting to sql:

dbug: Microsoft.EntityFrameworkCore.Migrations[20400]
      Migrating using database 'Microsoft.TailWindTraders.Product' on server 'sql.data'.
dbug: Microsoft.EntityFrameworkCore.Database.Connection[20000]
      Opening connection to database 'Microsoft.TailWindTraders.Product' on server 'sql.data'.
dbug: Microsoft.EntityFrameworkCore.Database.Connection[20004]
      An error occurred using the connection to database 'Microsoft.TailWindTraders.Product' on server 'sql.data'.
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)

&
source profile

2019-05-19T16:50:21.786341800Z 
Unhandled Exception: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)

stock java

2019-05-19 16:51:19.299 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
2019-05-19T16:51:19.331692900Z 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

Hi @StefH!

Is the sql.data container running? If using Docker Desktop for Win/Mac just note that this is a SQL Server container and it requires some RAM, so you maybe to need to increase the RAM of Docker VM to 4 Gb.

StefH commented

After increasing the memory for Docker to 8GB and 2GB swap, I was able to start almost all services.

coupon-api still failed with this error:

Connection to CosmosDB successful
Starting seed data...
End seed success
{ MongoNetworkError: failed to connect to server [nosql.data:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 172.18.0.9:27017]
    at Pool.<anonymous> (/src/node_modules/mongodb-core/lib/topologies/server.js:564:11)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at Connection.<anonymous> (/src/node_modules/mongodb-core/lib/connection/pool.js:317:12)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at Socket.<anonymous> (/src/node_modules/mongodb-core/lib/connection/connection.js:246:50)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:66:8)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
  name: 'MongoNetworkError',
  errorLabels: [ 'TransientTransactionError' ],
  [Symbol(mongoErrorContextSymbol)]: {} }

Manually restarting worked.

The stock-api still has errors like:

2019-05-31T09:16:09.972784500Z 
2019-05-31 09:16:09.969 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
2019-05-31T09:16:09.972795400Z 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

Solved in commit c5b93d4