GithubHelp home page GithubHelp logo

stefanleh / hybris-base-image Goto Github PK

View Code? Open in Web Editor NEW
48.0 11.0 40.0 106 KB

A base image for Hybris Commerce Suite using ubuntu:latest

License: Apache License 2.0

Shell 47.01% Dockerfile 52.99%
hybris hybris-commerce-suite

hybris-base-image's Introduction

This Docker Image is unmaintained at the moment as my current employer does not use SAP Hybris. As the access to current releases and documentation is restricted to people working for SAP Hybris parterns its not possible for me to keep this project up to date. Therefore feel free to contact me if you like to maintain this project.

hybris-base-image

A base image for Hybris Commerce Suite, based on ubuntu:latest.

Can be used Out-Of-The-Box for projects based on Hybris Commerce Suite >5.5.

Please read this documentation directly in GitHub. Otherwise the links might not work.

The image on DockerHub is built automatically from the Dockerfile in the GitHub source repository.

Installed packages

  • gosu
  • lsof
  • unzip
  • ca-certificates
  • curl
  • oracle java 8 (1.8.0_171 via PPA Repository)

User

User Group uid gid
hybris hybris 1000 1000

Ports

Port Purpose
9001 default HTTP port
9002 default HTTPS port
8983 default SOLR port
8000 default DEBUG port

The image exposes 9001 and 9002 for access to the hybris Tomcat server via HTTP and HTTPS.

Also the default Solr server port 8983 is exposed.

Please be aware that in non dev environments the Solr server(s) should run in own container(s).

If you like to debug via your IDE on the running server you can use the exposed 8000 port.

Volumes

The hybris home directory /home/hybris is marked as volume. You can override it by setting the HYBRIS_HOME variable.

How to add your code

Using a Dockerfile you can copy the output archives, generated using ant production, into the hybris home directory of the image. The entrypoint-script will unzip them when the container starts.

If you want you can copy unzipped content too, but this will bloat the images you push to your own repository.

FROM stefanlehmann/hybris-base-image:latest
MAINTAINER You <[email protected]>

# copy the build packages over
COPY hybrisServer*.zip $HYBRIS_HOME

Configuration support

For support of different database configurations per container the following environment variables can be set when starting a container. They will be used to add the properties in second column to local.properties file.

Environment variable local.properties
HYBRIS_DB_URL db.url=$HYBRIS_DB_URL
HYBRIS_DB_DRIVER db.driver=$HYBRIS_DB_DRIVER
HYBRIS_DB_USER db.username=$HYBRIS_DB_USER
HYBRIS_DB_PASSWORD db.password=$HYBRIS_DB_PASSWORD
HYBRIS_DATAHUB_URL datahubadapter.datahuboutbound.url=$HYBRIS_DATAHUB_URL

Of course you can also build with defaults like db.url=jdbc:mysql://database-container/database?useConfigs=maxPerformance&characterEncoding=utf8 in your local.properties and use the linking functionality of docker to inject the correct container name which should be mapped to database-container.

Clustering

For easy clustering the entrypoint-script adds the property cluster.broadcast.method.jgroups.tcp.bind_addr with currently used container-IP-adress to local.properties. Please be aware that this only happens on first start of the container, so when you restart the container and maybe get another ip this can lead to not working clustering.

How to use

As this image is just a base for running SAP Hybris you need to either copy your own production artefacts in and commit the result as your own image or mount a directory containing them. For the latter no own images are needed.

Using hybris artefacts copied into image
docker run -d --name HYBRIS_CONTAINER_NAME -p HOST_HTTP_PORT:9001 -p HOST_HTTPS_PORT:9002 REGISTRY/IMAGE:VERSION
Using hybris artefacts in directory on Docker host
docker run -d --name HYBRIS_CONTAINER_NAME -p HOST_HTTP_PORT:9001 -p HOST_HTTPS_PORT:9002 -v /PATH/TO/hybris:/home/hybris stefanlehmann/hybris-base-image:latest
Running with debug listener enabled
docker run -d --name HYBRIS_CONTAINER_NAME -p HOST_HTTP_PORT:9001 -p HOST_HTTPS_PORT:9002 REGISTRY/IMAGE:VERSION run debug

The important part is the run debug at the end if the line.

Running update system when starting a container

For automation of running the system update before starting the server you can use the environment variable HYBRIS_UPDATE_SYSTEM=yes. You can find the default configuration for this in updateRunningSystem.config.

If you like to use your own configuration you can export it in HAC

HAC Screenshot

After you got your config you can include it into your own application image via

FROM stefanlehmann/hybris-base-image:latest
MAINTAINER You <[email protected]>

# copy the build packages over
COPY hybrisServer*.zip $HYBRIS_HOME

# copy the update system config to image
COPY updateRunningSystem.config $HYBRIS_HOME/updateRunningSystem.config

Hint

As the image is not intended for recompiling the hybris platform inside a container please get sure to build with following parameter in your local.properties to avoid hardcoded paths in your config artifact:

## https://wiki.hybris.com/display/release5/ant+production+improvements#antproductionimprovements-withoutAntHowtorunhybrisserveronproductionenvironmentwithoutneedtocallanyanttarget
## for docker we need to use the PLATFORM_HOME environment variable instead of absolute paths in server*.xml files and wrapper*.conf files
production.legacy.mode=false

Complete example on how to use this image

Build of complete image (B2C Acc)
# download hybris 6.5
curl -v -u "USER:PASSWORD" https://nexus.YOURCOMPANY.com/nexus/repository/thirdparty/de/hybris/platform/hybris-commerce-suite/6.5.0.0/hybris-commerce-suite-6.5.0.0.zip -o hybris-commerce-suite-6.5.0.0.zip

# unzip hybris
unzip hybris-commerce-suite-6.5.0.0.zip || ( e=$? && if [ $e -ne 1 ]; then exit $e; fi )

# add custom config for creation of production artifacts
cd installer
chmod +x install.sh
echo "production.legacy.mode=false
installed.tenants=
website.apparel-de.http=http://YOUR-DOCKER-HOST:9001/yacceleratorstorefront
website.apparel-de.https=https://YOUR-DOCKER-HOST:9002/yacceleratorstorefront
website.apparel-uk.http=http://YOUR-DOCKER-HOST:9001/yacceleratorstorefront
website.apparel-uk.https=https://YOUR-DOCKER-HOST:9002/yacceleratorstorefront
website.electronics.http=http://YOUR-DOCKER-HOST:9001/yacceleratorstorefront
website.electronics.https=https://YOUR-DOCKER-HOST:9002/yacceleratorstorefront" > customconfig/custom.properties

# run installer with b2c recipe
./install.sh -r b2c_acc_plus

# create production artifacts
cd ../hybris/bin/platform
. ./setantenv.sh
ant clean all production

# create Dockerfile
cd ../../..
mkdir docker
mv hybris/temp/hybris/hybrisServer/hybrisServer*.zip docker/
cd docker
echo "FROM stefanlehmann/hybris-base-image:latest
ENV PLATFORM_HOME=\$HYBRIS_HOME/bin/platform
ENV PATH=\$PLATFORM_HOME:\$PATH
COPY hybrisServer*.zip $HYBRIS_HOME" >> Dockerfile
cat Dockerfile
Alternative way of building complete image using Dockerfile (with intermediate buildcontainer) only
FROM stefanlehmann/hybris-base-image:latest as buildcontainer
ENV HYBRIS_VERSION 6.5.0.0
WORKDIR /tmp

# download hybris
RUN curl --location --silent -u "USER:PASSWORD" \
"https://nexus.YOURCOMPANY.com/nexus/repository/thirdparty/de/hybris/platform/hybris-commerce-suite/$HYBRIS_VERSION/hybris-commerce-suite-$HYBRIS_VERSION.zip" \
-o "hybris-commerce-suite-$HYBRIS_VERSION.zip"

# if you get the zip from build context you can of course copy it into the buildcontainer directly
# COPY hybris-commerce-suite-"${HYBRIS_VERSION}".zip .

# add custom settings from build context (optional)
# COPY custom.properties installer/customconfig/custom.properties

# build production zips
RUN unzip -qq hybris-commerce-suite-"${HYBRIS_VERSION}".zip \
&& cd installer \
&& chmod +x install.sh \
&& ./install.sh -r b2c_acc \
&& cd ../hybris/bin/platform \
&& . ./setantenv.sh \
&& ant clean all production

# build real image
FROM stefanlehmann/hybris-base-image:latest
COPY --from=buildcontainer /tmp/hybris/temp/hybris/hybrisServer/*.zip /home/hybris/
Build the image (still in docker dir created before)
docker build .
Tag and upload image (optional if you build image on your docker host)
docker tag IMAGEID IMAGENAME
docker push IMAGENAME
Start Image
docker run -d -p 9001:9001 -p 9002:9002 IMAGEID/IMAGENAME
Initialize

Open https://YOUR-DOCKER-HOST:9002/ and use HAC for Initialization

or set HYBRIS_INITIALIZE_SYSTEM environment variable to yes

Accelerator Frontend

Open https://YOUR-DOCKER-HOST:9002/yacceleratorstorefront?site=apparel-de

hybris-base-image's People

Contributors

renovate[bot] avatar robertsicoie avatar stefanleh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hybris-base-image's Issues

Hybris packaging of zips creates inclusive of hybris folder

Not explicitly a problem with your code, but, an ant production will create zips inclusive of the hybris/ folder. When $HYBRIS_HOME is set to /home/hybris actual unzip will unpack to /home/hybris/hybris causing everything in entrypoint to fail with path errors.

Hybris 6.3 ant initialize

Hi @stefanleh,

I am facing the following issue on starting the container with environment variable $HYBRIS_INITIALIZE_SYSTEM = yes in the docker file.
I am getting this issue when ant initialize is being executed. However, server starts successfully after this.

BUILD FAILED
/home/hybris/bin/platform/build.xml:20: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/compiling.xml:90: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/compiling.xml:148: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/util.xml:20: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/compiling.xml:155: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/compiling.xml:297: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/util.xml:144: The following error occurred while executing this line:
/home/hybris/bin/ext-atdd/atddengine/buildcallbacks.xml:29: The following error occurred while executing this line:
/home/hybris/bin/platform/resources/ant/util.xml:91: /home/hybris/bin/ext-atdd/atddengine/src does not exist.

I got the project artifacts after executing ant production -Dproduction.legacy.mode=false.
On simply running ant production to create the project artifacts I am getting the error of wrapper.conf.

Could you please let me know if you have ever observed this issue and how I could resolve this.

Thank you,
Farhan

Error with Hybris 5.7 image

@stefanleh Great work with the docker file

I am running into this issue and tried several ways to fix it, but can't make it work

Console output from docker :

inflating: /home/hybris/bin/platform/tomcat/LICENSE inflating: /home/hybris/bin/platform/tomcat/NOTICE inflating: /home/hybris/bin/platform/tomcat/RELEASE-NOTES inflating: /home/hybris/bin/platform/tomcat/RUNNING.txt inflating: /home/hybris/bin/platform/tomcat/bin/InstallTomcatService.bat inflating: /home/hybris/bin/platform/tomcat/bin/UninstallTomcatService.bat inflating: /home/hybris/bin/platform/tomcat/bin/bootstrap.jar inflating: /home/hybris/bin/platform/tomcat/bin/catalina-tasks.xml inflating: /home/hybris/bin/platform/tomcat/bin/catalina.bat inflating: /home/hybris/bin/platform/tomcat/bin/catalina.sh inflating: /home/hybris/bin/platform/tomcat/bin/commons-daemon-native.tar.gz inflating: /home/hybris/bin/platform/tomcat/bin/commons-daemon.jar inflating: /home/hybris/bin/platform/tomcat/bin/debug.bat inflating: /home/hybris/bin/platform/tomcat/bin/debug.sh inflating: /home/hybris/bin/platform/tomcat/bin/jdk_logging.properties inflating: /home/hybris/bin/platform/tomcat/bin/o.bat inflating: /home/hybris/bin/platform/tomcat/bin/o.sh inflating: /home/hybris/bin/platform/tomcat/bin/tomcat-juli.jar inflating: /home/hybris/bin/platform/tomcat/bin/tomcat-native.tar.gz inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-aix-ppc-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-aix-ppc-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-freebsd-x86-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-freebsd-x86-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-hpux-ia-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-hpux-ia-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-hpux-parisc-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-hpux-parisc-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-390-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-390-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-armel-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-armhf-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-ppc-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-ppc-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-x86-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-linux-x86-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-macosx-universal-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-macosx-universal-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-solaris-sparc-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-solaris-sparc-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-solaris-x86-32 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-solaris-x86-64 inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-windows-ia-64.exe inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-windows-x86-32.exe inflating: /home/hybris/bin/platform/tomcat/bin/wrapper-windows-x86-64.exe inflating: /home/hybris/bin/platform/tomcat/bin/wrapper.bat inflating: /home/hybris/bin/platform/tomcat/bin/wrapper.sh inflating: /home/hybris/bin/platform/tomcat/conf/README.txt inflating: /home/hybris/bin/platform/tomcat/conf/catalina.policy inflating: /home/hybris/bin/platform/tomcat/conf/catalina.properties inflating: /home/hybris/bin/platform/tomcat/conf/context.xml inflating: /home/hybris/bin/platform/tomcat/conf/hybris-wrapper-license.conf inflating: /home/hybris/bin/platform/tomcat/conf/i3-log.conf inflating: /home/hybris/bin/platform/tomcat/conf/jmxremote.access inflating: /home/hybris/bin/platform/tomcat/conf/jmxremote.password inflating: /home/hybris/bin/platform/tomcat/conf/server-minimal.xml inflating: /home/hybris/bin/platform/tomcat/conf/web.xml inflating: /home/hybris/bin/platform/tomcat/conf/wrapper-minimal.conf inflating: /home/hybris/bin/platform/tomcat/lib/annotations-api.jar inflating: /home/hybris/bin/platform/tomcat/lib/catalina-ant.jar inflating: /home/hybris/bin/platform/tomcat/lib/catalina-ha.jar inflating: /home/hybris/bin/platform/tomcat/lib/catalina-jmx-remote.jar inflating: /home/hybris/bin/platform/tomcat/lib/catalina-tribes.jar inflating: /home/hybris/bin/platform/tomcat/lib/catalina.jar inflating: /home/hybris/bin/platform/tomcat/lib/ecj-4.4.jar inflating: /home/hybris/bin/platform/tomcat/lib/el-api.jar inflating: /home/hybris/bin/platform/tomcat/lib/jasper-el.jar inflating: /home/hybris/bin/platform/tomcat/lib/jasper.jar inflating: /home/hybris/bin/platform/tomcat/lib/jsp-api.jar inflating: /home/hybris/bin/platform/tomcat/lib/keystore inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-aix-ppc-32.a inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-aix-ppc-64.a inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-freebsd-x86-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-freebsd-x86-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-hpux-ia-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-hpux-ia-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-hpux-parisc-32.sl inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-hpux-parisc-64.sl inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-390-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-390-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-armel-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-armhf-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-ia-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-ppc-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-ppc-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-x86-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-linux-x86-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-macosx-universal-32.jnilib inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-macosx-universal-64.jnilib inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-solaris-sparc-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-solaris-sparc-64.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-solaris-x86-32.so inflating: /home/hybris/bin/platform/tomcat/lib/libwrapper-solaris-x86-64.so inflating: /home/hybris/bin/platform/tomcat/lib/servlet-api.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-api.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-coyote.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-dbcp.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-i18n-es.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-i18n-fr.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-i18n-ja.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-jdbc.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-juli-adapters.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat-util.jar inflating: /home/hybris/bin/platform/tomcat/lib/tomcat7-websocket.jar inflating: /home/hybris/bin/platform/tomcat/lib/websocket-api.jar inflating: /home/hybris/bin/platform/tomcat/lib/wrapper-version.txt inflating: /home/hybris/bin/platform/tomcat/lib/wrapper-windows-ia-64.dll inflating: /home/hybris/bin/platform/tomcat/lib/wrapper-windows-x86-32.dll inflating: /home/hybris/bin/platform/tomcat/lib/wrapper-windows-x86-64.dll inflating: /home/hybris/bin/platform/tomcat/lib/wrapper.jar inflating: /home/hybris/bin/platform/tomcat/tomcat_context.tpl Platform home set to : /home/hybris/bin/platform/ Running hybrisPlatform on Tomcat... FATAL | wrapper | Unable to open configuration file: /home/hybris/bin/platform/tomcat/bin/../conf/wrapper.conf (No such file or directory) FATAL | wrapper | Current working directory: /home/hybris/bin/platform/tomcat/bin

These are the files that gets added to my image:

hybrisServer-Platform.zip hybrisServer-Config.zip hybrisServerREADME.txt hybrisServer-AllExtensions.zip

And here is the command I run to get these files:

ant production -Dproduction.legacy.mode=false -Dproduction.include.tomcat=true -Dtomcat.legacy.deployment=false

I added some customization to your entrypoint.sh as follows, just to get it working. I assumed some kind of permission issue where the required directory or file is not accessible.

chown -R hybris /home/hybris chmod +x hybrisserver.sh chmod -R +x ${PLATFORM_HOME}/tomcat/bin chmod -R +x ${PLATFORM_HOME}/tomcat/conf chmod -R +x /home/hybris/config/tomcat/conf chmod +x hybrisserver.sh

Please let me know if you have input.

Thanks
Anwar

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

dockerfile
Dockerfile

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.