Deploying Custom theme in production server - liferay

I'm working on a Liferay project.
I'm developing a new Liferay theme using Plugins SDK.
I wonder is it better to use ANT or MAVEN for the project?
Because I managed to run both projects in eclipse.
Also is there any way to deploy automatically the theme in the production server ? (Distant server using tomcat).
For now I'm just using auto deployment, copying the war file to the /deploy file.
Regards

You can add remote server to your Eclipse with Plugins SDK, check https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/developing-apps-with-liferay-ide-liferay-portal-6-2-dev-guide-02-en

(this may be helpful for older versions of plugins-sdk)
Assuming that you have ssh access to the remote server, the following ant target can be added and used in /liferay-plugins-sdk/build-common-plugin.xml
<property name="web-server" value="11.11.11.11" />
<property name="web-server-username" value="yourusername" />
<property name="web-server-password" value="yourpassword" />
<property name="web-server-deploy-folder-path" value="/liferay-x.x/deploy" />
<target name="remote-deploy" depends="war">
<echo message="Copying plugin to remote server ..." />
<scp
file="${plugin.file}"
todir="${web-server-username}:${web-server-password}#${web-server}:${web-server-deploy-folder-path}"
trust="true"
/>
<echo message="Done!" />
</target>

Related

How to share parameters configuration between VS publish profile and MSDeploy SetParameters.xml?

I have a web application in Visual Studio 2012. I publish this website to IIS using publish profiles (.pubxml).
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>server</MSDeployServiceURL>
<DeployIisAppPath>site</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>domain\username</UserName>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="MyParam">
<ParameterValue>MyValue</ParameterValue>
</MSDeployParameterValue>
...
</ItemGroup>
</Project>
Beside I setup a CI to build a package with msbuild and then use it to publish to the different environnement using msdeploy. Both in 2 separates steps, so I can reuse the same package multiple times.
To do this I need to use a SetParameters.xml with a different syntax than the publish profil used by VS.
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="site" />
<setParameter name="MyParam" value="MyValue" />
...
</parameters>
Is there a way to share the parameters configuration in a single file so I can maintain only one file ?
I see this answers from 2014 but I can't managed to make it works.
I've researched this and can't find a way to override the SetParameters file when publish via VisualStudio. It doesn't look like the MSBuild tasks support this.
The best alternative I can offer is to use the commandline instead of right click publish. You can create the MSDeploy package by calling the Package target:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild /t:Package /p:PublishProfile=<profile-name>
And then deploy using MSDeploy.exe:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package=WebApplication7.zip -dest:manifest=WebApplication7.DestManifest.xml -setParamFile:SetParameters.custom.xml
The following blog posts has more details:
https://dotnetcatch.com/2016/02/25/the-anatomy-of-a-webdeploy-package/

Why can't Azure find IISConfigurator.exe in my cspkg?

I am using the Azure 2.5 SDK to upload a cspkg + cscfg to create a new web role deployment in Azure. When I do, I see the following error with status BadRequest.
{"BadRequest : The file provided is not a valid service package. Detailed error code: {0} Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe."}
Where {0} is the role/project name.
However, when I inspect the contents of my cspkg file, the base/x64 directory DOES contain IISConfigurator.exe.
I also notice that the RoleModel.xml file has been modified by packaging to contain an IISConfigurator.exe task as follows:
<RoleModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CacheExtension" version="2.5.6496.10" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<Startup>
<Task commandLine="IISConfigurator.exe" executionContext="elevated" relativePath="base\x64">
<Environment>
<Variable name="_IISCONFIGURATOR_SETUP_URL_REWRITE_" value="true" />
<Variable name="_IISCONFIGURATOR_CLEAN_SERVER_ONSTARTUP_" value="true" />
<Variable name="RdModuleName" value="IISConfigurator" />
</Environment>
</Task>
So my question is: What is the real cause of this error message?
Additional possible clues:
My RoleModel.xml in the cspkg also contains:
<Property name="TargetFrameworkVersion" value="v4.5.1" />
<Property name="RoleType" value="Web" />
<Property name="Configuration" value="Debug" />
<Property name="Platform" value="AnyCPU" />
<Property name="SetConfiguration" value="Configuration=Debug" />
<Property name="SetPlatform" value="Platform=AnyCPU" />
<Property name="RoleTargetFramework" value="v4.5.1" />
<Property name="TargetRuntimeVersion" value="v4.0" />
Tim, we have seen this issue only twice, and it was with developers who had upgraded to SDK 2.5.1. We were never able to reproduce the problem and we didn't find the root cause before those developers uninstalled the Azure SDK and reinstalled SDK 2.5 which caused the issue to go away.
Can you try uninstalling and reinstalling the Azure SDK? You could also try SDK 2.6 which was just released.
I had this issue using the Azure 2.9 SDK.
I started looking in control panel and was seeing what appeared to be some double installs.
I uninstalled all 2.9 Azure components from my PC, and reinstalled the required ones. Then it all worked for me.

Packaging a node-webkit app (exe) to Win 8.1 appx

I am attempting to transform a built node-webkit app that I created into an executable appx Win 8.1 Metro App.
After creating my appx package and signing it, and creating my AppxManifest.xml file :
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="bouveret" Version="1.0.0.0" Publisher="CN=Mc" />
<Properties>
<DisplayName>iMotion</DisplayName>
<PublisherDisplayName>XXX</PublisherDisplayName>
<Logo>logo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="fr" />
</Resources>
<Applications>
<Application Id="bouveret" Executable="bouveret.exe" EntryPoint="WinMain">
<VisualElements DisplayName="iMotion" Logo="logo.png" SmallLogo="logo.png" Description="iMotion" ForegroundText="light" BackgroundColor="#000000" ToastCapable="false">
<DefaultTile ShowName="allLogos" ShortName="iMotion" WideLogo="logo.png" />
<SplashScreen Image="logo.png" />
<InitialRotationPreference>
<Rotation Preference="portrait" />
</InitialRotationPreference>
</VisualElements>
</Application>
</Applications>
</Package>
I manage to install it via Powershell, but I suspect it doesn't manage to run the entry point for the app. NW apps don't have a C# interface I can use to set a proper entry point.
Anyone has any idea on which entry point should be set? The executable launches itself properly, but the appx package doesn't launch anything : I see the logo on a black background and then it minimizes itself to the desktop without any debug trace.
Thank you.

Using bouncycastle in Websphere liberty profile

Our application uses Bouncycastle. I am now attempting to deploy my app on websphere liberty profile and getting the below error
[err] java.io.IOException: error constructing MAC: java.lang.SecurityException: JCE cannot authenticate the provider BC
[err] at org.bouncycastle.jce.provider.JDKPKCS12KeyStore.engineLoad(Unknown Source)
[err] at java.security.KeyStore.load(KeyStore.java:1214)
[err] at com.manh.jwt.JwtKeyManager.loadPrivateKeyByIssuer(JwtKeyManager.java:213)
So instead of having the bouncycastle jar in WEB-INF/lib dir, i created a shared lib and added this library as a privateLibraryRef to my web application. I still get the same error.
Here is my server.xml for your reference.
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jsp-2.2</feature>
<feature>servlet-3.0</feature>
</featureManager>
<webContainer deferServletLoad="false" />
<httpEndpoint id="defaultHttpEndpoint"
host="localhost"
httpPort="20000"
httpsPort="9443" />
<library id="configResources">
<folder dir="${server.config.dir}/conf" />
</library>
<library id="bc">
<fileset dir="${server.config.dir}/bclib" includes="*.jar" />
</library>
<webApplication name="scope" location="scope.war" contextRoot="/">
<classloader privateLibraryRef="configResources, bc" />
</webApplication>
</server>
Is there any other setting that i can try to have this working?
Here is the magic to get Bouncy Castle cryptography to work with WAS Liberty, which should work for the stacked products as well.
Create a "jvm.options" file in the servers working directory. In a default installation, this would be wlp/usr/servers/
Add the following to the "jvm.options" file.
a. -Djava.ext.dirs= //I tested this with /opt/fun/libs and wlp/usr/servers/defaultServer and wlp/usr/servers/defaultServer/libs. All three worked. If I included a path to a WEB-INF/lib directory it failed.
b. -Dorg.osgi.framework.bootdelegation=org.bouncycastle.jce.provider
Copy the bouncy castle jar from the WEB-INF/lib directory to the java.ext.dirs defined directory (above).
Stop and start the server, since you are changing JVM arguments.
Test the application or stacked product.

Cant Run Java FX Executable Jar or Native Bundle

I have created a java fx application on Netbeans 7.3.1 with fxml,hibernate. It works fine when run in Netbeans and when run the jar file from dist folder. Database operations are just fine. But I want export the app to another system in a portable form. So i created the native bundle using the tools Wix and Inno 5. But the produced app doesnt work in my own syntem or another system. Shows Exception while runnig application. I checked several times by changing the db ip address as localhost, 127.0.0.1 and my my physical ip. but no working.
My java version is Java 7 update 40 (jdk1.7.0_40)
This is the link for the screenshot showing error : http://i.imgur.com/popokhh.jpg
my build.xml contains
<target name="-post-jfx-deploy">
<fx:deploy width="${javafx.run.width}" height="${javafx.run.height}"
nativeBundles="all"
outdir="${basedir}/${dist.dir}" outfile="${application.title}">
<fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
<fx:resources>
<fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
</fx:resources>
<fx:info title="${application.title}" vendor="${application.vendor}"/>
</fx:deploy>
</target>
And my hibernate cfg file contains
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sample?zeroDateTimeBehavior=convertToNull</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<mapping resource="entity/Sample.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Is there any extra configuration for the application to work independently??
I got it fixed...
All i need to do was include the lib folder in the build... My bad.

Resources