High Availability Shared Storage using Azure File Storage

I am following the following link to set up a High Availability server on an Azure hosted 2012 R2 VM using Octopus 3.4.0

I am following the steps to setup Shared Storage
and am using a mounted SMB 3 share via Azure File Storage https://azure.microsoft.com/en-us/services/storage/files/

My share is successfully mounted as a local drive y:
net use y: \.file.core.windows.net\support /u:

And am running the following command to point Octopus at the shares storage location
Octopus.Server.exe path --artifacts y:\Octopus\data\artifacts
Octopus.Server.exe path --taskLogs y:\Octopus\Data\TaskLogs
Octopus.Server.exe path --nugetRepository y:\Octopus\Data\Packages

The service fails to start with the following exception in the logs.
"2016-09-01 07:11:45.9772 7 FATAL Unhandled AppDomain exception occurred: An exception was thrown while invoking the constructor ‘Void .ctor(Octopus.Shared.Time.IClock, Octopus.Core.RelationalStorage.IRelationalStore, Octopus.Core.Model.Logging.ILogEncoder, Octopus.Shared.Util.IOctopusFileSystem, Octopus.Shared.Util.ISemaphore, Octopus.Server.Orchestration.Logging.IServerLogService)’ on type ‘ServerLogStorage’. —> Could not find a part of the path ‘y:\Octopus\Data\TaskLogs’. (See inner exception for details.)
Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor ‘Void .ctor(Octopus.Shared.Time.IClock, Octopus.Core.RelationalStorage.IRelationalStore, Octopus.Core.Model.Logging.ILogEncoder, Octopus.Shared.Util.IOctopusFileSystem, Octopus.Shared.Util.ISemaphore, Octopus.Server.Orchestration.Logging.IServerLogService)’ on type ‘ServerLogStorage’. —> Could not find a part of the path ‘y:\Octopus\Data\TaskLogs’. (See inner exception for details.) —> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘y:\Octopus\Data\TaskLogs’.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at Octopus.Shared.Util.OctopusPhysicalFileSystem.EnsureDirectoryExists(String directoryPath) in Y:\Work\refs\tags\3.4.0\source\Octopus.Shared\Util\OctopusPhysicalFileSystem.cs:line 321
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
— End of inner exception stack trace —
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Features.LazyDependencies.LazyRegistrationSource.<>c__DisplayClass51.<>c__DisplayClass7.b__4()
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at Octopus.Server.OctopusServerEngine.Start() in Y:\Work\refs\tags\3.4.0\source\Octopus.Server\OctopusServerEngine.cs:line 59
at Octopus.Server.Commands.RunCommand.Start() in Y:\Work\refs\tags\3.4.0\source\Octopus.Server\Commands\RunCommand.cs:line 39
at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in Y:\Work\refs\tags\3.4.0\source\Octopus.Shared\Startup\AbstractCommand.cs:line 58
at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) in Y:\Work\refs\tags\3.4.0\source\Octopus.Shared\Startup\OctopusProgram.cs:line 221
at Octopus.Shared.Startup.WindowsServiceHost.<>c__DisplayClass1_0.b__0() in Y:\Work\refs\tags\3.4.0\source\Octopus.Shared\Startup\WindowsServiceHost.cs:line 19
at Octopus.Shared.Startup.WindowsServiceAdapter.RunService() in Y:\Work\refs\tags\3.4.0\source\Octopus.Shared\Startup\WindowsServiceAdapter.cs:line 64
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
"

Hi Luke,

Thank you for reaching out! How did you create this drive? I’m thinking it’s probably a permissions issue - a LocalSystem account cannot access mapped drives that it has not created. If you run your Octopus Server service under a specific user account and then give that user access to the mapped drive, that would most likely fix it.

Let me know how you go!

Kenny

Thanks Kenny.
I created the drive via net use y: \.file.core.windows.net\support /u:

I could not get the service account to get access to this drive. I ended up working around it by creating a Symlink to the shared drive
i.e mklink /D C:\data\octopus\TaskLogs
\.file.core.windows.net\support\Octopus\data\TaskLogs

And then Octopus.Server.exe path --taskLogs C:\data\octopus\TaskLogs

By creating the Symlink the underlying folder is still on the network share, however the Octopus service account can now access it.

Hi Luke,

That’s great you got it working! Thanks for letting me know :slight_smile:

Kind regards,

Kenny

Hi Luke,

That’s great you got it working! Thanks for letting me know :slight_smile:

Kind regards,

Kenny

Notice:

This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.