Skip to content

Commit

Permalink
Update from 18.0 to 18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mkromberg committed Mar 10, 2022
1 parent 7bc1a3c commit 8def522
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 22 deletions.
41 changes: 34 additions & 7 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -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.
21 changes: 8 additions & 13 deletions Docker/run → Docker/entrypoint
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

## This file replaces the Dyalog mapl script
## This file starts the Jarvis container
echo " _______ __ _ ____ _____ "
echo "| __ \ \ / //\ | | / __ \ / ____|"
echo "|_| | \ \_/ // \ | | | | | | | "
Expand All @@ -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"
Expand All @@ -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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8def522

Please sign in to comment.