Thursday, 29 April 2021

Jelastic CLI

Just some notes of mine on how to install Jelastic command line tools and how to connect to your Jelastic provider1 2.

A little disappointed that installing the command line tools doesn't let me know that it "succeeded". It just returns my command prompt, with no indication what it did.

I thought it had quit unexpectedly.

The first call to the API will require authentication.

As I have enabled two-factor authentication, it's best if I create a personal access token3.

Success!

The absolute main reason to use it, I think, is the ability to move my static IP address of a Jelastic Node to another Node4, creating seamless upgrades.

I've tried it, and it's awesome.

I don't even have to explain how it works here. It's simple and the guide is fine.

References

[1] Payara platform and Jelastic PAAS
[2] Jelastic - Jelastic CLI Overview
https://docs.jelastic.com/cli/
[3] Jelastic - Personal Access Tokens
https://docs.jelastic.com/personal-access-tokens/
[4] Jelastic - CLI Tutorial: Public IPs (External Addresses) Swap
https://docs.jelastic.com/cli-ip-swap/

Thursday, 22 April 2021

Alternate Docroots

I have a pressing need to allow files to be accessed that are static.

Unfortunately, there's a web application sitting on my root context ("/").

So I need to define alternate docroots1.

Unfortunately, this seems to be a specific Glassfish or Payara configuration.

As it is bad form, to put this in my code base (who knows where my wars will end up someday), it's better if I put it in the domain.xml file.

That way it's application server dependent, instead of war dependent.

However, I have found the following2:

virtual server's alternate docroots are considered only if a request does not map to any of the web modules deployed on that virtual server. A web module's alternate docroots are considered only once a request has been mapped to that web module.

Which means that an alternative docroot on the virtual server is basically unusable if you have a webapplication situated at your context root "/".

As an example consider the following:

Microprofile Config

Now, I don't much like putting pathnames in my web modules. So I was wondering if it's possible to change that by using Microprofile Config.

And it is3!

It will look something like this:

Other application servers

Other application servers have similar options (of which I know nothing).

In WildFly or the EAP4, it is possible to add another file handler and another location to the undertow subsystem in standalone.xml.

References

[1] A programmer's blog - Map an external directory into Glassfish
http://harkiran-howtos.blogspot.com/2009/08/map-external-directory-into-glassfish.html
[2] Sun GlassFish Enterprise Server v3 Prelude Developer's Guide - Alternate Document Roots
https://docs.oracle.com/cd/E19776-01/820-4496/geqpl/index.html
[3] Payara Community Documentation - Types of variable references
https://docs.payara.fish/community/docs/5.2020.7/documentation/payara-server/server-configuration/var-substitution/types-of-variables.html
[4] StackOverflow - How to configure Wildfly to serve static content (like images)?
https://stackoverflow.com/questions/22684037/how-to-configure-wildfly-to-serve-static-content-like-images