Project

General

Profile

Actions

task #6522

closed

package cdm-server in docker container

Added by Andreas Kohlbecker about 7 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
New
Category:
cdmserver
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal
Tags:

Description

for easier distribution of the cdm-server it would be advantageous to package the cdm-server into a docker container.

Docker doc:

Running java inside docker containers:

On creating docker containers with maven:

The fabric8io/docker-maven-plugin seems to the the most mature and suitable plugin.

On configuring containers and images via ENV and ARGS, etc: https://vsupalov.com/docker-arg-env-variable-guide

On running a container as a system service, restart policies etc.

==> we should use

docker run -dit --restart unless-stopped  
  • -d, --detach : Run container in background and print container ID
  • -i, --interactive: Keep STDIN open even if not attached
  • -t, --tty: Allocate a pseudo-TTY

  • --restart unless-stopped: Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted.

Deployment

to https://hub.docker.com

Organization for the EDIT Platform:

https://cloud.docker.com/u/cybertaxonomy/

  • organization name: cybertaxonomy
  • owners:
    • kohlbecker
  • repository: cdm-server
  • team : editdev
    • members (so far):
      • kohlbecker
      • jenkinsintbgbm (jenkins-int-AT-bgbm.org)

The cdm-server image is available from https://hub.docker.com/r/cybertaxonomy/cdm-server/

To push images with maven add the following server section to the ~/.m2/settings.xml

    <server>
        <id>docker.io</id>
        <username>username</username>
        <password>S3cr3t</password>
    </server>

Related issues

Related to EDIT - task #5375: cdm-server without jsvcIn ProgressAndreas Kohlbecker

Actions
Related to EDIT - feature request #8082: cdm-server docker image allows running the cdm-server as non root userNewKatja Luther

Actions
Related to EDIT - task #10444: Add integration test with dockerNewAndreas Müller

Actions
Actions #1

Updated by Andreas Kohlbecker about 7 years ago

[Saskia Gennrich]

Wir versuchen hier am Museum Teile unserer Infrastruktur mit Docker zu realisieren.

Mit jsvc hab ich ein paar Probleme das im Docker zum laufen zu bekommen.

Spricht etwas dagegen die jar „normal“ zu starten mit

java $JAVA_OPTIONS -jar cdm-server.jar $CDMSERVER_ARGS
Actions #2

Updated by Andreas Kohlbecker about 7 years ago

jsvc macht unter Docker ziemliche Probleme, an dieser Stelle sind wir auch schon stecken geblieben als wir mal auf die Schnelle den cdm-server in Docker verpacken wollten.
Die jar normal zu starten ist natürlich möglich, allerdings läuft der Server dann nicht als Hintergrundprozess, für Produktionssysteme nicht gerade optimal.

Jetty hatte früher auch jsvc verwendet um als Daemon zu starten, mittlerweile wird das bei Jetty aber auch anders gemacht. Ich habe mir das alles noch nicht im Detail angesehen aber ein Ticket dafür angelegt: #5375

Ich habe auch großes Interesse daran eine solide Lösung für dieses Problem zu finden.

Viele Grüße
Andreas

Actions #3

Updated by Andreas Kohlbecker about 7 years ago

  • Related to task #5375: cdm-server without jsvc added
Actions #4

Updated by Andreas Kohlbecker about 7 years ago

[Saskia Gennrich]

Ob der CDM im Docker-Container als Daemon läuft oder nicht sollte ja egal sein. Man kann den Docker-Prozess ja als Hintergrund-Prozess starten.
Ich hab gelesen, dass jsvc auch dafür benutzt wird um den Prozess neu zu starten, wenn er abstürzt. Dass kann ja Docker prinzipiell auch, obwohl ich damit noch keine Erfahrungen gemacht habe. (restart=always)

Falls es dich interessiert hab ich mal das Dockerfile angehängt, mit dem ich das Image baue. Im Ordner .cdmLibrary liegt nur die datasource.xml und cdm-server-realm.properties:

FROM anapsix/alpine-java:8

COPY cdm-server-4.0.0.jar /root/cdm-server.jar
COPY cdmserver/.cdmLibrary /root/.cdmLibrary

#-Dspring.profiles.active=remoting is needed for the Taxonomic Editor to connect to the cdm server
ENV NAME=cdmserver \
    DESC="CDM Server" \
    CDM_HOME=/root \
    LOGDIR="/log/$NAME" \
    CONTEXT_PATH_PREFIX=/ \
    CDMSERVER_PORT=8080 \
    CDMSERVER_SHUTDOWN=30
ENV JAVA_OPTIONS="-Xmx1024M -XX:PermSize=128m -XX:MaxPermSize=192m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -Duser.home=$CDM_HOME -Dspring.profiles.active=remoting"

ENV CDMSERVER_ARGS="-httpPort=$CDMSERVER_PORT -logdir=$LOGDIR -contextPathPrefix=$CONTEXT_PATH_PREFIX"

EXPOSE $CDMSERVER_PORT

CMD java $JAVA_OPTIONS -jar /root/cdm-server.jar $CDMSERVER_ARGS

Viele Grüße
Saskia

Actions #5

Updated by Andreas Kohlbecker about 7 years ago

  • Description updated (diff)

Yesterday I found this potentially useful article on running jvm applications in docker containers: DZone - Java Inside Docker: What You Must Know to Not FAIL

Actions #6

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #7

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #8

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #9

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #10

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #11

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #12

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #13

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #14

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #15

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #16

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #17

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #18

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #19

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #20

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #21

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #22

Updated by Andreas Kohlbecker over 5 years ago

  • Tags set to phycobank
  • Status changed from New to In Progress
  • Target version changed from Unassigned CDM tickets to Release 5.5
Actions #23

Updated by Andreas Kohlbecker over 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 50
Actions #24

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #25

Updated by Andreas Kohlbecker over 5 years ago

  • Description updated (diff)
Actions #26

Updated by Andreas Kohlbecker about 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 50 to 100
Actions #27

Updated by Andreas Kohlbecker about 5 years ago

  • Related to feature request #8082: cdm-server docker image allows running the cdm-server as non root user added
Actions #28

Updated by Andreas Müller 4 months ago

  • Related to task #10444: Add integration test with docker added
Actions

Also available in: Atom PDF