I've a problem regarding Wildfly/Undertow and the JBoss-CLI setting the web-context of Keycloak.
The environment-variable seems not to be resolved in undertow itself, but other environment-variable seems to be resolved.
I've create the following CLI-script:
/subsystem=keycloak-server/:write-attribute(name=web-context,value=${env.KEYCLOAK_WEB_CONTEXT:auth})
which is executed by the docker build and the result in the standalone.xml also looks good :)
When starting the Keycloak-Service it does not resolve the variable, it will just use the variable itself:
14:30:30,556 INFO [org.wildfly.extension.undertow] (ServerService
Thread Pool -- 60) WFLYUT0021: Registered web context:
'/${env.KEYCLOAK_WEB_CONTEXT:auth}' for server 'default-server'
After connecting with the jboss-cli.sh to the container and requesting the variables I got:
[standalone#localhost:9990 subsystem=keycloak-server] ls -l
ATTRIBUTE VALUE TYPE
web-context ${env.KEYCLOAK_WEB_CONTEXT:auth} STRING
With resolved expressions:
[standalone#localhost:9990 subsystem=keycloak-server] ls -l --resolve-expressions
ATTRIBUTE VALUE TYPE
web-context helloworld/auth STRING
So everything looks good so far. Any ideas why Undertow starts with the variable and not the resolved variable? Is it a potential bug?
Best regards and thank you for any help!
I know this is two years old, but I was recently trying to solve this problem and I figured it out so I figured I'd follow up if anyone comes across this.
Instead of using the ${env.VAR} pattern in your expression, use them in the top of the script as a variable assignment. Borrowing from the parent example:
set CONTEXT=${env.KEYCLOAK_WEB_CONTEXT}
/subsystem=keycloak-server/:write-attribute(name=web-context,value=$CONTEXT)
The environment variable gets pulled in as the value of $CONTEXT, even though it never worked for me when used in the write-attribute line.
Related
Hi I'm spinning out Pantheon's Localdev for testing and I'm getting this warning message on the logs
You have a lot of keys!
Any ideas what is causing this warning?
I think this is related to lando. This thread on Github suggests:
To disable the warning you can run lando config you will see a maxKeyWarning setting. This value can be overridden in a lando global config file, i.e. set the value that matches your number of used keys..
As documented in the SSH keys config page, the keys key is meant to be used in combination with a user-space Lando override file. This file is .gitignored and is meant to provide user-specific overrides, eg you would not put ALL the keys of ALL the users here, just yours.
After implementing jasperreport 6.0.0 on kubernetes I am getting below error
Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
I have tried multiple solution but still the error is NOT getting resolved.
Attempt 1: setting -Djava.awt.headless=true
I have implemented this property in YAML file as metioned on
how to add CATALINA_OPTS=-Djava.awt.headless=true this property in Kubernetes configuration
but it did not work.
I tried setting in system property as well System.setProperty("java.awt.headless", "true") but his also did not worked.
Attempt 2: Including missing dependency for xml-apis. It also did not work.
Attempt based on this thread.
Can someone please suggest any solution? The report is working absolutely fine in local environment but getting failed on server. The application is deployed on Kubernetes container
I'm trying to modify the config of a running Wildfly (inside Docker) using the JBoss CLI. One thing I need to do is
data-source add --connection-url=jdbc:mysql://${DB_PORT_3306_TCP_ADDR}:3306/xplore (...)
I need the resulting config in standalone.xml to literally contain
<connection-url>jdbc:mysql://${DB_PORT_3306_TCP_ADDR}:3306/xplore</connection-url>
DB_PORT_3306_TCP_ADDR is a variable that will be resolved by Wildfly when it's rebooted. It does not exist when I'm CLI-ing.
The problem is that CLI attempts to resolve it (and fails) during my CLI session (instead of injecting it as a plain string), resulting in output like errors and even
<connection-url>$</connection-url>
I've tried to work around this by adding "..." and '...', escaping the $ to \$, removing the brackets, and defining a variable containing my string in the script and inserting that variable (still gets resolved). I've looked up the docs on this, and while there is a command resolve-expression(), there is no inverse, no setting for it, nothing. It doesn't seem possible to prevent the resolution from happening.
How can I insert an unresolved expression into my config via the CLI?
The answer was to issue this command:
data-source add --connection-url=jdbc:mysql://${DB_PORT_3306_TCP_ADDR:}:3306/xplore (...)
With a : after ADDR. This obviously solves the resolution error since it will now default to an empty value, and somehow it actually causes the string value itself to be written. It also turns out it wasn't the CLI that was resolving my variable, but the server itself.
The real solution though was to stop the session, modify the server settings and disable variable resolution entirely, then start a new session.
I have read the documentation concerning falling back to environment variables at https://github.com/typesafehub/config/blob/master/HOCON.md#substitution-fallback-to-environment-variables. My understanding was that it would pickup any envars. So for instance, if from the shell I was able to do echo $HOSTNAME and see a non-empty response then HOCON should do that as well.
In my application.conf I have a line
akka.remote.netty.tcp.hostname = ${HOSTNAME}
However, my app is not happy with this and fails to start with.
/conf/application.conf: 9: Could not resolve substitution to a value: ${HOSTNAME}
Is this a user issue? A shell issue? I am able to login as the user and echo $HOSTNAME
Tagging this scala and akka since that userbase probably has the most exposure to HOCON
The reason for HOCON not picking up the envar is that my app runs as a linux service (Centos 6.5) which clears away most environment variables.
See https://unix.stackexchange.com/questions/44370/how-to-make-unix-service-see-environment-variables for a relevant description of the issue
this is a shot in the dark, but are you using an older version of typesafe-config? maybe its a newer-ish feature? the feature seems to be advertised as you describe, but if you are pulling in typesafe-config as a transient dependency (say from akka), maybe you are getting an older version.
what happens if you remove the substitution in your .conf file (so parsing is successful) and then print out the contents of ConfigFactory.systemEnvironment()? for reference: http://typesafehub.github.io/config/latest/api/com/typesafe/config/ConfigFactory.html#systemEnvironment--
HOSTNAME isn't an environment variable. It's a bash internal variable. See https://superuser.com/questions/132489/hostname-environment-variable-on-linux for more details.
I'm looking for a way to replace this on my ActiveMQ config:
<transportConnector uri="tcp://localhost:60019"> disableAsyncDispatch="false"/>
with a "not-hardcoded" URI (e.g., replacing "localhost" with a variable that resolves to an instance dependent value). The problem is that as we have many JBoss instances per server, and that URI above resolves to 0.0.0.0:60019, only one instance at a time can be running, unless we configure it in a per-application basis, which is not only frustrating, but there are circumstances where it is not enough (should be per-instance based, which is much more frustrating).
Each JBoss server has its own IP address, so I thought of using ${jboss.bind.address} to circumvent this, but it won't syntax. We also have an environment variable %SERVERIP% which could be used for this calling it from a start up script, but I don't know if ActiveMQ reads an environment variable for assigning its transport connector URI.
Any help would be much appreciated.
Use a PropertyPlaceHolderConfigurer and you should be able to replace the uri with some ${variable} from file or from jvm system variable. This should work since ActiveMQ configuration is really just a Spring context.