Docker Container Setup
i-net PDFC Server can be used from inside a Docker Container. There is a pre build container based up on an alpine release at Docker Hub. The container only brings the application and tools required to run the application.
Note: The container does not provide any default users. You have to use the Sign Up
method first. See below for advanced use cases.
Quickstart
Run the following command to start an i-net PDFC Server Docker Container:
docker run -d -p 9000:9000 -e CONF_listener__port=9000 --name pdfc inetsoftware/i-net-pdfc-server
Available Tags
Creating a pre-set configuration
The i-net PDFC Server Docker Container should be pre-configured using either a configuration properties file or environment variables. Either way, a local installation with the specific setup should be created first. Using the Maintenance module a backup of the configuration can be created and the configuration properties file in there can be used as a basis.
Note: To have the container fully set up on startup you have to specify at least the following properties: CONF_listener__port
and CONF_licensekey
Note: In private cloud environments you have to set the property CONF_serverURL
as well. It is recommended to set this property in other environments too.
Adding the configuration
A configuration file can be added by using a volume or any other means that adds a specified configuration to the container. The default configuration file can be used or a different one can be set using an environment variable. See Environment Properties Matrix.
Example
version: '2.1' services: pdfc: image: 'inetsoftware/i-net-pdfc-server:latest' restart: 'always' ports: - 9000:9000 environment: - DEFAULT_PROPFILE=/tmp/defaultConfiguration.properties - DEFAULT_CONFIG=User/Default # Set the externally visible server url ="../../../../un-comment-and-insert-the-correct-url" #- CONF_serverURL=https://hostname.company.com:9443/ # Set the license key (un-comment and insert the full license key) #- CONF_licensekey=... # Run the application on a pre-determined port for easier mapping - CONF_listener__port=9000 # Customize an option, e.g. the theming colors - CONF_theme__themecolors={"@base-color":"#0a89dd","@primary-color":"#42a7ca"} # Enable logging, route log to the container log-file - CONF_log__engine=true - CONF_log__file=/dev/stdout # Location for automatic backups - CONF_BackupLocation=/home/cowork/.i-net software/pdfc_User_Default/backup
Advanced Use Case
If there are more specific requirements, such as a pre-filled user database, a custom container should be created
Example: internal access with public account
Using the following compose example you can create a server that is started without any permission restrictions and can be used without further authentication using the public URL context.
version: '2.1' services: pdfc: image: 'inetsoftware/i-net-pdfc-server:latest' restart: 'always' ports: # Not setting a host port allows to use --scale, but the external port varies - 9000:9000 environment: # Using the User Default configuration - DEFAULT_CONFIG=User/Default # Set the license key (un-comment and insert the full license key) #- CONF_licensekey=... # Run the application on a pre-determined port for easier mapping - CONF_listener__port=9000 # Only guest account is active. Activate webapi and comparison.api - CONF_authentication__settings=[{"provider"\:"guest"}] - CONF_plugins__activated={"webapi.core"\:true,"comparison.api"\:true}
Example: add PAM authentication and a default user
The following Dockerfile
will create a user admin
with the password password
in a new container.
FROM inetsoftware/i-net-pdfc-server # Switch to root user for installation USER root # Tools RUN apk add --update linux-pam # grant pam permissions to everybody # Create User that we can log in with RUN chmod +r /etc/shadow \ && adduser -D -g "User" admin \ && echo admin:password | chpasswd \ && ln -s "/etc/pam.d/base-password" "/etc/pam.d/pdfc" # Enable the system login. By default, the PAM plugin is disabled. ENV CONF_authentication__settings="[{'provider':'system'},{'provider':'product','userCanRegister':'true'}]" ENV CONF_plugins__activated="{}" # Switch back to product user USER pdfc
Example: enable Tesseract OCR recognition
The i-net PDFC Server does OCR using the Tesseract libraries. You have to create a new container with Tesseract installed.
# Build from i-net PDFC Base FROM inetsoftware/i-net-pdfc-server # Switch to root for installation USER root RUN set -x \ && apk add --update tesseract-ocr # Tesseract requires this setting ENV LC_ALL=C # Switch back to product user USER pdfc
Mounting / Re-using a given configuration
Environment Properties Matrix
MongoDB Persistence
Docker Compose Example
To bundle a docker container with a MongoDB persistence using Docker Compose, the following docker-compose.yml
script can be used as a starting point:
version: '2.1' services: pdfc: image: 'inetsoftware/i-net-pdfc-server:latest' restart: 'always' ports: # Not setting a host port allows to use --scale, but the external port varies - 9000:9000 environment: # Using the System/Default config is mandatory in cloud persistence environments - DEFAULT_CONFIG=System/Default # Set the externally visible server url ="../../../../un-comment-and-insert-the-correct-url" #- CONF_serverURL=https://hostname.company.com:9443/ # Set the license key (un-comment and insert the full license key) #- CONF_licensekey=... # Run the application on a pre-determined port for easier mapping - CONF_listener__port=9000 # Do not force the application to overwrite a previously imported configuration # or other instances using the same MongoDB will have their configuration modified - FORCE_IMPORT_CONFIG=0 # Set up the connection the MongoDB persistence - inet_persistence=mongodb://root:example@mongo:27017/pdfc mongo: image: mongo environment: MONGO_INITDB_ROOT_PASSWORD: example MONGO_INITDB_ROOT_USERNAME: root restart: always
Note: The parameter FORCE_IMPORT_CONFIG
should be set to 0
so that the configuration is imported only once versus every time the container is started. This way the configuration may be persisted and re-used on subsequent restarts or in a scaled environment.
Note: Depending on the specific environment there may be some more options that have to be set. Please have a look at the Environment Properties Matrix.
Creating a load balanced environment
To distribute the computation load across several server nodes it possible to create a load balanced environment. It is crucial to know that each node will be frontend and backend server at the same time. The nodes can share the data persistence - using a MongoDB setup - so that comparisons are available across nodes.
A load balancer, such as HAProxy
, has to support some kind of sticky sessions so that a logged-in user will always be directed to the same node.
In case of the HAProxy
you can use the balance hdr(Cookie)
setting. To showcase a setup of i-net PDFC using HAProxy have a look at our gitHub example.