diff --git a/Docker/README.md b/Docker/README.md index 5e6dfef..40a9f90 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -1,10 +1,37 @@ -# Dyalog Jarvis - Web service framework using JSON or REST -## Usage -### Running the container: -Run the container with the following command changing the path to your source +## Jarvis web service framework + +Jarvis is Dyalog's web service framework, written in Dyalog APL. For more information about Jarvis, see (the Jarvis GitHub repository)[https://github.com/Dyalog/jarvis]. The `dyalog/jarvis` container is built from the Docker subdirectory in that repository, and is designed to make it very easy to deploy Jarvis-based applications. + +## Using the container + +If `/path/to/app` contains the application that Jarvis is to serve and `7777` is the port that you would like the service to appear on, then all you need to do to start running a containerised Jarvis server is to use docker run to start the `dyalog/jarvis` container, using the `-v` switch to mount the directory under the name `/app` and `-p` to map the port number to 8080, which is the port number that Jarvis will use inside the container: + ```sh -docker run -p 8080 -v /path/to/source/code:/code dyalog/jarvis:latest +docker run -p 7777:8080 -v /path/to/app:/app dyalog/jarvis ``` -### Access the Web Interface +## Demo Application + +If you do not map a directory into the container, it will serve up the default application which can be found in the `Samples\JSON` folder in the Jarvis repository. If you direct a web browser at the exposed port, Jarvis will present a simple interactive interface. You can test that it is working by entering "GetSign" as the method to execute, and a date of birth in the form "[mm,dd]" as JSON data, and clicking "send". + +## Debugging + +See the description of the `dyalog/dyalog` container for information on debugging and other fundamentals. The `dyalog/jarvis` container is built upon that container, adding the code for Jarvis as the main application to be run. + +## Configuration + +Most Jarvis configuration options should be set using a Jarvis configuration file, which you can read about in the Jarvis documentation. A couple of environment variables are particularly useful in the context of running Jarvis in a container. + +| Variable Name | Description | +| -------------------------- | ------------------------------------------------------------ | +| DYALOG_JARVIS_CODELOCATION | The name of the directory (as seen from inside the container) where the application code resides (default is `/app`) | +| DYALOG_JARVIS_PORT | The port number to use inside the container (default is 8080) | + +You can set environment variables to modify the behaviour of the container. For example, you could insert`-e DYALOG_JARVIS_CODELOCATION=/code ` into the `docker run` command (assuming that was where you had placed the code). + +## Licence + +Dyalog is free for non-commercial use but is not free software. Please see [here](https://www.dyalog.com/prices-and-licences.htm) for our Licence Agreement and full Terms and Conditions. Note that: + + * Commercial re-distribution of software that includes Dyalog requires a [Run Time Licence](https://www.dyalog.com/prices-and-licences.htm#runtimelic). If you do not have a commercial licence, and you make images available for download, this constitutes acceptance of the default Run Time Licences, which allows non-commercial and limited commercial distribution. + * If you create docker images which include Dyalog APL in addition to your own work and make them available for download, you must include the LICENSE file in a prominent location and include instructions which make reference to it. -Once the container is running, you will be able to navigate to http://localhost:8080, you will see a web form to query the server. diff --git a/Docker/run b/Docker/entrypoint old mode 100755 new mode 100644 similarity index 67% rename from Docker/run rename to Docker/entrypoint index 0a2bd5c..97f2a05 --- a/Docker/run +++ b/Docker/entrypoint @@ -1,6 +1,6 @@ #!/bin/bash -## This file replaces the Dyalog mapl script +## This file starts the Jarvis container echo " _______ __ _ ____ _____ " echo "| __ \ \ / //\ | | / __ \ / ____|" echo "|_| | \ \_/ // \ | | | | | | | " @@ -9,23 +9,20 @@ echo " ____| | | |/ / \ \| |___| |__| | |__| |" echo "|_____/ |_/_/ \_\______\____/ \_____|" echo "" echo "https://www.dyalog.com" -echo "" -echo "*************************************************************************************" -echo "* This software is for non-commercial evaluation ONLY *" -echo "* https://www.dyalog.com/uploads/documents/Private_Personal_Educational_Licence.pdf *" -echo "*************************************************************************************" -echo "" -export MAXWS=${MAXWS-256M} +echo "" export JARVIS=/opt/mdyalog/Jarvis +export DYALOG_JARVIS_THREAD=${DYALOG_JARVIS_THREAD-DEBUG} +export DYALOG_JARVIS_PORT=${DYALOG_JARVIS_PORT-8080} +export MAXWS=${MAXWS-256M} export DYALOG=/opt/mdyalog/18.2/64/unicode/ -export WSPATH=${DYALOG}/ws +export WSPATH=/opt/mdyalog/18.2/64/unicode/ws export TERM=dumb export APL_TEXTINAPLCORE=${APL_TEXTINAPLCORE-1} -export SESSION_FILE="${SESSION_FILE-$DYALOG/default.dse}" +export TRACE_ON_ERROR=${TRACE_ON_ERROR-1} -export Port=8080 +export SESSION_FILE="${SESSION_FILE-$DYALOG/default.dse}" if [ $(ls /app | grep "jarvis.json" 2>/dev/null | wc -l) -eq 1 ]; then echo "Application config found in /app/jarvis.json" @@ -42,9 +39,7 @@ export CodeLocation=${CodeLocation-$CODEL} cd /app if [ -n "$RIDE_INIT" ]; then - export TRACE_ON_ERROR=1 $DYALOG/dyalog +s -q $JARVIS/Distribution/Jarvis.dws else - export TRACE_ON_ERROR=0 # No session so can never open a trace window $DYALOG/dyalog -s $JARVIS/Distribution/Jarvis.dws fi diff --git a/Dockerfile b/Dockerfile index cfe3cbe..5c2ff35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM dyalog/dyalog:18.2-beta +FROM dyalog/dyalog:18.2 USER root ADD . /opt/mdyalog/Jarvis EXPOSE 8080 -ADD Docker/run /entrypoint +ADD Docker/entrypoint /entrypoint USER dyalog