OFBiz Development with Docker http://ofbiz.apache.org - - PowerPoint PPT Presentation

ofbiz development with docker
SMART_READER_LITE
LIVE PREVIEW

OFBiz Development with Docker http://ofbiz.apache.org - - PowerPoint PPT Presentation

OFBiz Development with Docker http://ofbiz.apache.org http://docker.io/ 2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 1 What is OFBiz? http://ofbiz.apache.org/ 2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 2 OFBiz Java ERP 873 tables,


slide-1
SLIDE 1

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 1

OFBiz Development with Docker

http://docker.io/ http://ofbiz.apache.org

slide-2
SLIDE 2

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 2

What is OFBiz?

http://ofbiz.apache.org/

slide-3
SLIDE 3

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 3

OFBiz

  • Java
  • ERP
  • 873 tables, 309 views
  • Tons of application service logic
slide-4
SLIDE 4

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 4

What is docker?

http://docker.io/

slide-5
SLIDE 5

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 5

Docker

  • Linux
  • Containers - LXC
  • Copy On Write
slide-6
SLIDE 6

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 6

Docker - Linux

  • Maybe some of you have heard of linux?
slide-7
SLIDE 7

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 7

Docker - Containers

Filesystem Process User Network

  • LXC - Namespaces
  • Each type of

namespace is isolated from others

  • f its type

Lighter weight than standard virtualization - Better performance

slide-8
SLIDE 8

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 8

Docker - Copy On Write

Read-Only Base Layers Writable Top Layer

  • AUFS
  • Multiple Layers
  • Copy of all files can be made in

seconds, by adding a new layer.

slide-9
SLIDE 9

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 9

Docker - OSx/Windows

  • docker is linux.
  • boot2docker.io

– self-contained bootable iso – virtualbox

slide-10
SLIDE 10

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 10

OFBiz Development - New Feature

  • Get the code
  • Initialize the system(*)
  • Write the test case
  • Implement the feature
  • Submit for approval(and merge)
slide-11
SLIDE 11

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 11

OFBiz Development - Bug Found

  • Yes, bugs can happen.
  • Replicate environment(*)
  • Update test case
  • Fix the code
  • Submit for approval(and merge)
  • Cross fingers, hope it works in production
slide-12
SLIDE 12

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 12

OFBiz Development - Coding

  • Which code base is being updated?

– OFBiz backend, content frontend, high-availability

cat herding dispatcher?

  • Does the new code require changes in

multiple layers?

  • Which test case framework will get updated?

– OFBiz, selenium, spreadsheet?

slide-13
SLIDE 13

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 13

OFBiz Development - Environment

  • Initialize and replicate require a real environment
  • Which database?

– Mysql, Postgresql, Derby, Oracle

  • What web frontend?

– Apache, Nginx

  • Email(MTA)?

– Exim, Postfix, Qmail, Sendmail

slide-14
SLIDE 14

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 14

OFBiz Development - Environment

  • Is there a content frontend?

– wordpress, drupal, django, etc?

  • How much data should be made available?

– Empty, seed, or a full database copy?

slide-15
SLIDE 15

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 15

OFBiz Development with Docker

slide-16
SLIDE 16

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 16

docker - Dockerfile

  • A simple way to run a series of commands
  • Can do almost anything

– Install packages – Modify files – Copy external configuration settings

slide-17
SLIDE 17

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 17

docker - Dockerfile

  • Each step is cached

– This allows for long running steps to be skipped if

nothing has changed

  • There are many pre-packaged docker images

available, to save time from having to build your own.

slide-18
SLIDE 18

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 18

docker/base/Dockerfile

FROM debian:wheezy # install packages RUN apt-get install postgresql-9.1 libpostgresql-java nginx-full # configure packages USER root RUN ln -s /srv/ofbiz/etc/nginx.conf /etc/nginx/sites-enabled/ofbiz.conf USER postgresql RUN createdb ofbiz; create user ofbiz # this will start postgres, ofbiz, and nginx COPY ofbiz-startup.sh /etc/init.d/ofbiz-startup ENTRYPOINT /etc/init.d/ofbiz-startup

slide-19
SLIDE 19

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 19

docker - build

  • docker build -t $name-base docker/base

– Dockerfile – ofbiz-startup.sh

slide-20
SLIDE 20

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 20

docker - seed

$ id=$(docker create -v $PWD:/srv/ofbiz $name-base) $ docker start $id $ # wait $ docker exec $id “/srv/ofbiz/ant load-seed” $ docker stop $id $ docker commit $id $name-seed-base

slide-21
SLIDE 21

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 21

dockerfile - seed

FROM $name-seed-base ENTRYPOINT /etc/init.d/ofbiz-startup

slide-22
SLIDE 22

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 22

docker - snapshot

$ id=$(docker create -v $PWD:/srv/ofbiz $name-base) $ docker start $id $ # wait $ docker exec $id “zcat /srv/ofbiz/dumps/pgdump.sql.gz | su - postgresql” $ docker stop $id $ docker commit $id $name-snapshot-base

slide-23
SLIDE 23

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 23

dockerfile - snapshot

FROM $name-snapshot-base ENTRYPOINT /etc/init.d/ofbiz-startup

slide-24
SLIDE 24

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 24

docker - run

  • docker run -v $PWD:/srv/ofbiz $name

– Created write-layer on top of files in $name – Mounts the current directory at the requested

location

– Runs the previously defined ENTRYPOINT

slide-25
SLIDE 25

2015-04-15 OFBIZ.APACHE.ORG - PRELIMINARY 25