karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofre ...@nanthrax.net>
Subject Re: [HEADS UP] Docker friendly runtime with env variables compliant configuration
Date Mon, 28 Sep 2020 11:29:44 GMT
Yeah, that makes sense for configuration plugin. For now, I just leveraged what we already
have (without code change, just change in features XML).

I can do some more "invasive" ;)

Let me update the PR.

Regards
JB

> Le 28 sept. 2020 à 11:39, Romain Manni-Bucau <rmannibucau@gmail.com> a écrit
:
> 
> +1, I'd try to push for a built-in support -
> (<pid>.<property_name>).toUpperCase(ROOT).replace('.', '_') - to make it
> generic and not specific to some entries. It would also enable to not have
> to rename these env variables or have to maintain some fallbacks.
> What about just implementing a felix config admin configuration plugin?
> sounds less invasive and better on the long run? Did you give it a try?
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau>
|
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/application-development/java-ee-8-high-performance>
> 
> 
> Le lun. 28 sept. 2020 à 11:12, Jean-Baptiste Onofre <jb@nanthrax.net> a
> écrit :
> 
>> Fair enough (and I agree ;)).
>> 
>> Regards
>> JB
>> 
>>> Le 28 sept. 2020 à 11:09, Grzegorz Grzybek <gr.grzybek@gmail.com> a
>> écrit :
>>> 
>>> I'd stick to explicit approach for now and leave "implicit" one for
>> later ;)
>>> 
>>> regards
>>> Grzegorz Grzybek
>>> 
>>> pon., 28 wrz 2020 o 11:08 Jean-Baptiste Onofre <jb@nanthrax.net <mailto:
>> jb@nanthrax.net>> napisał(a):
>>> 
>>>> Just to be clear: today I’m using an "explicit" approach, where the
>> config
>>>> contains something like:
>>>> 
>>>> sshPort=${env:KARAF_SSH_PORT:-8101}
>>>> 
>>>> But we can also have "implicit" approach (with some more changes
>> required).
>>>> 
>>>> Regards
>>>> JB
>>>> 
>>>>> Le 28 sept. 2020 à 11:07, Jean-Baptiste Onofre <jb@nanthrax.net>
a
>>>> écrit :
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> At beginning, I did a very simple change in Karaf Main: for instance,
>>>> you would be able to do
>>>>> 
>>>>> Bin/karaf -Dpid:prop=value
>>>>> 
>>>>> And I init the configuration file with the value.
>>>>> 
>>>>> However, system properties are not super easy with docker.
>>>>> 
>>>>> That’s why I preferred the env variable approach.
>>>>> 
>>>>> Now, about env variable, I just leverage what we already have in Karaf
>>>> (just updating the default configuration file).
>>>>> 
>>>>> I can do a new iteration where (in configadmin repository), I’m
>> checking
>>>> ALL env variables to find one matching.
>>>>> It would mean something like:
>>>>> 
>>>>> $ export KARAF.MY_PID.prop=value
>>>>> 
>>>>> For instance.
>>>>> 
>>>>> We would need a "env variable format".
>>>>> 
>>>>> Thoughts ?
>>>>> 
>>>>> Regards
>>>>> JB
>>>>> 
>>>>>> Le 28 sept. 2020 à 10:59, Grzegorz Grzybek <gr.grzybek@gmail.com
>>>> <mailto:gr.grzybek@gmail.com <mailto:gr.grzybek@gmail.com>>>
a écrit :
>>>>>> 
>>>>>> Hello
>>>>>> 
>>>>>> Good idea!
>>>>>> 
>>>>>> Shouldn't configadmin do it by default?
>>>>>> 
>>>>>> Like dissect "KARAF_SSH_PORT" or similar env variables into:
>>>>>> - prefix (KARAF_) - rejected
>>>>>> - PID pointer (e.g., SSH → org.apache.karaf.shell)
>>>>>> - property (e.g PORT → sshPort)
>>>>>> ?
>>>>>> 
>>>>>> This way it could be done in one place... Just my random observation,
>>>>>> because I can't dig this problem further for now ;)
>>>>>> 
>>>>>> regards
>>>>>> Grzegorz Grzybek
>>>>>> 
>>>>>> pon., 28 wrz 2020 o 10:51 Jean-Baptiste Onofre <jb@nanthrax.net
>> <mailto:jb@nanthrax.net>
>>>> <mailto:jb@nanthrax.net <mailto:jb@nanthrax.net>> <mailto:
>> jb@nanthrax.net <mailto:jb@nanthrax.net> <mailto:jb@nanthrax.net <mailto:
>> jb@nanthrax.net>>>>
>>>> napisał(a):
>>>>>> 
>>>>>>> Hi guys,
>>>>>>> 
>>>>>>> In order to easily use Karaf in docker container, I created the
>>>> following
>>>>>>> PR:
>>>>>>> 
>>>>>>> https://github.com/apache/karaf/pull/1203 <
>> https://github.com/apache/karaf/pull/1203> <
>>>> https://github.com/apache/karaf/pull/1203 <
>> https://github.com/apache/karaf/pull/1203>> <
>>>> https://github.com/apache/karaf/pull/1203 <
>> https://github.com/apache/karaf/pull/1203> <
>>>> https://github.com/apache/karaf/pull/1203 <
>> https://github.com/apache/karaf/pull/1203>>> <
>>>>>>> https://github.com/apache/karaf/pull/1203 <
>>>> https://github.com/apache/karaf/pull/1203> <
>>>> https://github.com/apache/karaf/pull/1203 <
>>>> https://github.com/apache/karaf/pull/1203>>>
>>>>>>> 
>>>>>>> The purpose is allow use to override some configuration properties
>>>> using
>>>>>>> env variables.
>>>>>>> 
>>>>>>> For instance, if you want to use 8102 instead of default 8101
ssh
>> port
>>>>>>> number, you can do:
>>>>>>> 
>>>>>>> $ export KARAF_SSH_PORT=8102
>>>>>>> $ bin/karaf
>>>>>>> 
>>>>>>> I listed the environment variables here:
>>>>>>> 
>>>>>>> 
>>>> 
>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>> <
>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>>> 
>>>> <
>>>> 
>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>>>>> 
>>>>>>> <
>>>>>>> 
>>>> 
>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>>>> <
>>>> 
>> https://github.com/apache/karaf/blob/4eda325e73d1d7dfbc0508258bde582e93d4f05e/manual/src/main/asciidoc/user-guide/configuration.adoc
>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> I didn’t define environment variables for all properties. If
you see
>>>> some
>>>>>>> properties that it would be interesting to override by env variables,
>>>>>>> please let me know, I will update the PR.
>>>>>>> 
>>>>>>> NB: I will also update pax* to use similar approach.
>>>>>>> 
>>>>>>> Thoughts ?
>>>>>>> 
>>>>>>> Regards
>>>>>>> JB
>> 
>> 


Mime
View raw message