Hi,

you can change in etc/shell.init.script.

Here you can define a set of commands executed at startup. You can also create a
script wrapping all your commands.

Regards
JB

On 03/01/2018 10:10 PM, Steinar Bang wrote:
> Is it possible to make a karaf installation run a set of console
> commands?
> 
> What I would like to do, is to try to create a dockerfile setting up a
> docker image for my webapp:
>        https://github.com/steinarb/ukelonn
> 
> And the steps listed in 6. and 8. below are run from the karaf console.
> Is it possible to run them from an outside script somehow?
> 
> What I would need to do to create a docker image, is to:
>  1. Start with a minimal debian installation
>  2. Add the default location of postgres databases as a volume
>     (ie. mounted from the host's file system)
>  3. Add /etc/karaf as a volume
>  4. Add the repository for the unofficial karaf package
>      echo "deb http://apt.bang.priv.no/public stable main" 
> >>/etc/apt/sources.list
>      wget -O - https://apt.bang.priv.no/apt_pub.gpg | apt-key add -
>  5. Install karaf and postgresql and all of their dependencies
>      apt-get update
>      apt-get install -yq --no-install-recommends postgresql karaf
>  6. Configure up an extra maven repository from the karaf console:
>      config:edit org.ops4j.pax.url.mvn
>      config:property-append org.ops4j.pax.url.mvn.repositories ", 
> https://maven.bang.priv.no/repository/@id=ukelonn@snapshots, 
> http://maven.vaadin.com/vaadin-addons@id=vaadin";
>      config:property-set org.ops4j.pax.url.mvn.globalUpdatePolicy always
>      config:update
>  7. Create an empty database karaf owned by user karaf
>      /usr/bin/sudo -u postgres createuser karaf
>      /usr/bin/sudo -u postgres createdb -O karaf ukelonn
>  8. Add the feature repository and install the features
>      feature:repo-add 
> mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/features
>      feature:install ukelonn-db-postgresql
>      feature:install ukelonn
> 
> 
> 

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

Reply via email to