sul-dlss / dlss-wowza

Wowza server side modules.
1 stars 0 forks source link
infrastructure

Build Status Coverage Status GitHub version

dlss-wowza

Wowza server side modules. Uses Wowza provided Java API to restrict access to content to authorized users. Relies on Stacks for minting and verifying tokens.

Build info

Uses Gradle (via Gradle wrapper) as the build tool (akin to Ruby's rake).

Java version / Consider using jenv

We should be trying to use a recent and supported version of Java in local development, on CI/build servers, and on deployed Wowza servers.

For local development, jenv (akin to e.g. rbenv or n) can help if you need to manage multiple versions of Java. Documentation for jenv.

See if there's a Gradle wrapper upgrade

If it's been a few weeks or months since the project has been touched, you can install the latest Gradle by running:

./gradlew wrapper --gradle-version=latest --distribution-type=bin # you can also install a specific version, e.g. --gradle-version=8.4

If updates are generated, please commit the changes (likely gradle/wrapper/gradle-wrapper.properties, gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.jar; possibly build.gradle if you have to fix deprecated build config).

See "Upgrade with the Gradle Wrapper" in the installation instructions, and the more detailed Gradle Wrapper doc.

To compile and run tests of this code

./gradlew build

Before running this command, you'll need to set these environment variables:

If the environment variables are not set, your tests will fail.

To just run tests and generate a coverage report

./gradlew check # will invoke build tasks as needed

Coverage report

The coverage report is available in the project directory at build/reports/jacoco/test/html/index.html.

Using the SulWowza plugin

Adding the SulWowza plugin to your Wowza Application

In the Wowza GUI interface, select your Wowza Application, and click on the modules tab. Add a module with the class name edu.stanford.dlss.wowza.SulWowza (the name and description are arbitrary strings).

Alternatively, you can manually edit Application.xml and then reload the Wowza application. The <Modules> element in Application.xml should include something like this:

  <Module>
    <Name>SulWowza</Name>
    <Description>SUL Authorization against Stacks</Description>
    <Class>edu.stanford.dlss.wowza.SulWowza</Class>
  </Module>

Properties settings used by SulWowza plugin

You can configure the SulWowza plugin using Wowza's GUI interface, but you will also need to add some properties. The three properties our SulWowza plugin uses are:

You can add these properties using the Wowza GUI interface: select your Wowza application, click on the properties tab; scroll to the bottom for custom properties and add them.

Alternatively, you can manually edit Application.xml and then reload the Wowza application. The <Properties> element in Application.xml should include something like this:

  <Property>
    <!-- stacks token verification baseURL -->
    <Name>stacksURL</Name>
    <Value>https://stacks-test.stanford.edu</Value>
  </Property>
  <Property>
    <!-- stacks service connection timeout (time to establish a connection), in seconds; default is 30 -->
    <Name>stacksConnectionTimeout</Name>
    <Value>20</Value>
    <Type>Integer</Type>
  </Property>
  <Property>
    <!-- stacks service connection timeout (time for reading stream after connection is established),
      in seconds; default is 30 -->
    <Name>stacksReadTimeout</Name>
    <Value>20</Value>
    <Type>Integer</Type>
  </Property>

To deploy a new version of the plugin code to the VM

To deploy locally (e.g. on dev laptop)

More useful Gradle pointers

Get rid of existing build artifacts

./gradlew clean

Can be combined with other tasks, e.g. ./gradlew clean check.

To see Gradle tasks (with descriptions)

./gradlew tasks --all

For help with Gradle

./gradlew --help

Deprecated build instructions (possibly useful for troubleshooting, eventually remove?)

To manually compile

javac -d classes -cp .:libs/wms-restlet-2.2.2.jar:libs/wms-server.jar:libs/wms-httpstreamer-cupertinostreaming.jar:libs/wms-httpstreamer-mpegdashstreaming.jar:libs/log4j-1.2.17.jar:libs/junit.jar src/edu/stanford/dlss/wowza/SulWowza.java src/edu/stanford/dlss/wowza/SulWowzaTester.java

To manually create jar

jar cf dlss-wowza.jar classes/edu/stanford/dlss/wowza/SulWowza* conf