Project

General

Profile

task #6522

package cdm-server in docker container

Added by Andreas Kohlbecker over 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
New
Category:
cdmserver
Target version:
Start date:
03/17/2017
Due date:
% Done:

100%

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 jsvc In Progress 11/12/2015
Related to Edit - feature request #8082: cdm-server docker image allows running the cdm-server as non root user New 02/08/2019

Associated revisions

Revision ed5ad657 (diff)
Added by Andreas Kohlbecker 7 months ago

ref #6522 adding fairly complete set of configuration and documentation for delpoying the cdm-server as docker image

Revision d790e10d (diff)
Added by Andreas Kohlbecker 7 months ago

ref #6522 removing useless integration-test run config from docker plugin

Revision 4e1dd75e (diff)
Added by Andreas Kohlbecker 7 months ago

ref #6522 commenting run configuration

Revision 35066a11 (diff)
Added by Andreas Kohlbecker 7 months ago

ref #6522 cleaning up docker config files

Revision 61c9e055 (diff)
Added by Andreas Kohlbecker 7 months ago

ref #6522 maven assembly moved into package phase

Revision b2c1eebc (diff)
Added by Andreas Kohlbecker 7 months ago

ref #6522 fixing problems with ARGs in Dockerfiles and more documentation

History

#1 Updated by Andreas Kohlbecker over 2 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

#2 Updated by Andreas Kohlbecker over 2 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

#3 Updated by Andreas Kohlbecker over 2 years ago

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

#4 Updated by Andreas Kohlbecker over 2 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

#5 Updated by Andreas Kohlbecker over 2 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

#6 Updated by Andreas Kohlbecker 9 months ago

  • Description updated (diff)

#7 Updated by Andreas Kohlbecker 8 months ago

  • Description updated (diff)

#8 Updated by Andreas Kohlbecker 8 months ago

  • Description updated (diff)

#9 Updated by Andreas Kohlbecker 8 months ago

  • Description updated (diff)

#10 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#11 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#12 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#13 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#14 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#15 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#16 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#17 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#18 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#19 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#20 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#21 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#22 Updated by Andreas Kohlbecker 7 months ago

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

#23 Updated by Andreas Kohlbecker 7 months ago

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

#24 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#25 Updated by Andreas Kohlbecker 7 months ago

  • Description updated (diff)

#26 Updated by Andreas Kohlbecker 7 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 50 to 100

#27 Updated by Andreas Kohlbecker 7 months ago

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

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)