Squidex / squidex

Headless CMS and Content Managment Hub
https://squidex.io
MIT License
2.24k stars 448 forks source link

Cannot run locally docker image of squidex #277

Closed zhangpengchen closed 4 years ago

zhangpengchen commented 6 years ago

Hi @SebastianStehle ,

Executing 'docker run squidex/squidex' or 'docker run squidex/squidex:dev' locally both returned a MongoDB timeout error.

I have stopped my MongoDB service locally before executing the above docker command.

Verified with the following command: netstat -na | find "27017"

See the following error message, do I need to do something manually before executing the above docker command? { "logLevel": "Error", "message": "An error occurred while reading the key ring.", "eventId": { "id": 48 }, "exception": { "type": "System.TimeoutException", "message": "A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : \"1\", ConnectionMode : \"Automatic\", Type : \"Unknown\", State : \"Disconnected\", Servers : [{ ServerId: \"{ ClusterId : 1, EndPoint : \"Unspecified/localhost:27017\" }\", EndPoint: \"Unspecified/localhost:27017\", State: \"Disconnected\", Type: \"Unknown\", HeartbeatException: \"MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Cannot assign requested address [::1]:27017\n at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\n at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.TcpStreamFactory.d7.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.TcpStreamFactory.d4.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.BinaryConnection.d48.MoveNext()\n --- End of inner exception stack trace ---\n at MongoDB.Driver.Core.Connections.BinaryConnection.d48.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Servers.ServerMonitor.d__27.MoveNext()\" }] }.", "stackTrace": " at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)\n at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)\n at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)\n at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)\n at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)\n at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)\n at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)\n at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSession[TResult](Func2 func, CancellationToken cancellationToken)\n at MongoDB.Driver.MongoCollectionImpl1.FindSync[TProjection](FilterDefinition1 filter, FindOptions2 options, CancellationToken cancellationToken)\n at MongoDB.Driver.FindFluent2.ToCursor(CancellationToken cancellationToken)\n at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)\n at Squidex.Domain.Users.MongoDb.MongoXmlRepository.GetAllElements() in /src/Squidex.Domain.Users.MongoDb/MongoXmlRepository.cs:line 32\n at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()\n at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)\n at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow)" }, "app": { "name": "Squidex", "version": "1.0.0.0", "sessionId": "66dbd46f-38ac-4986-b06a-299a3fc2e4ea" }, "timestamp": "2018-04-19T11:49:13.2573239Z", "category": "Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider" }

{ "logLevel": "Information", "message": "Key ring failed to load during application startup.", "exception": { "type": "System.TimeoutException", "message": "A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : \"1\", ConnectionMode : \"Automatic\", Type : \"Unknown\", State : \"Disconnected\", Servers : [{ ServerId: \"{ ClusterId : 1, EndPoint : \"Unspecified/localhost:27017\" }\", EndPoint: \"Unspecified/localhost:27017\", State: \"Disconnected\", Type: \"Unknown\", HeartbeatException: \"MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Cannot assign requested address [::1]:27017\n at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\n at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.TcpStreamFactory.d7.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.TcpStreamFactory.d4.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Connections.BinaryConnection.d48.MoveNext()\n --- End of inner exception stack trace ---\n at MongoDB.Driver.Core.Connections.BinaryConnection.d48.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at MongoDB.Driver.Core.Servers.ServerMonitor.d__27.MoveNext()\" }] }.", "stackTrace": " at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)\n at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)\n at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)\n at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)\n at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)\n at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)\n at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)\n at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSession[TResult](Func2 func, CancellationToken cancellationToken)\n at MongoDB.Driver.MongoCollectionImpl1.FindSync[TProjection](FilterDefinition1 filter, FindOptions2 options, CancellationToken cancellationToken)\n at MongoDB.Driver.FindFluent2.ToCursor(CancellationToken cancellationToken)\n at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList[TDocument](IAsyncCursorSource1 source, CancellationToken cancellationToken)\n at Squidex.Domain.Users.MongoDb.MongoXmlRepository.GetAllElements() in /src/Squidex.Domain.Users.MongoDb/MongoXmlRepository.cs:line 32\n at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()\n at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)\n at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow)\n at Microsoft.AspNetCore.DataProtection.Internal.DataProtectionStartupFilter.Configure(Action1 next)" }, "app": { "name": "Squidex", "version": "1.0.0.0", "sessionId": "66dbd46f-38ac-4986-b06a-299a3fc2e4ea" }, "timestamp": "2018-04-19T11:49:13.2632827Z", "category": "Microsoft.AspNetCore.DataProtection.Internal.DataProtectionStartupFilter" }

SebastianStehle commented 6 years ago

What do you expect to happen?

zhangpengchen commented 6 years ago

@SebastianStehle I am kind of lost. How to run Squidex locally. I am not sure executing a docker command 'docker run squidex/squidex' will prepare a MongoDB environment for me or not.

I also tried keep my local MongoDB running with port localhost:27017, but also not luck.

Seem I am doing something wrong, but don't know what.

BoasE commented 6 years ago

have you tried to configure the mongodb adress to your lan ip ? afaik from inside of your docker localhost doesn't match the outer machine

zhangpengchen commented 6 years ago

@BoasE Thks very much. A docker container is a separate thing from my computer, So I will not be able to connect to localhost. Make senses. I will try to have a look https://docs.docker.com/engine/reference/run/#network-host

BoasE commented 6 years ago

Your Welcome.

With some other DockerImages I use scripts to determine my LAN IP, which is for the cotnainer the same as for my machine, and dynamically pass them to the docker container (ENVVars).

PS: Maybe you have to check your firewall settings too when you are using a LAN IP. Not sure about that