i've created the following changelog file:
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"
logicalFilePath="path-ignored"
>
<include file="db/changelog/usermanagement/db.changelog-master.xml"/>
<include file="initial/db.changelog-initial.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
All my files have the logicalFilePath attribute. When I update my database using the maven plugin, all change sets that are included via the first file (db/changelog/usermanagement/db.changelog-master.xml) have a relative path in the filename column of the databasechangelog table.
All change sets included by the second file (initial/db.changelog-initial.xml) have "path-ignored" as filename.
When I drop everything and let the server doing the update (I'm using spring boot), the filename of all change sets is set to the logicalFilePath value (path ignored). This is what I expected.
I'm using liquibase 3.5.3.
The databasechangelog scripts are located in different projects. That is the reason why I don't set the relativeToChangelogFile to true for the first included file.
Of course, I can move all scripts into the same project, but this is not what I want.
Related
I've a Maven EAR with some modules that need to share the session context.
So when I run it on Liberty Server (on Eclipse) I've to add in the "Server Configuration" the application extension and set the shared-session-context flag to true.
I guess how can I set it by default, maybe in the pom.xml? I can find any information about it.
Thanks.
The recommended practice is to have in your source repo server.xml that is required for your application, and have all the required settings there. Then your maven build creates also Liberty server with your config and deploys app there.
If you dont want to store that in the server config file, you can add ibm-application-ext.xml file to your EAR/META-INF folder, with shared session enabled like this:
ibm-application-ext.xml contents:
<?xml version="1.0" encoding="UTF-8"?>
<application-ext xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-ext_1_1.xsd"
version="1.1">
<shared-session-context value="true"/>
</application-ext>
I am using Octopus Deploy v3 for my deployment.
Within my project I have defined a variable called data.folder
I am trying to use this variable to set the value in a transformation file that was deployed using a package
I have the following .config file
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" >
<sitecore>
<sc.variable name="dataFolder">
<patch:attribute name="value">/Data</patch:attribute>
</sc.variable>
</sitecore>
</configuration>
and the following .ci.config file
<?xml version="1.0"?>
<configuration
xmlns:patch="http://www.sitecore.net/xmlconfig/"
xmlns:set="http://www.sitecore.net/xmlconfig/set/"
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore>
<sc.variable name="dataFolder" xdt:Transform="Replace" xdt:Location="Match(name)" set:value="#{data.folder}" />
</sitecore>
</configuration>
Both of these files are located in folder App_Config\Include
As you can see I have set the variable in the transformation file to include the variable "{data.folder}"
Within Octopus, I have created a package deployment step, and have set the following features:
Custom installation directory
Configuration Variables
Configuration transforms
Substitute variables in files
Within the Substitute variables in files I have included the target files
App_Config\Include\Z_Project.#{Octopus.Environment.Id}.config
I believe that I have followed http://docs.octopusdeploy.com/display/OD/Substitute+Variables+in+Files correctly, however when the deployment runs. the variable in the .ci.config file is not being set.
I am sure I have made a very basic mistake, but I have no idea what I have done wrong
What do I need to get the transform file to use the variable from Octopus
It sounds like you've got the process correct in terms of the steps, the variables etc, but I don't think the transformation in the .ci.config file is correct after previewing a transformation.
It ends up like this
<sitecore>
<sc.variable name="dataFolder" set:value="#{data.folder}"/>
</sitecore>
try using
<sitecore>
<sc.variable name="dataFolder" xdt:Transform="Replace" xdt:Location="Match(name)">
<patch:attribute name="value">#{data.folder}</patch:attribute>
</sc.variable>
</sitecore>
Running this through Slow Cheetah (Visual Studio Gallery) performs the transformation correctly and provided everything else is setup in Octopus Deploy correctly this should get the value injected before the transformation happens.
Hope this helps
The Visual Studio project has a folder containing sql scripts and all files in it must have the build action set to Embedded Resource. While adding new files, developers often forget to change the build action.
I want to create a target file that throws an error a compile time if any of the files in the folder do not have the correct build action.
I have seen something similar done before.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="MakeSureSqlFilesAreSetToCopyAlways" BeforeTargets="PrepareForBuild">
<Error Condition="!('%(Content.CopyToOutputDirectory)' == 'Always')"
Text="This Content file is not configured to Copy Always: [%(Content.FullPath)]" />
</Target>
</Project>
This block of code checks if the files are set to copy always. How do I check build action?
Would appreciate some links to further reading on this topic as well.
Thanks in advance.
Assuming that script files are in a folder called Scripts, the following target file will raise an error if there's any file with build action set to Content and if their path contains the word Scripts.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="MakeSureSqlFilesAreSetToEmbeddedAsResource" BeforeTargets="PrepareForBuild">
<Error Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Content.FullPath)', 'Scripts'))"
Text="This Content file is not configured as Embedded Resource: [%(Content.FullPath)]" />
</Target>
</Project>
If you're dealing with developers who forget to set their scripts as Embedded Resource, the above should be enough (though not comprehensive), mainly because Visual Studio sets the build action for new files to Content by default. If you want to make it bullet proof simply repeat the Error tag and replace Content with all possible build actions (except EmbeddedResource).
I have use case to build a mule project using maven and i experienced a scenario where if a new mule project created in mule studio with multi flows which was not run/deployed anytime.
I performed a maven build for the mule project There were two observations
1) when the mule build deployed in mule stand alone it got deployment failure with error
org.mule.module.launcher.InstallException: Config for app ...not found....mule-config.xml.
2)when i checked the config.resource property of mule-deploy.properties was not assigned(config.resources=) with flow config file .
Please let me know any suggestions where i am going wrong.
The easiest thing to do is just update the property with the name of the config xml in mule-deploy.properties.
config.resources=my-projects-config.xml
1) Go to <>/src/main/app/mule-deploy.properties, verify config.resources=test.xml<>. If any other files are assigned, remove it.
or
2) Keep a dummy mule-config.xml in the directory src/main/app
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd">
<!-- empty config to avoid the hot deployment classloader choking on a missing config file -->
</mule>
Although we create a "default" application in the "apps" folder, it's empty and thus hot deploy complains about a missing mule-config.xml file
I'm trying to make a subdirectory in an MS Deploy package writable to the application pool user. Thanks to a helpful post about the setAcl provider by Kevin Leetham I was able to get most of what I need into my project file:
<MsDeploySourceManifest Include="setAcl"
Condition="$(IncludeSetAclProviderOnDestination)">
<Path>$(_MSDeployDirPath_FullPath)\doc\public</Path>
<setAclAccess>Read,Write,Modify</setAclAccess>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
</MsDeploySourceManifest>
Note that I've added "\doc\public" to the root deployment directory. In the resulting manifest that VS2010 builds, I see the following setAcl element:
<sitemanifest>
<contentPath path="C:\Source\...\obj\Debug\Package\PackageTmp" />
<setAcl path="C:\Source\...\obj\Debug\Package\PackageTmp"
setAclResourceType="Directory" />
<setAcl path="C:\Source\...\obj\Debug\Package\PackageTmp"
setAclUser="anonymousAuthenticationUser"
setAclResourceType="Directory" />
<setAcl path="C:\Source\...\obj\Debug\Package\PackageTmp\doc\public"
setAclResourceType="Directory"
setAclAccess="Read,Write,Modify" />
</sitemanifest>
That last line looks good: it's appended the subdirectory I want to be writable, and the access modifiers all seem to have transferred over well enough.
However, when I deploy this package I receive an error:
Error: A value for the 'setAclUser' setting must be specified when the
'setAcl' provider is used with a physical path.
This is a confusing error because I'm not trying to set an ACL on a physical path, exactly, but a subdirectory of a web application. Looking at the output of MS Deploy, it's easy to see the problem:
Info: Adding setAcl (REST Services\1.0.334).
Info: Adding setAcl (REST Services\1.0.334).
Info: Adding setAcl (C:\...\obj\Release\Package\PackageTmp\doc\public).
MS Deploy is apparently substituting the web application name for my absolute path "C:...\obj\Release\Package\PackageTmp", but when I append "\doc\public" to that absolute path it no longer recognizes it as a web application directory. This exact problem is described by another victim over on the ASP.NET forums without any resolution.
Does anyone know how to set an ACL on a particular subdirectory of a web application via Web Deploy without manually identifying the physical path and application pool user on the target host?
OK let me first say that this is way harder than it should be!
I think the reason why it is failing is because when you are publishing it cannot recognize the folder as being a folder in the IIS Application. The reason this is happening is because the full path is being transferred to the destination when the SetAcl provider is invoked. Instead of that we need an path which is relative to the IIS Application. For instance in your case it should be something like : "REST SERVICES/1.0.334/doc/public". The only way to do this is to create an MSDeploy parameter which gets populated with the correct value at publish time. You will have to do this in addition to creating your own SetAcl entry in the source manifest. Follow the steps below.
In the same directory as your project create a file with the name {ProjectName}.wpp.targets (where {ProjectName} is the name of your Web application project)
Inside the file paste the MSBuild content which is below this list
Reload the project in Visual Studio (VS caches the project files in memory so this cache needs to be cleared).
{ProjectName}.wpp.targets
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="SetupCustomAcls" AfterTargets="AddIisSettingAndFileContentsToSourceManifest">
<!-- This must be declared inside of a target because the property
$(_MSDeployDirPath_FullPath) will not be defined at that time. -->
<ItemGroup>
<MsDeploySourceManifest Include="setAcl">
<Path>$(_MSDeployDirPath_FullPath)\doc\public</Path>
<setAclAccess>Read,Write,Modify</setAclAccess>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemGroup>
</Target>
<Target Name="DeclareCustomParameters" AfterTargets="AddIisAndContentDeclareParametersItems">
<!-- This must be declared inside of a target because the property
$(_EscapeRegEx_MSDeployDirPath) will not be defined at that time. -->
<ItemGroup>
<MsDeployDeclareParameters Include="DocPublicSetAclParam">
<Kind>ProviderPath</Kind>
<Scope>setAcl</Scope>
<Match>^$(_EscapeRegEx_MSDeployDirPath)\\doc\\public$</Match>
<Value>$(_DestinationContentPath)/doc/public</Value>
<ExcludeFromSetParameter>True</ExcludeFromSetParameter>
</MsDeployDeclareParameters>
</ItemGroup>
</Target>
</Project>
To explain this a bit, the target SetupCustomAcls will cause a new SetAcl entry to be placed inside of the source manifest used during publishing. This target is executed after the AddIisSettingAndFileContentsToSourceManifest target executes, via the AfterTargets attribute. We do this to ensure that the item value is created at the right time and because we need to ensure that the property _MSDeployDirPath_FullPath is populated.
The DeclareCustomParameters is where the custom MSDeploy parameter will be created. That target will execute after the AddIisAndContentDeclareParametersItems target. We do this to ensure that the property _EscapeRegEx_MSDeployDirPath is populated. Notice inside that target when I declare the value of the parameter (inside the Value element) that I use the property _DestinationContentPath which is the MSBuild property containing the path to where your app is being deployed, i.e. REST Services/1.0.334.
Can you try that out and let me know if it worked for you or not?
FYI - this does work for a root website if you follow the convention specified in the post here:
http://forums.iis.net/p/1176955/1977169.aspx#1977169
<Match>^$(_EscapeRegEx_MSDeployDirPath)\\#(CustomDirAcl)$</Match>
<DefaultValue>{$(_MsDeployParameterNameForContentPath)}/#(CustomDirAcl)</DefaultValue>
<Value>$(_DestinationContentPath)/#(CustomDirAcl)</Value>
This post also has the benefit of being able to specify a block of subdirectories in a single ItemGroup.