Can I use PrizmDoc with Docker?


Right so basically that repository contained two things. This shell script:

#!/bin/bash

# ./pdutil.sh install
function install() {
    # Enter temporary directory
    cd "$(mktemp -d)" || (echo "Directory change failed. Terminating." && exit 1)

    # Download
    download

    echo "Extracting archives..."
    if [[ ! "$(find . -name "*.tar.gz" -exec tar -xzvf {} \;)" ]]; then
        echo "Extraction failed. Terminating." && exit 1
    fi

    # Install
    if [[ $DEB_BASED == true ]]; then
        install_deb
    elif [[ $RPM_BASED == true ]]; then
        install_rpm
    fi

    echo "Successfully installed."
    if [[ ! "$EXCLUDE_PAS" == true ]]; then
        # License
        #license

        # WORKAROUND: Installation-critical logic is invoked by explicitly calling `pccis.sh start`
        /usr/share/prizm/scripts/pccis.sh start

        # Restart
        restart
    fi
}

function install_deb() {
    # Update apt for fresh DEB installations
    apt-get update &> /dev/null

    echo "Resolving dependencies..."
    if [[ ! "$EXCLUDE_SERVER" == true ]]; then
        dpkg --recursive --install ./*server*/
    fi

    if [[ ! "$EXCLUDE_PAS" == true ]]; then
        dpkg --recursive --install ./*client*/
    fi

    echo "Installing PrizmDoc..."
    if [[ ! "$(apt-get install -fy)" ]]; then
        echo "Installation failed. Terminating." && exit 1
    fi

    if [[ ! "$EXCLUDE_SERVER" == true ]]; then
        if [[ "$MULTILINGUAL" == true ]]; then
            echo "Installing Asian font support..."
            apt-get install -y language-pack-ja japan* language-pack-zh* chinese* language-pack-ko korean* fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core
        fi

        echo "Registering PCCIS with init.d..."
        ln -s /usr/share/prizm/scripts/pccis.sh /etc/init.d/pccis
        update-rc.d pccis defaults
    fi

    echo "Successfully installed."
    if [[ ! "$EXCLUDE_PAS" == true ]]; then

        echo "Registering PAS with init.d..."
        ln -s /usr/share/prizm/pas/pm2/pas.sh /etc/init.d/pas
        update-rc.d pas defaults

        chmod 755 /usr/share/prizm/Samples/Documents/
    fi
}

function install_rpm() {
    # Update yum for fresh RPM installations
    yum update -y &> /dev/null

    echo "Installing PrizmDoc..."
    if [[ ! "$EXCLUDE_SERVER" == true ]]; then
        yum install -y --nogpgcheck ./*server*/*.rpm
    fi

    if [[ ! "$EXCLUDE_PAS" == true ]]; then
        yum install -y --nogpgcheck ./*client*/*.rpm
    fi

    if [[ ! "$EXCLUDE_SERVER" == true ]]; then
        if [[ "$MULTILINGUAL" == true ]]; then
            echo "Installing Asian font support..."
            yum groupinstall Fonts
        fi

        echo "Registering PCCIS with init.d..."
        ln -s /usr/share/prizm/scripts/pccis.sh /etc/init.d/pccis
        chkconfig --add pccis
    fi

    echo "Successfully installed."
    if [[ ! "$EXCLUDE_PAS" == true ]]; then

        echo "Registering PAS with init.d..."
        ln -s /usr/share/prizm/pas/pm2/pas.sh /etc/init.d/pas
        chkconfig --add pas

        chmod 755 /usr/share/prizm/Samples/Documents/
    fi
}

# ./pdutil.sh remove
function remove() {
    if [[ -d "/usr/share/prizm" ]]; then
        # Prompt for confirmation
        read -rp "Prior installation detected. Remove? [y/N] " RESPONSE < /dev/tty
        if [[ ! "$RESPONSE"  =~ ^([yY][eE][sS]|[yY])$ ]]; then
            echo "Terminating." && exit 1
        fi

        echo "Stopping services..."
        /usr/share/prizm/scripts/pccis.sh stop &> /dev/null

        echo "Stopping PAS..."
        /usr/share/prizm/pas/pm2/pas.sh stop &> /dev/null

        echo "Stopping samples..."
        /usr/share/prizm/scripts/demos.sh stop &> /dev/null

        echo "Removing dependencies..."
        if [[ $DEB_BASED == true ]]; then
            apt-get purge -fy prizm-* &> /dev/null
        elif [[ $RPM_BASED == true ]]; then
            yum remove -y prizm-* &> /dev/null
        fi

        echo "Removing remaining files..."
        rm -rf /usr/share/prizm

        echo "Successfully removed."
    else
        echo "No prior installation detected. Terminating."
    fi
}

# ./pdutil.sh download
function download() {
    # Install curl for fresh Debian installations
    if [[ $DEB_BASED == true ]]; then
        apt-get install -y curl &> /dev/null
    fi

    if [[ $VERSION ]]; then
        if [[ $DEB_BASED == true ]]; then
            SERVER_LATEST="http://products.accusoft.com/PrizmDoc/$VERSION/prizmdoc_server_$VERSION.amd64.deb.tar.gz"
            CLIENT_LATEST="http://products.accusoft.com/PrizmDoc/$VERSION/prizmdoc_client_$VERSION.amd64.deb.tar.gz"
        elif [[ $RPM_BASED == true ]]; then
            SERVER_LATEST="http://products.accusoft.com/PrizmDoc/$VERSION/prizmdoc_server_$VERSION.RHEL7.tar.gz"
            CLIENT_LATEST="http://products.accusoft.com/PrizmDoc/$VERSION/prizmdoc_client_$VERSION.x86_64.rpm.tar.gz"
        fi
    else
        if [[ $DEB_BASED == true ]]; then
            SERVER_LATEST="http://products.accusoft.com/PrizmDoc/latest/prizmdoc_server_amd64.deb.tar.gz"
            CLIENT_LATEST="http://products.accusoft.com/PrizmDoc/latest/prizmdoc_client_amd64.deb.tar.gz"
        elif [[ $RPM_BASED == true ]]; then
            SERVER_LATEST="http://products.accusoft.com/PrizmDoc/latest/prizmdoc_server_RHEL7.tar.gz"
            CLIENT_LATEST="http://products.accusoft.com/PrizmDoc/latest/prizmdoc_client_x86_64.rpm.tar.gz"
        fi
    fi

    if [[ ! "$EXCLUDE_SERVER" == true ]]; then
        echo "Downloading Server..."
        curl --location --remote-name "$SERVER_LATEST"
    fi

    if [[ ! "$EXCLUDE_PAS" == true ]]; then
        echo "Downloading Client..."
        curl --location --remote-name "$CLIENT_LATEST"
    fi
}

# ./pdutil.sh license
function license() {
    if [[ -d "/usr/share/prizm" ]]; then
        while true; do
            echo "  1.) I would like to license this system with an OEM LICENSE."
            echo "  2.) I would like to license this system with a NODE-LOCKED LICENSE."
            echo "  3.) I have a license but I do not know what type."
            echo "  4.) I do not have a license but I would like an EVALUATION."
            echo "  5.) I do not want to license my product at this time."
            echo ""

            read -rp "Select an option (1-5) [5]: " RESPONSE < /dev/tty
            case "$RESPONSE" in
            "1")
                read -rp "Solution name: " SOLUTION_NAME < /dev/tty
                read -rp "OEM key: " OEM_KEY < /dev/tty

                echo "Licensing..."

                # WORKAROUND: The licenser is falsely reporting errors.
                if [[ "$(/usr/share/prizm/java/jre8/bin/java -jar /usr/share/prizm/plu/plu.jar deploy write "$SOLUTION_NAME" $OEM_KEY)" ]]; then
                    echo "/usr/share/prizm/java/jre8/bin/java -jar /usr/share/prizm/plu/plu.jar deploy write \"$SOLUTION_NAME\" $OEM_KEY"
                    echo "Licensing failed."
                else
                    echo "Licensing successful."
                    restart
                    break
                fi
                ;;
            "2")
                read -rp "Solution name: " SOLUTION_NAME < /dev/tty
                read -rp "Configuration file path (relative to $PWD): " CONFIG_FILE < /dev/tty
                read -rp "Access key: " ACCESS_KEY < /dev/tty

                echo "Licensing..."

                # WORKAROUND: The licenser is falsely reporting errors.
                if [[ "$(/usr/share/prizm/java/jre8/bin/java -jar /usr/share/prizm/plu/plu.jar deploy get "$CONFIG_FILE" "$SOLUTION_NAME" $ACCESS_KEY)" ]]; then
                    echo "/usr/share/prizm/java/jre8/bin/java -jar /usr/share/prizm/plu/plu.jar deploy get \"$CONFIG_FILE\" \"$SOLUTION_NAME\" $ACCESS_KEY"
                    echo "Licensing failed."
                else
                    echo "Licensing successful."
                    restart
                    break
                fi
                ;;
            "3")
                clear
                echo ""
                echo "  You can find your license type by selecting the \"Licenses\" tab on the"
                echo "Accusoft Portal: https://my.accusoft.com/"
                echo ""
                echo "  For an OEM LICENSE, you will be provided with a SOLUTION NAME and an OEM KEY."
                echo ""
                echo "  For a NODE-LOCKED LICENSE, you will be provided with a SOLUTION NAME, a"
                echo "CONFIGUATION FILE, and an ACCESS KEY."
                echo ""
                echo "  If you have not spoken with a member of the Accusoft Sales department, it is"
                echo "likely that you are interested in an EVALUATION."
                echo ""
                echo "  If you require additional assistance, please contact sales@accusoft.com."
                echo ""
                read -rp "Press enter to continue..."
                echo ""
                ;;
            "4")
                read -rp "Email address: " EMAIL < /dev/tty

                if [[ ! "$(/usr/share/prizm/java/jre8/bin/java -jar /usr/share/prizm/plu/plu.jar eval get "$EMAIL")" ]]; then
                    echo "Licensing failed."
                else
                    echo "Licensing successful."
                    restart
                    break
                fi
                ;;
            "5")
                echo "Terminating."
                break
                ;;
            *)
                read -rp "Token 

Can I use PrizmDoc with Docker?


Right so basically that repository contained two things. This shell script:

Can I use PrizmDoc with Docker?

Right so basically that repository contained two things. This shell script:

Can I use PrizmDoc with Docker?

Right so basically that repository contained two things. This shell script:

Can I use PrizmDoc with Docker?

Right so basically that repository contained two things. This shell script:

Can I use PrizmDoc with Docker?

Right so basically that repository contained two things. This shell script:

Can I use PrizmDoc with Docker?

Right so basically that repository contained two things. This shell script:


And this Dockerfile:

# PrizmDocker
#
# VERSION               1.0

FROM ubuntu:16.04

RUN apt-get update \
    && apt-get install -y curl \
    && curl -s https://some/docker/accessible/link/pdutil.sh | bash -s install

ENTRYPOINT curl -s https://some/docker/accessible/link/pdutil.sh | bash -s license \
    && bash

Built with:

docker image build . --tag "prizmdocker-ubuntu16.04" --no-cache

And run with:

docker run -p 3000:3000 -p 18681:18681 --rm -it --name prizmdocker-ubuntu16.04 prizmdocker-ubuntu16.04:latest

With the following caveats:

  1. PrizmDocker is configured to be ephemeral by default -- that is, the run script will destroy the container on bash exit. To disable this feature remove --rm from the run command.

  2. PrizmDocker licenses each instance at runtime. This can be annoying. To auto-license replace:

    curl -s https://some/docker/accessible/link/pdutil.sh | bash -s license
    

    in the run command with:

    /usr/share/prizm/java/jre8/bin/java -jar /usr/share/prizm/plu/plu.jar deploy write "PrizmDoc" <YOUR_OEM_LICENSE_KEY>
    

    Note: This will only work for OEM licenses.

For usage information on pdutil.sh itself, you can run it without any command line arguments:

PrizmDoc Utility v1.0

Usage:
    ./pdutil.sh (install|remove|download|license|restart) [options]

Reduces common PrizmDoc maintenance tasks down to proper Linux one-liners.

Commands:
    install - Installs PrizmDoc
    remove - Removes prior PrizmDoc installation
    download - Downloads PrizmDoc
    license - Licenses PrizmDoc
    restart - Restarts PrizmDoc services

Options:
    --multilingual    Install Asian fonts
    --exclude-pas     Exclude PAS
    --exclude-server  Exclude PrizmDoc Server