How to remote deploy an application in weblogic? - deployment

I have two computers , I don't want to install weblogic and oracle in my development computer, they consume too much memory, the problem is how can I deploy my application on development computer to another free computer which has oracle and weblogic installed ? I am using weblogic 10.3.

I don't want to install weblogic and oracle in my development computer , they consume too much memory
Even when not running?
how can I deploy my application from my development machine to another machine which has oracle and weblogic installed
You can use the following tools:
webLogic.Deployer (see the weblogic.Deployer Command Line Reference)
Admin Console
wldeploy, the Ant Task version of the weblogic.Deployer (see the wldeploy Ant Task Reference)
WLST (see Deploying Applications in the WebLogic Scripting Tool documentation).
Other options (if you are using maven):
weblogic maven plugin (no feedback to give you except that I wouldn't use it)
cargo maven plugin (doesn't support deployment to remote weblogic)

If you use the Ant Task, then be sure and include the upload="true" parameter. This will copy the war, ear file to the remote weblogic system so you don't have to.

Wldeploy works like a charm. The configuration looks like this.
<target name="deploy">
<wl.deploy.app archivepath="${ear.path}" name="${ear.deployment.name}"
wladminuser="${weblogic.admin.user}" wlserverhost="${weblogic.server.host}"
wlserverport="${weblogic.server.port}" wlservername="${test.server.name}"
wladminpassword="${weblogic.admin.password}"/>
</target>
<macrodef name="wl.deploy.app">
<attribute name="archivepath"/>
<attribute name="name"/>
<attribute name="wladminuser"/>
<attribute name="wladminpassword"/>
<attribute name="wlserverhost"/>
<attribute name="wlserverport"/>
<attribute name="wlservername"/>
<attribute name="sharedlibrary" default="false"/>
<sequential>
<wldeploy action="deploy" verbose="true" debug="true"
name="#{name}"
library="#{sharedlibrary}"
remote="true"
upload="true"
source="#{archivepath}"
user="#{wladminuser}" password="#{wladminpassword}"
adminurl="t3://#{wlserverhost}:#{wlserverport}"
targets="#{wlservername}"/>
</sequential>
</macrodef>
Just specify all the properties correctly be it localhost or a remote machine. It should work.

You can deploy WebLogic Application using REST Interface (I am not sure, if it is available for all the WLS versions).
REST interface must be enabled over Admin Console (server restart needed):
Settings / Configuration / General [Advanced] / Enable RESTful Management Services
It is actually a JSON based REST interface, but if you need to upload something, multipart/form-data is used instead.
It works like this (tested on WLS v12.2.1.4):
curl -X POST 'http://<server>:7001/management/weblogic/latest/edit/appDeployments'
-u <username>:<password>
--header 'Content-Type: multipart/form-data'
--header 'X-Requested-By: <any_string>'
--form 'sourcePath=#<local_path_to_war_file>'
--form 'model={"name": "<application_name>"}'
--form 'planPath=#<local_path_to_plan_xml_file>'
Don't forget X-Requested-By. WebLogic requires as CSRF protection.
API Documentation for WLS version 14
https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/wlrer/index.html
API Documentation for WLS version 12: https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlrem/index.html

Related

Deploy Server hosted Blazor .NET6 to traditional webhost

I have created a Server hosted Blazor web application with .NET6. Now I want to publish to my web hotel that runs Windows Servers. I interact with them through a Plesk platform. They implicitly use IIS under the hood. I have an FTP area to deploy to which works fine for the other webs I have created before.
I use Rider so I don't have any fancy publishing wizards like Visual Studio, but I assume it should work fine using plain dotnet commands as well.
I ran the dotnet publish command and get the publish folder that I read should be enough for deployment. Then i copied all content to the FTP area and hoped everything would just work. It did not.
I have some specific questions:
Does Blazor .NET6 demands a special version of underlying IIS?
The server has Framework 4.7.2 installed but if I use a self contained deployment I guess the server installed version doesn't matter? I assumed the necessary .NET version will be included in the publish?
I notice to my surprise that all my appsettings files are included in the publish content. I assumed the relevant appsettings would be merged into one that should be used for production. How should that be handled?
It seems all Microsoft deployment guides assume Azure. In my company I can not use that. We are left with the traditional hosting.
Now I have solved my problems! The most crucial part was to enable full error printouts on server web by setting an environment flag. It was NOT documented on the publish page with command switches but was very helpful in finding the cause of my problems.
By adding a switch to the publish command a new section is added to the resulting web.config file:
dotnet publish --framework net6.0 --configuration Release /p:EnvironmentName=Development
This will add the environmentVariables section under aspNetCore:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SqueedEmployee.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
You can indeed deploy self-contained which means all assemblies you need are included. Everything is included in the \bin\Release\net6.0\publish folder. Just copy to FTP area.
See above.
I am still a bit confused how the appsettings should be handled.
Conclusion is that traditional hosting works fine :)

Something wrong with my web.config file while hosting web service

To give some context:
I'm trying to deploy a webservice I built, within visual studio you have the option to use 'Folder Deployment', I am using this option and that deployment allows me to make a build within a folder that has an executable which works like a charm when I'm using it on localhost but because my webservice needs to be used through a network, I need to deploy it to IIS which gives me some challenges.
I'm trying to host my RESTful API web service on the IIS server as explained in this article: https://www.c-sharpcorner.com/article/publishing-asp-net-web-api-rest-service-using-file-system-method/ but every time I add it to the server, and try surfing to the site I get the following error page: HTTP Error 500.19 - Internal Server Error --> 0x8007000d which apparantly tells me that something is wrong with my web.config file but I never touched that during my development..... perhaps you guys see something odd as here is my web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Flame_webservice.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 21d59c04-6877-4549-9ff7-c37f07155f97-->
After searching for solutions I already found several articles that suggested installing things but it doesn't seem to do the trick for me, the following article I have tried:
Web Application Problems (web.config errors) HTTP 500.19 with IIS7.5 and ASP.NET v2
I don't think I'm using AJAX but maybe I am so I haven't tried that yet.
My webservice contains 3 controllers which are essentially websites but I don't see an explicit route to the websites in the web.config file, I'm not sure if that can cause issues?
I will continue searching but it's becoming a pretty rough ride at the moment due to my limited experience with hosting web services. Or am I perhaps using IIS while I shouldn't? I mean I've tried turning off my firewall and reaching the executable running on localhost through my IP address but it doesn't seem to work which led me to believe I needed a server to reach the running web service on my local machine.
I had the same exact issue and what helped was:
installing .net core windows hosting on the server.
Install-Package Microsoft.Extensions.Hosting -Version 3.1.10

How to create IIS-website from powershell in order to host .net core 2.0 app, error 0x8007000d

Expected Result:
IIS hosts my app correctly, and when I navigate to the url of my app (e.g: blabla/swagger) I see the swagger UI describing my app
Problem:
When I try to navigate to my app it says:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Information
I built an app in .net core 2.0 and I am able to make it run through visual studio, being hosted by Kestrel.
However I need to deploy this app to different servers and since Kestrel doesn't support host names, I need to make it being hosted in IIS . When I make it run through Kestrel I am able to access it correctly and by navigating to the url/swagger address, I am able to see the correct swagger page that describes the app.
My app is being published from visual studio. Which means in its published folder there are all the dlls that the app needs. It's being published as a framework dependent app, not a standalone one, but this shouldn't matter.
How to replicate the problem
Since I need this one day to be hosted in IIS inside a Docker container, I am trying to make it being hosted in IIS with powershell scripts. What I did to make it being hosted in IIS is:
New-Website -Name 'myTestApp' -force -Port 8080 -PhysicalPath
'C:\Users\myUser\Desktop\Docker\PublishOutput' -ApplicationPool 'MyAppPoolTest'
Where C:\Users\myUser\Desktop\Docker\PublishOutput is the path to the published folder where Visual Studio publishes the app. Thanks in advance!
This is the web.config generated by Visual studio when publishing:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Friss.CaseApi.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 313d542d-7676-4440-ae1b-22c6071f4309-->
And the error page is:
Am I setting the web.config in the wrong way?
Check the documentation here
You need to publish your website and then point IIS website to the published folder
Application pool must be set to No Managed code
Application Pool identity user IIS AppPool\{AppPoolName} must have read permissions on the published website folder
Found the solution,
the system requires the dotnet core windows hosting bundle. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module.
Documentation: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x
Direct download to the bundle for .netcore 2.0.6 that solved my problem:https://download.microsoft.com/download/8/D/A/8DA04DA7-565B-4372-BBCE-D44C7809A467/DotNetCore.2.0.6-1-WindowsHosting.exe

How to create federation metadata XML for "Relying Party Trust" and "Claims Provider Trusts" for ADFS 2.0

One of our web app would like to connect with ADFS 2.0 server to get credential token and check the user roles based on that. The ADFS server admin asked us to give them a federation metadata XML file to let them create Relying Party Trusts. I googled and only find how to download the ADFS server's federation metadata XML using URL - https://[adfs server name]/federationmetadata/2007-06/federationmetadata.xml
But could didn't find any guide to create a federation metadata XML for creating "Relying Party Trust" and "Claims Provider Trusts". Is there a tools for creating those metadata files? Please share some idea for how to create.
Thanks
Lu
Answer my own question:
I found the Federation Utility tools in WindowsIdentityFoundation-SDK-4.0 at http://www.microsoft.com/en-ca/download/details.aspx?id=4451 will do it.
Actually the URL is
https://server/federationmetadata/2007-06/federationmetadata.xml
There are no tools that I an aware of.
You can use the Microsoft.IdentityModel.Protocols.WSFederation.Metadata class or refer Generating Federation Metadata Dynamically.
Have a look at
"Thinktecture.IdentityServer.v2 / src / Libraries / Thinktecture.IdentityServer.Protocols / FederationMetadata" over at Thinktecture.IdentityServer.v2.
Or if your application uses WIF it's in the metadata directory.
Update:
In WIF, unless you want to the token to be encrypted, you don't need the certificate. That's more for the ADFS side as it has to sign the token and the app. needs the public key to verify.
Example:
<?xml version="1.0" encoding="utf-8"?>
<EntityDescriptor ID="_5b6cd05c-a5e3-470d-a2fc-6c6f66633d1b" entityID="http://localhost/app/" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">
<RoleDescriptor xsi:type="fed:ApplicationServiceType" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fed:ClaimTypesRequested>
<auth:ClaimType Uri="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" Optional="true" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706" />
<auth:ClaimType Uri="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" Optional="true" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706" />
</fed:ClaimTypesRequested>
<fed:TargetScopes>
<EndpointReference xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://localhost/app/</Address>
</EndpointReference>
</fed:TargetScopes>
<fed:PassiveRequestorEndpoint>
<EndpointReference xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://localhost/app/</Address>
</EndpointReference>
</fed:PassiveRequestorEndpoint>
</RoleDescriptor>
</EntityDescriptor>
where localhost\app\ needs to be your app's URL. Note end slash!
I had to do this recently, having never used .Net or ADFS before, and having only the server (STS) metadata URL that I was trying to integrate with. I had a basic Windows 10 PC and was trying to set up a Node.js webapp as an RP. This is what I did:
On the Win 10 PC, went to Control Panel -> Programs and Features -> Turn Windows features on or off -> Enable Windows Identity Foundation 3.5
Installed Windows Identity Foundation SDK 4.0 (as referred to by the original author).
Created a basic Web.config file which contained:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
</system.web>
</configuration>
In the SDK installation directory, I found FedUtil.exe and FedUtilSampleUserInput.xml. The sample file explained all the parameters that FedUtil.exe was going to ask for, which was very helpful.
Launched FedUtil.exe as Administrator (right-click in File Explorer), providing the Web.config file I just created, the webapp URL, the server (STS) metadata URL as the "existing STS", and selecting to create a new default certificate.
Lo and behold, a FederationMetadata.xml file was generated and my Web.config file was updated automatically.
I then un-commented some of the claim types in the updated Web.config file and re-ran FedUtil.exe, which then updated my FederationMetadata.xml with the additional claim types that I needed from the STS (e.g., email, given name, surname)
Provided the FederationMetadata.xml to the STS admin, which worked!
Only downside is that this all required a Windows machine ... I'm not sure what I would have done on Mac or Linux!
For creating SAML RP Metadata there is a web based tool available at samltool.com which can help out. I haven't found one for WS-Federation other than the Federation Utility...
I also recently discovered the site rcFederation which supports AD FS / WS-Federation
Metadata xml for creating "Replaying party trust" is not ADFS federation metadta, but SP (Saml issuer)'s metadata xml.

JBoss as an http server?

I'm trying to write a webapp where the server side provides only json/REST services, and the gui is written in html5, backbone, marionette, etc. using async XHR. The html, js, css, etc. is static and cachable (when deployed to production).
I need to deploy this to JBoss EAP6 (broadly equivalent to AS7 for this problem). During development I'd like to be able to edit my javascript and html templates and have the results instantly visible in the browser. In production I need my static content (the front end) to be exploded and not deployed in any type of Java EE structure (so, no war or ear (or sar)).
So, basically, I need to deploy wars to jboss, as usual, and I also need jboss to act as an http server for the static part of the app.
I have played with the idea of copying my content into the welcome-content directory in the root of EAP6. While this serves the content with no problem I can't work with this structure for development because I can't live with the time overhead of copying my changes across to a different directory. I have also tried a symlink from welcome-content to my static content in the dev environment, but this doesn't work in this version of jboss.
Edit: I have answers that are telling me how to work around the problem, but I'm not really stuck for a workaround -- that's easy. I'm really looking specifically for how to configure jboss to serve static content.
TIA.
You could just deploy the static html/css/js like you normally would, and use a tool to inject changes into the DOM for you in real time. I'm doing this with GruntJS now using grunt-contrib-watch and it works pretty well.
Update for JBoss EAP 7.x
Just to complement the answer by Zach Lysobey, JBoss EAP 7.x has Undertow was underlining https/2 server. It has therefore it's own properties and has as basic properties below:
<subsystem xmlns="urn:jboss:domain:undertow:1.0">
<buffer-caches>
<buffer-cache name="default" buffer-size="1024" buffers-per-region="1024" max-regions="10"/>
</buffer-caches>
<server name="default-server">
<http-listener name="default" socket-binding="http" />
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content" />
</host>
</server>
<servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only" >
<jsp-config/>
<persistent-sessions/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>
</handlers>
</subsystem>
Reference: Undertow.io
Cli commands
You can therefore change the properties using the CLI command and subsystem=undertow:
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=url-charset,value="utf-8")
Static content in Undertow
This other question describes a similar situation and the official documentation describes a file handler for serving static files.
Cli command to create a file handler:
/subsystem=undertow/configuration=handler/file=new-file-handler:add(path="${jboss.home.dir}/welcome-content")
Update
TL;DR
I presume that the original issue is long resolved now after more than 5 years since it was asked. If someone really insists on using JBoss as static file web server, then the solution mentioned in the question is THE solution - using welcome-content directory. With EAP6 you must have an active paid subscription from RedHat to use it in production, and their knowledge base does provide the same answer.
As its not 2013 anymore, copying a bunch of static files really should not be an issue, and most IDEs can handle that quite well(only copying the files that changed etc).
For everyone else coming here from google, it is IMHO more beneficial to point to the right tools for the job and separate backend and frontend deployment(btw Nginx was available long before 2013, and Apache has been here, well, since forever :) ).
Although it is possible to host your static web assets via JBoss, it is a rather inefficient use of java web server. As your Frontend is completely separated from you java backend, why not deploy it to dedicated web server - Nginx or Apache for example, which is going to be vastly more efficient and suitable for serving static content.(Or a dedicated Wildfly w/ Undertow if you must)
You do not specify, if you only have a single JBoss instance or a more complex deployment but one common scenario for a usecase like yours goes like this:
[Nginx server:80] <--> [JBoss server:8080]
- location / { |- your-backend.war
root /path/to/frontend (web context /myapp/api)
}
- location /api {
proxy_pass http://backend
}
Head over to Nginx documentation for more info.
Advantages of using dedicated web server:
You can use it as load balancer at the same time, just add more Jboss instances, update the upstream config and you have scalable backend, yey
Deployment of your Frontend is simply a copy of static files to the corresponding folder - no need for restart, you can configure the paths to suit your folder structure.
Nginx(or well configured Apache) can handle extreme load with ease, it uses event mechanism instead of threads, + you can fiddle with caching strategies etc
You alleviate your java web server from the overhead of serving static web assets, and you can tune it for what it does best- server your java web service
You can deploy multiple web frontends or multiple projects, with different hostname, so you can host dev and test versions of your app on a same physical server and bind them to for exampe https://dev.myapp.com and https://test.myapp.com
You can use Web server for SSl offloading - again, alleviating your JBoss app server from the burden of SSL handling.