Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section outlines the step to take to create a Docker configuration that you can use to build a WProofreader image.

Noteexcerpt

You can

also use

install WebSpellChecker Server using a Docker image

with WProofreader Serverthat we built and published on

available at Docker Hub.

To create and use a custom Docker image with WProofreader Server: 

1. Clone WProofreader Docker repo.

2. Copy the WebSpellChecker/WProofreader installation package (e.g. wsc_app_x64_x.x.x.x_xx.tar.gz) to wproofreader-docker/files directory.

3. If needed, adjust the default installation options by modifying the wproofreader-docker/files/config.ini file. For details on the available options, refer to Automated Installing WebSpellChecker on Linux guide.

4. Build a Docker image using the command below:

Code Block
languagepowershell
themeEmacs
docker build -t webspellchecker/wproofreader <path_to_Dockerfile_directory>

where: 

- t is a tag that will use the 'webspellchecker/wproofreader' name,

<path_to_Dockerfile_directory> is the path to a Dockerfile directory (not to Dockerfile itself). If a Dockerfile is in the same directory, e.g. /wproofreader-docker/, you need to use  the dot (.) instead of the path.

For example: 

Code Block
languagepowershell
themeEmacs
docker build -t webspellchecker/wproofreader 

5. Run the latest Docker image with the following options:

Code Block
languagepowershell
themeEmacs
docker run --mac-address="12:34:d7:b0:6b:61" -d -p 80:80 -p 2880:2880 webspellchecker/wproofreader <license_ticket_id> <your_host_name>

To use global custom and user dictionaries, your need to share a directory for the dictionaries with the Docker container. To do so, run a container as follows:

Code Block
languagepowershell
themeEmacs
docker run --mac-address="12:34:d7:b0:6b:61" -d -p 80:80 -p 2880:2880 -v <your_directory_path>:/dictionaries webspellchecker/wproofreader <license_ticket_id> <your_host_name>

where:

  • --mac-address="12:34:d7:b0:6b:61" — predefine a MAC address of Docker container to ensure the correct licensing process;
  • -d start a container in detached mode;
  • -p 80:80 and -p 2880:2880 — map the host port and the exposed port of container, where port 80 is a web server port and 2880 is the service port;
  • -v <shared_dictionaries_directory>:/dictionaries — mount a shared directory where personal user dictionaries and global custom dictionaries will be created and stored. This is required to save the dictionaries between the starts of containers.
  • webspellchecker/wproofreader - the latest tag of WProofreader Server Docker image;
  • license_ticket_id - your license ticket ID;
  • your_host_name - the name of a host that will be used for setup of demo samples with WProofreader. This is an optional parameter, and if nothing is specified, localhost will be used (e.g. http://localhost/wscservice/samples/).

The wproofreader-docker repo contains the following items:

  • Files directory
    where configureFiles.pl configuration of samples and preparing custom/user dictionaries to be used with shared directories. It’s recommended not to modify this directory contents. 
  • Dockerfile
  • README.md

wproofreader-docker/Dockerfile

Below is the description of the commands and steps described in Dockerfile. 

There is a prebuilt non-SSL image of WebSpellChecker/WProofreader based on the latest Ubuntu with Nginx.

Tip

You may benefit from using a Docker image when evaluating WebSpellChecker, whereas for production purposes or a real setup, you need to create a custom image using a Dockerfile. 

To create and use a custom Docker image, navigate to wproofreader-docker repo and familiarize with detailed instructions and further steps descriptions. 

This repository contains the following items:

  • Files directory where: 
    • configureFiles.pl a script which customizes the samples providing the correct path for these samples and sets up a shared directory for working with custom and user dictionaries;
    • configureWebServer.pl –  a script that configures the nginx web server for processing static files and service requests;
    • startService.sh – a script that starts all services required to launch WebSpellChecker when running the container, including configureFiles.pl and configureWebServer.pl on container startup.
  • Dockerfile –  a file describing the sequence of commands required to create a Docker image with WebSpellChecker Server based on the latest Ubuntu;
  • DockerfileCentOS –  a file describing the sequence of commands required to create a Docker image with WebSpellChecker Server based on the latest CentOS;
  • DockerfileRedHat –  a file describing the sequence of commands required to create a Docker image with WebSpellChecker Server based on the latest Red Hat Universal Base Image 8;
  • README.md – a file containing instructions on how to create and use a custom Docker image, its settings, as well as instructions on launching the container from this Docker image and description of further steps.

Further Steps

After a Docker container with WProofreader is up and running, integrate it into your web application following the instructions of the following sections: 

Code Block
languagepowershell
themeEmacs
# the latest stable Ubuntu package. FROM ubuntu # the web server port address. EXPOSE 80 # AppServer port address. EXPOSE 2880  RUN apt-get update -y # install the latest stable version of Apache HTTP Server. RUN apt-get install -y apache2 # install the latest stable version of Apache HTTP Server. # install the latest stable version of Java Runtime Environment (JRE). It is required for the grammar engine. RUN apt-get install -y default-jre  # define a constant with the name of the directory where to extract the package files. ARG DeploymentDir=downloads  # define a constant with the name of the directory which will be used for shared dictionaries inside the container ARG DictionariesDir=dictionaries ARG FilesDir=./files ARG AppServerDir=/opt/WSC/AppServer ARG AppRootFolder=WSC ARG AppNameMask=wsc_app* # create a directory for deployment. RUN mkdir $DeploymentDir  # create a directory for shared dictionaries. RUN mkdir $DictionariesDir  # change the working directory to the deployment directory, e.g. downloads. WORKDIR /$DeploymentDir  COPY $FilesDir/$AppNameMask /$DeploymentDir # extract the package contents from the archive. RUN tar -xvf $AppNameMask  # delete the package achieve. RUN rm $AppNameMask  # rename WSC_x.x.x into WSC. RUN mv $AppRootFolder* $AppRootFolder  # copy  the config.ini file to the application root directory. COPY ./files/config.ini /downloads/$AppRootFolder  # change the working directory to the application root directory, e.g. WSC. WORKDIR /downloads/$AppRootFolder  # run the automated installation using the config.ini file. RUN perl automated_install.pl config.ini  # copy the configureFiles.pl file to the directory with the application COPY $FilesDir/configureFiles.pl $AppServerDir # copy the startService.sh file to the directory with the application COPY $FilesDir/startService.sh $AppServerDir # grant permissions to launch the file for any user.  RUN chmod +x $AppServerDir/startService.sh  # start the required services for the application when launching the container. ENTRYPOINT ["/opt/WSC/AppServer/startService.sh"]