forked from Azure-App-Service/KuduLite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Linux Consumption] Support persistent storage using Azure file share (…
…Azure-App-Service#121) Adds support for creating & mounting Azure file shares for Linux consumption scm sites. Function apps can opt-in using the app setting ENABLE_KUDU_PERSISTENT_STORAGE=1. Currently the persistent storage is used for deplpyment logs only. This change also moves artifacts location from /deployments path to its own path /artifacts.
- Loading branch information
Showing
45 changed files
with
1,132 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Diagnostics.Tracing; | ||
using Kudu.Core.Infrastructure; | ||
using Kudu.Core.Tracing; | ||
|
||
namespace Kudu.Core.LinuxConsumption | ||
{ | ||
public class FileSystemPathProvider : IFileSystemPathProvider | ||
{ | ||
private readonly IMeshPersistentFileSystem _persistentFileSystem; | ||
|
||
public FileSystemPathProvider(IMeshPersistentFileSystem persistentFileSystem) | ||
{ | ||
_persistentFileSystem = | ||
persistentFileSystem ?? throw new ArgumentNullException(nameof(persistentFileSystem)); | ||
} | ||
|
||
public bool TryGetDeploymentsPath(out string path) | ||
{ | ||
path = _persistentFileSystem.GetDeploymentsPath(); | ||
return !string.IsNullOrEmpty(path) && EnsureMountedDeploymentsPath(path); | ||
} | ||
|
||
private bool EnsureMountedDeploymentsPath(string path) | ||
{ | ||
try | ||
{ | ||
FileSystemHelpers.EnsureDirectory(path); | ||
return true; | ||
} | ||
catch (Exception e) | ||
{ | ||
KuduEventGenerator.Log().LogMessage(EventLevel.Informational, ServerConfiguration.GetApplicationName(), | ||
$"{nameof(EnsureMountedDeploymentsPath)} Failed. Path = {path}", e.ToString()); | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Kudu.Core.LinuxConsumption | ||
{ | ||
public interface IFileSystemPathProvider | ||
{ | ||
bool TryGetDeploymentsPath(out string path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Core.LinuxConsumption | ||
{ | ||
public interface IMeshPersistentFileSystem | ||
{ | ||
Task<bool> MountFileShare(); | ||
|
||
bool GetStatus(out string message); | ||
|
||
string GetDeploymentsPath(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Core.LinuxConsumption | ||
{ | ||
public interface IMeshServiceClient | ||
{ | ||
Task MountCifs(string connectionString, string contentShare, string targetPath); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Core.LinuxConsumption | ||
{ | ||
public interface IStorageClient | ||
{ | ||
Task CreateFileShare(string siteName, string connectionString, string fileShareName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Kudu.Core.LinuxConsumption | ||
{ | ||
public interface ISystemEnvironment | ||
{ | ||
string GetEnvironmentVariable(string name); | ||
|
||
void SetEnvironmentVariable(string name, string value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.