opencast / opencast-docker

Dockerfiles for Opencast
https://quay.io/organization/opencast/
Educational Community License v2.0
41 stars 36 forks source link

CAS support? #44

Closed miesgre closed 7 years ago

miesgre commented 7 years ago

Hi!

I'm trying to enable CAS, following the steps from https://docs.opencast.org/latest/admin/configuration/security.cas/, but I'm stuck on the first step where I need to access to the karaf console to install a feature (feature:install opencast-contrib-cas).

Is there any way to access to the karaf console in these opencast images?

mtneug commented 7 years ago

Hi @miesgre and thank you for using the Docker images.

First of all I'm not too familiar with the Karaf console let alone CAS. For these images we start Karaf in server mode, meaning the local Karaf console is deactivated. With the following steps you can get to a Karaf console:

root@host$ cd $(mktemp -d)

root@host$ docker network create opencast-net

root@host$ curl https://raw.githubusercontent.com/opencast/opencast-docker/master/docker-compose/assets/activemq.xml > activemq.xml
root@host$ docker run -d \
  --name activemq \
  --net opencast-net \
  -e "ACTIVEMQ_MIN_MEMORY=128" \
  -e "ACTIVEMQ_MAX_MEMORY=1024" \
  -e "ACTIVEMQ_ENABLED_SCHEDULER=true" \
  -e "ACTIVEMQ_REMOVE_DEFAULT_ACCOUNT=true" \
  -e "ACTIVEMQ_OWNER_LOGIN=admin" \
  -e "ACTIVEMQ_OWNER_PASSWORD=password" \
  -v "$PWD/activemq.xml:/opt/activemq/conf/activemq.xml:ro" \
  webcenter/activemq:5.13.2

root@host$ curl https://bitbucket.org/opencast-community/matterhorn/raw/156e643bdc26e25f9fb0bd152641a398ceafb9ca/etc/org.ops4j.pax.logging.cfg > org.ops4j.pax.logging.cfg
root@host$ docker run -d -it \
  --name opencast \
  --net opencast-net \
  -e "ORG_OPENCASTPROJECT_SERVER_URL=http://opencast:8080" \
  -e "ORG_OPENCASTPROJECT_DOWNLOAD_URL=http://${HOSTIP:-localhost}:8080/static" \
  -e "ORG_OPENCASTPROJECT_SECURITY_ADMIN_USER=admin" \
  -e "ORG_OPENCASTPROJECT_SECURITY_ADMIN_PASS=opencast" \
  -e "ORG_OPENCASTPROJECT_SECURITY_DIGEST_USER=opencast_system_account" \
  -e "ORG_OPENCASTPROJECT_SECURITY_DIGEST_PASS=CHANGE_ME" \
  -e "ACTIVEMQ_BROKER_URL=failover://(tcp://activemq:61616)?initialReconnectDelay=2000&maxReconnectAttempts=2" \
  -e "ACTIVEMQ_BROKER_USERNAME=admin" \
  -e "ACTIVEMQ_BROKER_PASSWORD=password" \
  -v "$PWD/org.ops4j.pax.logging.cfg:/opencast/etc/org.ops4j.pax.logging.cfg:ro" \
  -p "8080:8080" \
  opencast/allinone:2.3.0 \
    sh

# Open shell in container
root@host$ docker exec -it opencast sh
# Configure Opencast
root@container$ /docker-entrypoint.sh app:init
# Start Opencast normally (not in server mode) -> Karaf console
root@container$ /opencast/bin/start-opencast

# Watch the logs in another terminal window
root@host$ docker exec -it opencast tail -f data/log/opencast.log

You need to have a proper Opencast environment hence the many steps. For the images we execute /opencast/bin/start-opencast with the server option. Also we output the log to the console, which is annoying when working with the console 😉 .

Executing feature:info opencast-contrib-cas was successful and led to the following bundles being loaded (see logfile):

2017-03-27 08:52:21,167 | INFO  | (BundleInfoLogger:110) - Bundle com.springsource.org.cyberneko.html, id 288, version 1.9.13, build number n/a
2017-03-27 08:52:22,660 | INFO  | (BundleInfoLogger:110) - Bundle com.springsource.org.apache.xml.security, id 289, version 1.4.2, build number n/a
2017-03-27 08:52:23,716 | INFO  | (BundleInfoLogger:110) - Bundle com.springsource.org.jasig.cas.client, id 290, version 3.1.12, build number n/a
2017-03-27 08:52:24,767 | INFO  | (BundleInfoLogger:110) - Bundle com.springsource.org.openid4java, id 291, version 0.9.5, build number n/a
2017-03-27 08:52:25,984 | INFO  | (BundleInfoLogger:110) - Bundle com.springsource.org.opensaml, id 292, version 1.1.0, build number n/a
2017-03-27 08:52:26,054 | INFO  | (BundleInfoLogger:110) - Bundle org.springframework.security.cas, id 293, version 3.1.0.RELEASE, build number n/a
2017-03-27 08:52:26,094 | INFO  | (BundleInfoLogger:110) - Bundle org.springframework.security.openid, id 294, version 3.1.0.RELEASE, build number n/a

Ideally for Docker you would thus create a new image with these bundles (i.e. this feature) added during startup:

FROM opencast/allinone:2.3.0

RUN sed -i '/^featuresBoot =/s/$/,opencast-contrib-cas/' /opencast/etc/org.apache.karaf.features.cfg

Build this image and try to continue the guide with it. Hope that answers your question.

mtneug commented 7 years ago

I will close this issue for now. Feel free to reopen it if you think it is not answered yet.