Upgrade on Docker

Gunter Zeilinger edited this page Dec 30, 2016 · 22 revisions
Clone this wiki locally

Stop and remove containers with previous version

> $ docker stop dcm4chee-arc postgres slapd
dcm4chee-arc
postgres
slapd

> $ docker rm -v dcm4chee-arc postgres slapd
dcm4chee-arc
postgres
slapd

or using Docker Composite

> $ docker-compose down
Stopping dcm4cheearcpsql_dcm4chee-arc_1 ... done
Stopping dcm4cheearcpsql_postgres_1 ... done
Stopping dcm4cheearcpsql_slapd_1 ... done
Removing dcm4cheearcpsql_dcm4chee-arc_1 ... done
Removing dcm4cheearcpsql_postgres_1 ... done
Removing dcm4cheearcpsql_slapd_1 ... done
Removing network dcm4cheearcpsql_default

Remove previous Wildfly configuration and deployment

Remove or rename the directory, which was mapped to /opt/wildfly/standalone, e.g.:

> $ sudo mv /var/local/dcm4chee-arc/wildfly /tmp

Run new version of OpenLDAP Server and PostgreSQL Server

Run new version of OpenLDAP Server and PostgreSQL Server, mounting the same host directories as used with the previous version, e.g.:

> $ docker run --name slapd \
           -p 389:389 \
           -e LDAP_BASE_DN=dc=dcm4che,dc=org \
           -e LDAP_ORGANISATION=dcm4che.org \
           -e LDAP_ROOTPASS=secret \
           -e LDAP_CONFIGPASS=secret \
           -e ARCHIVE_DEVICE_NAME=dcm4chee-arc \
           -e AE_TITLE=DCM4CHEE \
           -e DICOM_HOST=dockerhost \
           -e DICOM_PORT=11112 \
           -e HL7_PORT=2575 \
           -e SYSLOG_HOST=logstash \
           -e SYSLOG_PORT=8512 \
           -e SYSLOG_PROTOCOL=UDP \
           -e STORAGE_DIR=/storage/fs1 \
           -v /var/local/dcm4chee-arc/ldap:/var/lib/ldap \
           -v /var/local/dcm4chee-arc/slapd.d:/etc/ldap/slapd.d \
           -d dcm4che/slapd-dcm4chee:2.4.40-8.1

> $ docker run --name postgres \
           -p 5432:5432 \
           -e POSTGRES_DB=pacsdb \
           -e POSTGRES_USER=pacs\
           -e POSTGRES_PASSWORD=pacs \
           -v /var/local/dcm4chee-arc/db:/var/lib/postgresql/data \
           -d dcm4che/postgres-dcm4chee:9.6-8

If using Docker Composite you have to adjust the version tags of the images in docker-compose.yaml accordingly, before starting the OpenLDAP Server and PostgreSQL Server by

> $ docker-compose up -d slapd postgres
Creating dcm4cheearcpsql_postgres_1
Creating dcm4cheearcpsql_slapd_1

Update LDAP schema and configuration data

Optionally backup configuration into a LDIF file, by

> $ docker exec slapd-container-name export-data > config_backup.ldif

Update LDAP schema

> $ docker exec slapd-container-name update-schema
modifying entry "cn={6}dcm4chee-archive,cn=schema,cn=config"

Update LDAP configuration

If you did not make structural changes to the provided default configuraton - e.g. by adding/removing Network Application Entities or by configuring multiple Archive devices - applying the provided update scripts should be sufficient. To update from an older version than the most-recent previous version, e.g. from 5.4.0 to 5.8.1, you have to apply the update scripts for the previous versions, e.g.:

> $ docker exec slapd-container-name update-data 5.4.1
> $ docker exec slapd-container-name update-data 5.5.0
> $ docker exec slapd-container-name update-data 5.5.1
> $ docker exec slapd-container-name update-data 5.5.2
> $ docker exec slapd-container-name update-data 5.6.0
> $ docker exec slapd-container-name update-data 5.7.0
> $ docker exec slapd-container-name update-data 5.7.1
> $ docker exec slapd-container-name update-data 5.7.2
> $ docker exec slapd-container-name update-data 5.8.0

before you can update the LDAP configuration the current version by:

> $ docker exec slapd-container-name update-data 5.8.1
modifying entry "dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org"
:

If you made structural changes to the provided default configuraton, you have to adjust the provided LDIF files - extracting them from the container:

> $ docker cp slapd-container-name:/etc/ldap/data /tmp
> $ ls -1 /tmp/data/update*
/tmp/data/update-config-5.2.0.ldif
/tmp/data/update-config-5.2.1.ldif
/tmp/data/update-config-5.3.0.ldif
/tmp/data/update-config-5.3.1.ldif
/tmp/data/update-config-5.4.0.ldif
/tmp/data/update-config-5.4.1.ldif
/tmp/data/update-config-5.5.0.ldif
/tmp/data/update-config-5.5.1.ldif
/tmp/data/update-config-5.5.2.ldif
/tmp/data/update-config-5.6.0.ldif
/tmp/data/update-config-5.7.0.ldif
/tmp/data/update-config-5.7.1.ldif
/tmp/data/update-config-5.7.2.ldif
/tmp/data/update-config-5.8.0.ldif
/tmp/data/update-config-5.8.1.ldif

accordingly to your changes, before applying them yourself:

> $ docker exec -i slapd-container-name su -c 'ldapmodify -xw ${LDAP_CONFIGPASS} -D cn=admin,${LDAP_BASE_DN}' < /tmp/data/update-config-5.8.1.ldif'
modifying entry "dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org"
:

Since v5.6.0, user names and passwords for the secured version are stored in LDAP. For upgrading from previous versions than v5.6.0 you may import default user/passwords user/user and admin/admin by

> $ docker exec slapd-container-name init-users
modifying entry "olcDatabase={1}hdb,cn=config"
adding new entry "ou=users,dc=dcm4che,dc=org"
adding new entry "uid=admin,ou=users,dc=dcm4che,dc=org"
adding new entry "uid=user,ou=users,dc=dcm4che,dc=org"
adding new entry "cn=admin,ou=users,dc=dcm4che,dc=org"
adding new entry "cn=user,ou=users,dc=dcm4che,dc=org"

Since v5.8.0, realm management permissions are granted to the admin user. For upgrading from previous versions than v5.8.0 you may grant these permissions by

> $ docker exec slapd-container-name init-realm-management
adding new entry "ou=realm-management,dc=dcm4che,dc=org"
adding new entry "cn=create-client,ou=realm-management,dc=dcm4che,dc=org"
adding new entry "cn=impersonation,ou=realm-management,dc=dcm4che,dc=org"
adding new entry "cn=manage-authorization,ou=realm-management,dc=dcm4che,dc=org"
:

Update PostgreSQL

Not needed for upgrading from a version which differs only in the third component of the version number (e.g. from 5.8.0 to 5.8.1).

Optionally backup database into a text file, by

> $ docker exec postgres-container-name su -c 'pg_dump $POSTGRES_DB' postgres > db_backup.sql

To update from an older version than the most-recent previous version, e.g. from 5.4.x to 5.8.x, you have to apply the update scripts for the previous versions, e.g.:

> $ docker exec postgres-container-name su -c 'psql $POSTGRES_DB $POSTGRES_USER < /sql/update-5.5-psql.sql'
> $ docker exec postgres-container-name su -c 'psql $POSTGRES_DB $POSTGRES_USER < /sql/update-5.6-psql.sql'
> $ docker exec postgres-container-name su -c 'psql $POSTGRES_DB $POSTGRES_USER < /sql/update-5.7-psql.sql'

before you can update PostgreSQL to the current version by:

> $ docker exec postgres-container-name su -c 'psql $POSTGRES_DB $POSTGRES_USER < /sql/update-5.8-psql.sql'
ALTER TABLE
:

Run new version of DCM4CHEE Archive 5

Run new version of DCM4CHEE Archive 5, mounting the same host directories as used with the previous version, e.g.:

> $ docker run --name dcm4chee-arc \
           -p 8080:8080 \
           -p 9990:9990 \
           -p 11112:11112 \
           -p 2575:2575 \
           -e LDAP_BASE_DN=dc=dcm4che,dc=org \
           -e LDAP_ROOTPASS=secret \
           -e LDAP_CONFIGPASS=secret \
           -e ARCHIVE_DEVICE_NAME=dcm4chee-arc \
           -e POSTGRES_DB=pacsdb \
           -e POSTGRES_USER=pacs\
           -e POSTGRES_PASSWORD=pacs \
           -e WILDFLY_ADMIN_USER=admin \
           -e WILDFLY_ADMIN_PASSWORD=admin \
           -e KEYCLOAK_ADMIN_USER=admin \
           -e KEYCLOAK_ADMIN_PASSWORD=admin \
           -e JAVA_OPTS="-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true" \
           -e WILDFLY_CHOWN="/opt/wildfly/standalone /storage" \
           -v /var/local/dcm4chee-arc/wildfly:/opt/wildfly/standalone \
           -v /var/local/dcm4chee-arc/storage:/storage \
           --link slapd:ldap \
           --link postgres:db \
           -d dcm4che/dcm4chee-arc-psql:5.8.1-secure-ui

or using Docker Composite:

> $ docker-compose up -d dcm4chee-arc
Creating dcm4cheearcpsql_dcm4chee-arc_1

(Optional) purge docker images of previous version

> $ docker images | grep 9.6-7
dcm4che/postgres-dcm4chee                                   9.6-7                      008a0e5319aa        9 weeks ago         264.7 MB

> $ docker images | grep 7.2
dcm4che/dcm4chee-arc-psql                                   5.7.2-secure-ui            53df22118f5a        6 weeks ago         556.9 MB
dcm4che/slapd-dcm4chee                                      2.4.40-7.2                 0f6d19decb68        7 weeks ago         177.5 MB

> $ docker rmi 008a0e5319aa 53df22118f5a 0f6d19decb68
Untagged: dcm4che/postgres-dcm4chee:9.6-7
Untagged: dcm4che/postgres-dcm4chee@sha256:c844a276253177bc8aa45ad50eedc95a12295bfa2727c84b0cea81a6b2871fcf
Deleted: sha256:008a0e5319aad836a5499daf6c2abfd482660100c7ebe59169cfc2e7b8ecae13
Deleted: sha256:c1aa97cc27c830d48791ced514b51e79f6c5f2e71c80cfec4787ed71037d4461
: