You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Markus Rathgeb <ma...@gmail.com> on 2015/09/18 19:44:34 UTC

Custom distribution: change directory layout

Hello,
I would like to change the directory layout of my custom distribution.

Changing "etc/org.apache.felix.fileinstall-deploy.cfg" I could set
another felix.fileinstall.dir.
But how can I remove the "deploy" directory?

Using bin/setsenv[.bat] I can change KARAF_BASE, KARAF_HOME and KARAF_ETC.
But how can I change the assembly so e.g. etc is changed to something_etc,
the stuff for KARAF_HOME is packed to something_home and
the stuff for KARAF_BASE is packed to something_base.

How can I change the directory name in the created archives (.tar.gz
and zip) or instruct the plugin to not create a sub directory at all?

Thanks in advance,
Markus

Re: Custom distribution: change directory layout

Posted by Markus Rathgeb <ma...@gmail.com>.
> I will try to include a fix for 4.0.2.

Great, thanks!

Re: Custom distribution: change directory layout

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Markus,

thanks for the Jira, I will try to include a fix for 4.0.2.

I will keep you posted in the Jira.

Regards
JB

On 09/21/2015 12:53 PM, Markus Rathgeb wrote:
> Created a JIRA: https://issues.apache.org/jira/browse/KARAF-4005
>
> 2015-09-21 7:38 GMT+02:00 Markus Rathgeb <ma...@gmail.com>:
>> The instance helper uses "karafHome.equals(karafBase)" to identify the
>> root instance.
>> I cannot use the same directory for karaf base and karaf home.
>> Some stuff is writing to karaf.base at runtime. Karaf itself create
>> the lock file in karaf base. Also some bundles I need to use seems to
>> write to that directory (I believe this is the working dir).
>>
>> Is it wrong to set base != home or is this check of the instance
>> helper not the best one?
>>
>> 2015-09-20 16:51 GMT+02:00 Markus Rathgeb <ma...@gmail.com>:
>>> I checked in an example, so you could reproduce it:
>>> https://github.com/maggu2810/karaf-custom-distribution/tree/dir-layout
>>>
>>> repo: git@github.com:maggu2810/karaf-custom-distribution.git
>>> branch: dir-layout

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Custom distribution: change directory layout

Posted by Markus Rathgeb <ma...@gmail.com>.
Created a JIRA: https://issues.apache.org/jira/browse/KARAF-4005

2015-09-21 7:38 GMT+02:00 Markus Rathgeb <ma...@gmail.com>:
> The instance helper uses "karafHome.equals(karafBase)" to identify the
> root instance.
> I cannot use the same directory for karaf base and karaf home.
> Some stuff is writing to karaf.base at runtime. Karaf itself create
> the lock file in karaf base. Also some bundles I need to use seems to
> write to that directory (I believe this is the working dir).
>
> Is it wrong to set base != home or is this check of the instance
> helper not the best one?
>
> 2015-09-20 16:51 GMT+02:00 Markus Rathgeb <ma...@gmail.com>:
>> I checked in an example, so you could reproduce it:
>> https://github.com/maggu2810/karaf-custom-distribution/tree/dir-layout
>>
>> repo: git@github.com:maggu2810/karaf-custom-distribution.git
>> branch: dir-layout

Re: Custom distribution: change directory layout

Posted by Markus Rathgeb <ma...@gmail.com>.
The instance helper uses "karafHome.equals(karafBase)" to identify the
root instance.
I cannot use the same directory for karaf base and karaf home.
Some stuff is writing to karaf.base at runtime. Karaf itself create
the lock file in karaf base. Also some bundles I need to use seems to
write to that directory (I believe this is the working dir).

Is it wrong to set base != home or is this check of the instance
helper not the best one?

2015-09-20 16:51 GMT+02:00 Markus Rathgeb <ma...@gmail.com>:
> I checked in an example, so you could reproduce it:
> https://github.com/maggu2810/karaf-custom-distribution/tree/dir-layout
>
> repo: git@github.com:maggu2810/karaf-custom-distribution.git
> branch: dir-layout

Re: Custom distribution: change directory layout

Posted by Markus Rathgeb <ma...@gmail.com>.
I checked in an example, so you could reproduce it:
https://github.com/maggu2810/karaf-custom-distribution/tree/dir-layout

repo: git@github.com:maggu2810/karaf-custom-distribution.git
branch: dir-layout

Re: Custom distribution: change directory layout

Posted by Markus Rathgeb <ma...@gmail.com>.
Hi JB,

I want to adapt the Karaf distribution to some "project" constraints.
This is my intention.

I created the custom distribution using karaf-assembly of the
karaf-maven-plugin.

For testing I changed the directory layout using
"maven-assembly-plugin" on the artifact.
So, unpack the artifact and repack it with a new directory layout.

The startup script I used (see below) changed KARAF_BASE, KARAF_HOME,
KARAF_ETC and KARAF_DATA to point to the new directories.
The the assembly XML it attached below, too.

If I start Karaf now, I see the following warning / error message
before the console prompt occurs (I shortened the path):
Unable to update instance pid: Child instance started but no root
registered in /home/maggu2810/.../karaf/home/instances/instance.properties

At the moment it seems to work, but how can I get rid of this message
about the instances and what does it mean at all?

Best regards,
Markus

=== assembly XML ===
<assembly>

    <id>bin</id>

    <formats>
        <format>tar.gz</format>
        <format>zip</format>
    </formats>

    <includeBaseDirectory>false</includeBaseDirectory>

    <fileSets>

        <fileSet>
            <directory>target/dependencies/${repack.artifactId}-${repack.version}</directory>
            <outputDirectory>/</outputDirectory>
            <excludes>
                <exclude>bin/**</exclude>
                <exclude>data/**</exclude>
                <exclude>deploy/**</exclude>
                <exclude>etc/**</exclude>
                <exclude>lib/**</exclude>
                <exclude>system/**</exclude>
            </excludes>
        </fileSet>

        <fileSet>
            <directory>target/dependencies/${repack.artifactId}-${repack.version}</directory>
            <outputDirectory>/karaf/base</outputDirectory>
            <includes>
                <include>deploy/**</include>
            </includes>
        </fileSet>

        <fileSet>
            <directory>target/dependencies/${repack.artifactId}-${repack.version}</directory>
            <outputDirectory>/karaf/home</outputDirectory>
            <includes>
                <include>bin/**</include>
                <include>lib/**</include>
                <include>system/**</include>
            </includes>
        </fileSet>

        <fileSet>
            <directory>target/dependencies/${repack.artifactId}-${repack.version}</directory>
            <outputDirectory>/karaf/data</outputDirectory>
            <includes>
                <include>data/**</include>
            </includes>
        </fileSet>

        <fileSet>
            <directory>target/dependencies/${repack.artifactId}-${repack.version}</directory>
            <outputDirectory>/karaf/etc</outputDirectory>
            <includes>
                <include>etc/**</include>
            </includes>
        </fileSet>

    </fileSets>

    <files>
        <file>
            <source>src/main/resources/start.sh</source>
            <outputDirectory>/</outputDirectory>
            <fileMode>0755</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
    </files>

</assembly>

=== startup script ===

#!/bin/sh

DIRNAME=`dirname "$0"`
cd "${DIRNAME}"
DIRNAME="${PWD}"
cd "${OLDPWD}"

TEST_HOME="${DIRNAME}"

export KARAF_HOME="${TEST_HOME}/karaf/home"
export KARAF_DATA="${TEST_HOME}/karaf/data/data"
export KARAF_BASE="${TEST_HOME}/karaf/base"
export KARAF_ETC="${TEST_HOME}/karaf/etc/etc"

exec "${KARAF_HOME}"/bin/karaf

2015-09-20 7:06 GMT+02:00 Jean-Baptiste Onofré <jb...@nanthrax.net>:
> Hi Markus,
>
> for the deploy folder, just remove
> etc/org.apache.felix.fileinstall-deploy.cfg file and the deploy folder:
> deploy will be disable. I also advise to not deploy the deployer bundles (as
> it's no more used).
>
> For the distribution layout, starting for the framework kar, it's not really
> possible as the kar already have the layout.
> I will create Jira to improve that and allow the plugin to change the target
> locations.
>
> The purpose of the current variables is more to be able to adapt to your
> machine/administrator constraint: put KARAF_ETC in /etc/karaf, put
> KARAF_BASE in /var/karaf and KARAF_HOME in /home/karaf for instance (by
> moving the directories).
>
> Regards
> JB
>
>
> On 09/18/2015 07:44 PM, Markus Rathgeb wrote:
>>
>> Hello,
>> I would like to change the directory layout of my custom distribution.
>>
>> Changing "etc/org.apache.felix.fileinstall-deploy.cfg" I could set
>> another felix.fileinstall.dir.
>> But how can I remove the "deploy" directory?
>>
>> Using bin/setsenv[.bat] I can change KARAF_BASE, KARAF_HOME and KARAF_ETC.
>> But how can I change the assembly so e.g. etc is changed to something_etc,
>> the stuff for KARAF_HOME is packed to something_home and
>> the stuff for KARAF_BASE is packed to something_base.
>>
>> How can I change the directory name in the created archives (.tar.gz
>> and zip) or instruct the plugin to not create a sub directory at all?
>>
>> Thanks in advance,
>> Markus
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: Custom distribution: change directory layout

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Markus,

for the deploy folder, just remove 
etc/org.apache.felix.fileinstall-deploy.cfg file and the deploy folder: 
deploy will be disable. I also advise to not deploy the deployer bundles 
(as it's no more used).

For the distribution layout, starting for the framework kar, it's not 
really possible as the kar already have the layout.
I will create Jira to improve that and allow the plugin to change the 
target locations.

The purpose of the current variables is more to be able to adapt to your 
machine/administrator constraint: put KARAF_ETC in /etc/karaf, put 
KARAF_BASE in /var/karaf and KARAF_HOME in /home/karaf for instance (by 
moving the directories).

Regards
JB

On 09/18/2015 07:44 PM, Markus Rathgeb wrote:
> Hello,
> I would like to change the directory layout of my custom distribution.
>
> Changing "etc/org.apache.felix.fileinstall-deploy.cfg" I could set
> another felix.fileinstall.dir.
> But how can I remove the "deploy" directory?
>
> Using bin/setsenv[.bat] I can change KARAF_BASE, KARAF_HOME and KARAF_ETC.
> But how can I change the assembly so e.g. etc is changed to something_etc,
> the stuff for KARAF_HOME is packed to something_home and
> the stuff for KARAF_BASE is packed to something_base.
>
> How can I change the directory name in the created archives (.tar.gz
> and zip) or instruct the plugin to not create a sub directory at all?
>
> Thanks in advance,
> Markus
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com