[jira] [Commented] (OFBIZ-10407) create a docker image from the ofbiz system

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10407) create a docker image from the ofbiz system

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17241520#comment-17241520 ]

Ioan Eugen Stan commented on OFBIZ-10407:
-----------------------------------------

Hi,

I would like to add my (outside) experience to this.

I've been working with Docker and Kubernetes for the past 3+ years.

Docker images should be simple and contain as little layers as possible.

This makes maintenance and deployment simple to do and manage over time.

Looking at OFBiz - I see there is:
 * ofbiz-framework - which should be static more or less and only changes with new releases.
 * ofbiz-plugins - which can vary from deployment to deployment - they can be updated more often.
 * configuration files - can be updated even more often then plugins
 * database (external or embedded) - external state
 * client data - most frequent changes - external state, like DB.

The strategy I employed with good results is to build a new docker image when new releases happen and use volumes for configuration and external state.

Databases are usually deployed as a seprate container.

Translating this to OFBiz - build a binary distribution that is the app and in Dockerfile, just unpack that binary.

Use a java-jre image for running the app.

This will keep the image simple to update and manage (bugfix, debug) and the attack surface small.

 

You can use docker to build the entire project from source, but IMO that should be done using docker multi-stage builds [https://docs.docker.com/develop/develop-images/multistage-build/] .

The final docker build stage build should just copy the binary into it's place from previous build.

For the plugins, they can also be unpacked/copied into place or a docker volume can be created/mounted in place and copied there if they need to be managed as state (not recommended).

For configurations - they can be copied in place once the docker image is build - not that good since you want to change configs over time.

I usually mount configs from host system or configmap in Kubernetes.

 

The setup I described above works best if OFBiz publishes artifacts for framework and plugins.

I did not see anything published on central [https://search.maven.org/search?q=ofbiz] .

If the artifacts are published then we can create a gradle project that can be used as a STARTER.

This STARTER project will depend on framework-XX.YY and on plugins-abc-13.23.

It will be able to download the specified versions and bundle them together in a binary distribution - zip or tar.gz.

We can then build a docker image from that binary distribution.

Since gradle can also depend on other gradle subprojects (dependency ":my-plugin-project"), people can also use this setup for local plugin development / testing.

People can copy the starter and build production distributions with the dependencies they want / need.

 

 

 

> create a docker image from the ofbiz system
> -------------------------------------------
>
>                 Key: OFBIZ-10407
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10407
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: Trunk
>            Reporter: Hans Bakker
>            Assignee: Michael Brohl
>            Priority: Major
>              Labels: DevOps
>         Attachments: OFBIZ-10407_dockerfile.patch, docker.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Attached an initial docker version from OFBiz copied from our GrowERP production system translated to svn repositories.
> I propose to create a docker directory in the ofbiz framework root of which a patch is attached.
> The image result is stored in hub.docker.com under the name ofbiz/full-trunk.
> It can be started in a docker environment with the following command:
> docker run -p 80:8080 -p 443:8443 ofbiz/full-trunk
>  and after about 30 seconds it can be show in the browser under:
>  [https://0.0.0.0/catalog/control/main]
>  the image can be created by executing this command in the ofbiz root when the patch is applied:
>  docker build -t ofbiz/full-trunk docker
> the password to the ofbiz account at hub.docker.com will be supplied upon request.
>   
> see the discussion in the mailinglist at https://markmail.org/message/n7wcgroslj7v3gfe?q=docker+ofbiz
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)