-
Notifications
You must be signed in to change notification settings - Fork 812
Add Deploy 13.3.0 and 14.2.0 release notes and document ImportOnStartup and ValidateDependenciesOnImport settings #6699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
e5ca81e
cc1466d
56a3a11
816acc0
e059836
7af8115
6b5aca0
a12f4c2
ba812e7
6c7051b
394ab31
56108b9
d44b819
eeee300
734b763
57c9bbb
4c970db
50360a4
c04d70a
b497ba9
147c5ac
172160e
8537bb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| --- | ||
| meta.Title: Import on startup | ||
| description: How to import content and schema on startup and implement your own `IArtifactImportOnStartupProvider` | ||
| --- | ||
|
|
||
| # Import on startup | ||
|
|
||
| Deploy can import content and/or schema previously exported from another Umbraco installation on start-up. This can be used to quickly setup a baseline/starter kit or as a workaround for large ZIP archives that can't be (easily) uploaded via the backoffice. | ||
|
Check warning on line 8 in 13/umbraco-deploy/deployment-workflow/import-on-startup.md
|
||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Default configuration | ||
|
|
||
| The default configuration will look for the ZIP archive `umbraco\Deploy\import-on-startup.zip` on start-up and if it exists, run an import and delete the file on successful completion. If you want to [customize the default behaviour you can do so via settings](../getting-started/deploy-settings.md#import-on-startup). | ||
|
Check warning on line 12 in 13/umbraco-deploy/deployment-workflow/import-on-startup.md
|
||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This feature is extensible via a provider based model by implementing `IArtifactImportOnStartupProvider` and registering it using `builder.DeployArtifactImportOnStartupProviders()`. The default `Umbraco.Deploy.Infrastructure.SettingsArtifactImportOnStartupProvider` implementation uses the above settings and inherits from `Umbraco.Deploy.Infrastructure.ArtifactImportOnStartupProviderZipArchiveBase` (which can be used for your own custom implementation). | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Implementing your own `IArtifactImportOnStartupProvider` | ||
|
|
||
| An example of an import on start-up provider that imports from a physical directory (instead of ZIP archive) is shown below: | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```csharp | ||
| using Umbraco.Cms.Core; | ||
| using Umbraco.Cms.Core.Composing; | ||
| using Umbraco.Cms.Core.Extensions; | ||
| using Umbraco.Deploy.Core; | ||
| using Umbraco.Deploy.Core.OperationStatus; | ||
| using Umbraco.Deploy.Infrastructure.Extensions; | ||
|
|
||
| internal sealed class DeployImportOnStartupComposer : IComposer | ||
| { | ||
| public void Compose(IUmbracoBuilder builder) | ||
| => builder.DeployArtifactImportOnStartupProviders() | ||
| .Append<PhysicalDirectoryArtifactImportOnStartupProvider>(); | ||
|
|
||
| private sealed class PhysicalDirectoryArtifactImportOnStartupProvider : IArtifactImportOnStartupProvider | ||
| { | ||
| private readonly IArtifactImportExportService _artifactImportExportService; | ||
| private readonly ILogger _logger; | ||
| private readonly string _artifactsPath; | ||
|
|
||
| public PhysicalDirectoryArtifactImportOnStartupProvider(IArtifactImportExportService artifactImportExportService, ILogger<PhysicalDirectoryArtifactImportOnStartupProvider> logger, IHostEnvironment hostEnvironment) | ||
| { | ||
| _artifactImportExportService = artifactImportExportService; | ||
| _logger = logger; | ||
| _artifactsPath = hostEnvironment.MapPathContentRoot("~/umbraco/Deploy/ImportOnStartup"); | ||
| } | ||
|
|
||
| public Task<bool> CanImportAsync(CancellationToken cancellationToken = default) | ||
| => Task.FromResult(Directory.Exists(_artifactsPath)); | ||
|
|
||
| public async Task<Attempt<ImportArtifactsOperationStatus>> ImportAsync(CancellationToken cancellationToken = default) | ||
| { | ||
| _logger.LogInformation("Importing Umbraco content and/or schema import at startup from directory {FilePath}.", _artifactsPath); | ||
|
|
||
| Attempt<ImportArtifactsOperationStatus> attempt = await _artifactImportExportService.ImportArtifactsAsync(_artifactsPath, default, null, cancellationToken); | ||
|
|
||
| _logger.LogInformation("Imported Umbraco content and/or schema import at startup from directory {FilePath} with status: {OperationStatus}.", _artifactsPath, attempt.Result); | ||
|
|
||
| return attempt; | ||
| } | ||
|
|
||
| public Task OnImportCompletedAsync() | ||
| { | ||
| Directory.Delete(_artifactsPath, true); | ||
|
|
||
| return Task.CompletedTask; | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
Uh oh!
There was an error while loading. Please reload this page.