You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Michael Brohl <mi...@ecomify.de> on 2020/03/13 17:05:59 UTC

Dockerfiles for OFBiz

Hi everyone,

please have a look at the solutions provided in 
https://issues.apache.org/jira/browse/OFBIZ-10407.

The main questions for the mailing list:

1. do we want to add and maintain Docker files in our codebase?

2. if yes, which version should we use?

3. if yes, additionally: would it be a good idea to place OFBiz Docker 
images on docker hub and maintain them?

What do you think?

Thanks,

Michael Brohl

ecomify GmbH - www.ecomify.de



Re: Dockerfiles for OFBiz

Posted by Daniel Watford <da...@foomoo.co.uk>.
Hi Pierre,

As a quick follow up which might be useful to you...

I've created a docker-ofbiz github project at
https://github.com/danwatford/ofbiz-docker which uses gradle to construct
the Dockerfile on the fly when building the image.

Blog post here -
https://www.watfordconsulting.com/2020/04/01/building-apache-ofbiz-docker-images/



On Wed, 25 Mar 2020 at 15:28, Daniel Watford <da...@foomoo.co.uk> wrote:

> Hi Pierre,
>
> Sorry for coming back to this so late, but I thought I'd share how I have
> my project setup for docker and pushing to a test environment in case its
> of any use to you.
>
> I'm working on a plugin called Activate, built against Ofbiz R18.
>
> My work area is structured as:
> - activate-docker-ofbiz-framework (private repo)
> - - local-config
> - - - environment-seed-data.xml
> - - ofbiz (https://github.com/danwatford/ofbiz-framework forked from
> https://github.com/apache/ofbiz-framework)
> - - - plugins
> - - - - activate (private repo)
>
> The activate-docker-ofbiz-framework project exists to build a docker image
> of ofbiz both with and without the plugin.
>
> The build.gradle file and .dockerignore file are attached. See
> task buildOfbizBaseImage in build.gradle.
>
> In build.gradle I'm using the com.bmuschko.docker-remote-api plugin to
> construct a Dockerfile and build an image. I preferred the idea of keeping
> as much build information in build.gradle rather than spreading it out
> across build.gradle and a separate Dockerfile.
>
> Building Dockerfile on the fly gives opportunities to create different
> variants of docker images.
>
> In this case I can build the ofbiz image from the
> activate-docker-ofbiz-framework directory with:
>  ./gradlew buildOfbizBaseImage
>
> Once the base image is built, I extend it to include my plugin using:
>    ./gradlew buildOfbizBaseImage
>
> I separate building the two images for performance reasons, although these
> aren't massive savings.
>
>
> Next I can run the new image with docker-compose (see attached
> docker-compose-standalone.yml file):
>   docker-compose -f docker-compose-standalone.yml up
>
> Here ofbiz is launched in the container using: ./gradlew "ofbiz
> --load-data dir=local-config" ofbiz
>
> The --load-data argument causes the environment-seed-data.xml file to be
> loaded, in this case to set the admin user's password to 'ofbiz' without
> the need to change the password when they log in.
>
> Visit https://localhost:8443/  (you may need to vary the hostname
> depending on your docker environment).
>
>
> The above approach works well for me as I have some Azure DevOps pipelines
> triggered from updates to git repositories to build my image, push to my
> docker repository and then restart docker-compose running in my test
> environment.
>
> The local-config directory in each test environment can hold different
> data to load when the environment is brought up, configuring user accounts
> and passwords as needed.
>
> Hope this helps,
>
> Dan.
>
>
>
> On Fri, 13 Mar 2020 at 17:37, Pierre Smits <pi...@apache.org> wrote:
>
>> As I have stated in the ticket (and it being good enough to repeat it
>> here):
>>
>> I have been working on a solution that will enable users
>> (developers/adopters/etc.) to generate containers, that either will be
>> based:
>>
>>
>>    - on a branch (trunk or whatever) without plugins and git-aware
>>    - on a branch with plugins git-aware
>>    - on a release without plugins
>>    - on a release with plugins
>>
>>
>> And for the latter two I am looking at how to have it production-ready.
>>
>>
>> Having docker hub working with it is a good idea. I started testing that
>> angle a short while ago. It is an additional means to spread, and enables
>> the project to control/direct some flow of dissemination. And for some
>> (developers and/or potential adopters) it is a starting point.
>>
>> Met vriendelijke groet,
>>
>> Pierre Smits
>> *Proud* *contributor** of* Apache OFBiz <https://ofbiz.apache.org/> since
>> 2008 (without privileges)
>>
>> *Apache Trafodion <https://trafodion.apache.org>, Vice President*
>> *Apache Directory <https://directory.apache.org>, PMC Member*
>> Apache Incubator <https://incubator.apache.org>, committer
>> Apache Steve <https://steve.apache.org>, committer
>>
>>
>> On Fri, Mar 13, 2020 at 6:22 PM Taher Alkhateeb <
>> slidingfilaments@gmail.com>
>> wrote:
>>
>> > Hello Michael,
>> >
>> > 1. Absolutely from my side. Deployment becomes drastically simpler
>> > 2. Which version of what?
>> > 3. Hmm, I'm not sure of the purpose / benefit of having that. No one
>> > just "deploys" OFBiz without customization. And even if so, if you
>> > have comfy scripts in the code base, then that would be enough.
>> >
>> > Ideally, the way I'd go for it is to have a Dockerfile at the top
>> > level directory and a docker folder to hold everything else.
>> > Deployment can be targeted to multiple different environments  such
>> > that even the development environment can depend on a database engine
>> > like postgres by default.
>> >
>> > On Fri, Mar 13, 2020 at 8:06 PM Michael Brohl <michael.brohl@ecomify.de
>> >
>> > wrote:
>> > >
>> > > Hi everyone,
>> > >
>> > > please have a look at the solutions provided in
>> > > https://issues.apache.org/jira/browse/OFBIZ-10407.
>> > >
>> > > The main questions for the mailing list:
>> > >
>> > > 1. do we want to add and maintain Docker files in our codebase?
>> > >
>> > > 2. if yes, which version should we use?
>> > >
>> > > 3. if yes, additionally: would it be a good idea to place OFBiz Docker
>> > > images on docker hub and maintain them?
>> > >
>> > > What do you think?
>> > >
>> > > Thanks,
>> > >
>> > > Michael Brohl
>> > >
>> > > ecomify GmbH - www.ecomify.de
>> > >
>> > >
>> >
>>
>
>
> --
> Daniel Watford
>


-- 
Daniel Watford

Re: Dockerfiles for OFBiz

Posted by Daniel Watford <da...@foomoo.co.uk>.
Hi Pierre,

Sorry for coming back to this so late, but I thought I'd share how I have
my project setup for docker and pushing to a test environment in case its
of any use to you.

I'm working on a plugin called Activate, built against Ofbiz R18.

My work area is structured as:
- activate-docker-ofbiz-framework (private repo)
- - local-config
- - - environment-seed-data.xml
- - ofbiz (https://github.com/danwatford/ofbiz-framework forked from
https://github.com/apache/ofbiz-framework)
- - - plugins
- - - - activate (private repo)

The activate-docker-ofbiz-framework project exists to build a docker image
of ofbiz both with and without the plugin.

The build.gradle file and .dockerignore file are attached. See
task buildOfbizBaseImage in build.gradle.

In build.gradle I'm using the com.bmuschko.docker-remote-api plugin to
construct a Dockerfile and build an image. I preferred the idea of keeping
as much build information in build.gradle rather than spreading it out
across build.gradle and a separate Dockerfile.

Building Dockerfile on the fly gives opportunities to create different
variants of docker images.

In this case I can build the ofbiz image from the
activate-docker-ofbiz-framework directory with:
 ./gradlew buildOfbizBaseImage

Once the base image is built, I extend it to include my plugin using:
   ./gradlew buildOfbizBaseImage

I separate building the two images for performance reasons, although these
aren't massive savings.


Next I can run the new image with docker-compose (see attached
docker-compose-standalone.yml file):
  docker-compose -f docker-compose-standalone.yml up

Here ofbiz is launched in the container using: ./gradlew "ofbiz --load-data
dir=local-config" ofbiz

The --load-data argument causes the environment-seed-data.xml file to be
loaded, in this case to set the admin user's password to 'ofbiz' without
the need to change the password when they log in.

Visit https://localhost:8443/  (you may need to vary the hostname depending
on your docker environment).


The above approach works well for me as I have some Azure DevOps pipelines
triggered from updates to git repositories to build my image, push to my
docker repository and then restart docker-compose running in my test
environment.

The local-config directory in each test environment can hold different data
to load when the environment is brought up, configuring user accounts and
passwords as needed.

Hope this helps,

Dan.



On Fri, 13 Mar 2020 at 17:37, Pierre Smits <pi...@apache.org> wrote:

> As I have stated in the ticket (and it being good enough to repeat it
> here):
>
> I have been working on a solution that will enable users
> (developers/adopters/etc.) to generate containers, that either will be
> based:
>
>
>    - on a branch (trunk or whatever) without plugins and git-aware
>    - on a branch with plugins git-aware
>    - on a release without plugins
>    - on a release with plugins
>
>
> And for the latter two I am looking at how to have it production-ready.
>
>
> Having docker hub working with it is a good idea. I started testing that
> angle a short while ago. It is an additional means to spread, and enables
> the project to control/direct some flow of dissemination. And for some
> (developers and/or potential adopters) it is a starting point.
>
> Met vriendelijke groet,
>
> Pierre Smits
> *Proud* *contributor** of* Apache OFBiz <https://ofbiz.apache.org/> since
> 2008 (without privileges)
>
> *Apache Trafodion <https://trafodion.apache.org>, Vice President*
> *Apache Directory <https://directory.apache.org>, PMC Member*
> Apache Incubator <https://incubator.apache.org>, committer
> Apache Steve <https://steve.apache.org>, committer
>
>
> On Fri, Mar 13, 2020 at 6:22 PM Taher Alkhateeb <
> slidingfilaments@gmail.com>
> wrote:
>
> > Hello Michael,
> >
> > 1. Absolutely from my side. Deployment becomes drastically simpler
> > 2. Which version of what?
> > 3. Hmm, I'm not sure of the purpose / benefit of having that. No one
> > just "deploys" OFBiz without customization. And even if so, if you
> > have comfy scripts in the code base, then that would be enough.
> >
> > Ideally, the way I'd go for it is to have a Dockerfile at the top
> > level directory and a docker folder to hold everything else.
> > Deployment can be targeted to multiple different environments  such
> > that even the development environment can depend on a database engine
> > like postgres by default.
> >
> > On Fri, Mar 13, 2020 at 8:06 PM Michael Brohl <mi...@ecomify.de>
> > wrote:
> > >
> > > Hi everyone,
> > >
> > > please have a look at the solutions provided in
> > > https://issues.apache.org/jira/browse/OFBIZ-10407.
> > >
> > > The main questions for the mailing list:
> > >
> > > 1. do we want to add and maintain Docker files in our codebase?
> > >
> > > 2. if yes, which version should we use?
> > >
> > > 3. if yes, additionally: would it be a good idea to place OFBiz Docker
> > > images on docker hub and maintain them?
> > >
> > > What do you think?
> > >
> > > Thanks,
> > >
> > > Michael Brohl
> > >
> > > ecomify GmbH - www.ecomify.de
> > >
> > >
> >
>


-- 
Daniel Watford

Re: Dockerfiles for OFBiz

Posted by Pierre Smits <pi...@apache.org>.
As I have stated in the ticket (and it being good enough to repeat it here):

I have been working on a solution that will enable users
(developers/adopters/etc.) to generate containers, that either will be
based:


   - on a branch (trunk or whatever) without plugins and git-aware
   - on a branch with plugins git-aware
   - on a release without plugins
   - on a release with plugins


And for the latter two I am looking at how to have it production-ready.


Having docker hub working with it is a good idea. I started testing that
angle a short while ago. It is an additional means to spread, and enables
the project to control/direct some flow of dissemination. And for some
(developers and/or potential adopters) it is a starting point.

Met vriendelijke groet,

Pierre Smits
*Proud* *contributor** of* Apache OFBiz <https://ofbiz.apache.org/> since
2008 (without privileges)

*Apache Trafodion <https://trafodion.apache.org>, Vice President*
*Apache Directory <https://directory.apache.org>, PMC Member*
Apache Incubator <https://incubator.apache.org>, committer
Apache Steve <https://steve.apache.org>, committer


On Fri, Mar 13, 2020 at 6:22 PM Taher Alkhateeb <sl...@gmail.com>
wrote:

> Hello Michael,
>
> 1. Absolutely from my side. Deployment becomes drastically simpler
> 2. Which version of what?
> 3. Hmm, I'm not sure of the purpose / benefit of having that. No one
> just "deploys" OFBiz without customization. And even if so, if you
> have comfy scripts in the code base, then that would be enough.
>
> Ideally, the way I'd go for it is to have a Dockerfile at the top
> level directory and a docker folder to hold everything else.
> Deployment can be targeted to multiple different environments  such
> that even the development environment can depend on a database engine
> like postgres by default.
>
> On Fri, Mar 13, 2020 at 8:06 PM Michael Brohl <mi...@ecomify.de>
> wrote:
> >
> > Hi everyone,
> >
> > please have a look at the solutions provided in
> > https://issues.apache.org/jira/browse/OFBIZ-10407.
> >
> > The main questions for the mailing list:
> >
> > 1. do we want to add and maintain Docker files in our codebase?
> >
> > 2. if yes, which version should we use?
> >
> > 3. if yes, additionally: would it be a good idea to place OFBiz Docker
> > images on docker hub and maintain them?
> >
> > What do you think?
> >
> > Thanks,
> >
> > Michael Brohl
> >
> > ecomify GmbH - www.ecomify.de
> >
> >
>

Re: Dockerfiles for OFBiz

Posted by Michael Brohl <mi...@ecomify.de>.
Hi Taher,


Am 13.03.20 um 18:21 schrieb Taher Alkhateeb:
> Hello Michael,
>
> 1. Absolutely from my side. Deployment becomes drastically simpler
> 2. Which version of what?

There is a pull request from Pierre, see my remarks towards this version 
in the issue comments.

I've provided an alternative, see patch file attached to the issue.


> 3. Hmm, I'm not sure of the purpose / benefit of having that. No one
> just "deploys" OFBiz without customization. And even if so, if you
> have comfy scripts in the code base, then that would be enough.
>
> Ideally, the way I'd go for it is to have a Dockerfile at the top
> level directory and a docker folder to hold everything else.
> Deployment can be targeted to multiple different environments  such
> that even the development environment can depend on a database engine
> like postgres by default.

Thanksks for your suggestions, Taher.

Michael


>
> On Fri, Mar 13, 2020 at 8:06 PM Michael Brohl <mi...@ecomify.de> wrote:
>> Hi everyone,
>>
>> please have a look at the solutions provided in
>> https://issues.apache.org/jira/browse/OFBIZ-10407.
>>
>> The main questions for the mailing list:
>>
>> 1. do we want to add and maintain Docker files in our codebase?
>>
>> 2. if yes, which version should we use?
>>
>> 3. if yes, additionally: would it be a good idea to place OFBiz Docker
>> images on docker hub and maintain them?
>>
>> What do you think?
>>
>> Thanks,
>>
>> Michael Brohl
>>
>> ecomify GmbH - www.ecomify.de
>>
>>


Re: Dockerfiles for OFBiz

Posted by Taher Alkhateeb <sl...@gmail.com>.
Sounds great. I would recommend a combination of docker +
docker-compose + scripts + environment files to get everything fully
automated and also parameterized

On Fri, Mar 13, 2020 at 10:00 PM Michael Brohl <mi...@ecomify.de> wrote:
>
> Hi Taher,
>
> Am 13.03.20 um 18:21 schrieb Taher Alkhateeb:
> > Hello Michael,
> >
> > 1. Absolutely from my side. Deployment becomes drastically simpler
> > 2. Which version of what?
> > 3. Hmm, I'm not sure of the purpose / benefit of having that. No one
> > just "deploys" OFBiz without customization. And even if so, if you
> > have comfy scripts in the code base, then that would be enough.
> >
> > Ideally, the way I'd go for it is to have a Dockerfile at the top
> > level directory and a docker folder to hold everything else.
> > Deployment can be targeted to multiple different environments  such
> > that even the development environment can depend on a database engine
> > like postgres by default.
>
> I have an idea how to solve this with a more sophisticated Docker file
> together with the config mechanism we use here at ecomify. Describing
> this for a proposal to contribute is still on my agenda.
>
> This would allow configuring everything and build a docker image by just
> copying a a single (or multiple staged) files during the build process.
> This would allow to configure every single property used in OFBiz
> (database, ports, security etc.) and build targeted images from that.
>
> Let's see when I find time...
>
> Michael
>
>
>

Re: Dockerfiles for OFBiz

Posted by Michael Brohl <mi...@ecomify.de>.
Hi Taher,

Am 13.03.20 um 18:21 schrieb Taher Alkhateeb:
> Hello Michael,
>
> 1. Absolutely from my side. Deployment becomes drastically simpler
> 2. Which version of what?
> 3. Hmm, I'm not sure of the purpose / benefit of having that. No one
> just "deploys" OFBiz without customization. And even if so, if you
> have comfy scripts in the code base, then that would be enough.
>
> Ideally, the way I'd go for it is to have a Dockerfile at the top
> level directory and a docker folder to hold everything else.
> Deployment can be targeted to multiple different environments  such
> that even the development environment can depend on a database engine
> like postgres by default.

I have an idea how to solve this with a more sophisticated Docker file 
together with the config mechanism we use here at ecomify. Describing 
this for a proposal to contribute is still on my agenda.

This would allow configuring everything and build a docker image by just 
copying a a single (or multiple staged) files during the build process. 
This would allow to configure every single property used in OFBiz 
(database, ports, security etc.) and build targeted images from that.

Let's see when I find time...

Michael




Re: Dockerfiles for OFBiz

Posted by Taher Alkhateeb <sl...@gmail.com>.
Hello Michael,

1. Absolutely from my side. Deployment becomes drastically simpler
2. Which version of what?
3. Hmm, I'm not sure of the purpose / benefit of having that. No one
just "deploys" OFBiz without customization. And even if so, if you
have comfy scripts in the code base, then that would be enough.

Ideally, the way I'd go for it is to have a Dockerfile at the top
level directory and a docker folder to hold everything else.
Deployment can be targeted to multiple different environments  such
that even the development environment can depend on a database engine
like postgres by default.

On Fri, Mar 13, 2020 at 8:06 PM Michael Brohl <mi...@ecomify.de> wrote:
>
> Hi everyone,
>
> please have a look at the solutions provided in
> https://issues.apache.org/jira/browse/OFBIZ-10407.
>
> The main questions for the mailing list:
>
> 1. do we want to add and maintain Docker files in our codebase?
>
> 2. if yes, which version should we use?
>
> 3. if yes, additionally: would it be a good idea to place OFBiz Docker
> images on docker hub and maintain them?
>
> What do you think?
>
> Thanks,
>
> Michael Brohl
>
> ecomify GmbH - www.ecomify.de
>
>