Skip to main content Link Search Menu Expand Document (external link)

Running DocIntel with Systemd

Systemd is a powerful tool that allows Linux users to manage and control system processes, including running applications and services. When it comes to running Docintel and its components, setting up systemd services can help ensure that the application is always running as expected, even after a system reboot.

In this guide, we will show you how to set up systemd services for Docintel and its components. The guide assumes that all images have been downloaded and properly configured as explained in the installation guide that uses Docker Compose.

By the end of this page, you will have a clear understanding of how to set up systemd services to run Docintel smoothly and reliably on your Linux system.

Configuring Environment file

To streamline management and maintenance of necessary systemd services, we will utilize an environment file that stores the values used by all services. This file, located at /config/docintel.env, acts as a central repository for these values. To populate the file, add the following variables:

DOCINTEL_NETWORK=docintel-network
DOCINTEL_DATA=/data
DOCINTEL_CONFIG=/config

POSTGRES_USER=postgres
POSTGRES_PASSWORD=MyVerySecretPassword

SYNAPSE_USER=root
SYNAPSE_PASSWORD=MyVerySecretPassword

Configuring service for Docker network

The following service file will allow you to set up and manage the Docket network used by DocIntel deployment easily. This service file creates and manages the Docker network where all DocIntel components communicate with each other. The service file is configured to automatically start the network at boot and restart it if it crashes.

To configure the Docker network service, you need to modify the service file located at /etc/systemd/system/docker.docintel.network.service. The service file contains the necessary settings to run the DocIntel network using Docker. Once you have modified the service file, you can start the network by running systemctl start docker.docintel.network. If you want the network to start automatically during system boot, you need to enable it by running systemctl enable docker.docintel.network. Here’s the service file that you need to edit:

[Unit]
Description=DocIntel Network (Docker)
After=docker.service
Requires=docker.service

[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker network rm $DOCINTEL_NETWORK
ExecStart=/usr/bin/docker network create $DOCINTEL_NETWORK

[Install]
WantedBy=multi-user.target

Configuring services for dependencies

To configure the PostgreSQL service, you need to modify the service file located at /etc/systemd/system/docker.postgres.service. The service file contains the necessary settings to run the PostgreSQL container using Docker.

[Unit]
Description=PostgreSQL (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service

[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull postgres
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -p 8888:5432 \
  -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
  -e PGUSER=$POSTGRES_USER \
  -v _DOCINTEL_DATA_/postgres/:/var/lib/postgresql/data \
  --health-cmd="pg_isready" \
  --health-interval=10s \
  --health-timeout=5s \
  --health-retries=5 \
  postgres

[Install]
WantedBy=multi-user.target

To configure the Apache SolR service, you need to modify the service file located at /etc/systemd/system/docker.solr.service. The service file contains the necessary settings to run the Apache SolR container using Docker.

[Unit]
Description=Apache SolR (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service

[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull solr
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -p 8983:8983 \
  -v $DOCINTEL_DATA/solr/:/var/solr solr

[Install]
WantedBy=multi-user.target

To configure the Vertex Synapse service, you need to modify the service file located at /etc/systemd/system/docker.synapse.service. The service file contains the necessary settings to run the Vertex Synapse container using Docker.

[Unit]
Description=Vertex Synapse (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service

[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull vertexproject/synapse-cortex:v2.x.x
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -e SYN_CORTEX_AUTH_PASSWD=$SYNAPSE_PASSWORD \
  -p 27492:27492 \
  -v $DOCINTEL_DATA/vertex/:/vertex/storage \
  vertexproject/synapse-cortex:v2.x.x

[Install]
WantedBy=multi-user.target

To configure the RabbitMQ service, you need to modify the service file located at /etc/systemd/system/docker.rabbitmq.service. The service file contains the necessary settings to run the RabbitMQ container using Docker.

[Unit]
Description=RabbitMQ (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service

[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull rabbitmq:latest
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -p 5672:5672 \
  -p 15672:15672 \
  -v $DOCINTEL_DATA/rabbitmq/:/var/lib/rabbitmq/mnesia/ \
  --health-cmd="rabbitmq-diagnostics -q ping" \
  --health-interval=30s \
  --health-timeout=10s \
  --health-retries=5 \
  rabbitmq:latest

[Install]
WantedBy=multi-user.target

Once you have modified the service files, you can start the dependencies by running systemctl start.

systemctl start docker.postgres
systemctl start docker.solr
systemctl start docker.synapse
systemctl start docker.rabbitmq

If you want the services to start automatically during system boot, you need to enable it by running systemctl enable.

systemctl enable docker.postgres
systemctl enable docker.solr
systemctl enable docker.synapse
systemctl enable docker.rabbitmq

Configuring services for DocIntel

We now have to setup services for DocIntel and all its components.

To configure the DocIntel Document Analyzer service, you need to modify the service file located at /etc/systemd/system/docker.docintel.document-analyzer.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Document Analyzer (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/document-analyzer
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/document-analyzer
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Document Indexer service, you need to modify the service file located at /etc/systemd/system/docker.docintel.document-indexer.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Document Indexer (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/document-indexer
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/document-indexer
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Importer service, you need to modify the service file located at /etc/systemd/system/docker.docintel.importer.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Importer (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/importer
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/importer
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Newsletter service, you need to modify the service file located at /etc/systemd/system/docker.docintel.newsletter.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Newsletter (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/newsletter
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/newsletter
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Source Indexer service, you need to modify the service file located at /etc/systemd/system/docker.docintel.source-indexer.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Source Indexer (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/source-indexer
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/source-indexer
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Tag Indexer service, you need to modify the service file located at /etc/systemd/system/docker.docintel.tag-indexer.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Tag Indexer (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/tag-indexer
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/tag-indexer
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Thumbnailer service, you need to modify the service file located at /etc/systemd/system/docker.docintel.thumbnailer.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel Thumbnailer (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/thumbnailer
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/thumbnailer
 
[Install]
WantedBy=multi-user.target

To configure the DocIntel Web Application service, you need to modify the service file located at /etc/systemd/system/docker.docintel.webapp.service. The service file contains the necessary settings to run container using Docker.

[Unit]
Description=DocIntel WebApp (Docker)
After=docker.service
Requires=docker.service
After=docker.docintel.network.service
Requires=docker.docintel.network.service
After=docker.postgres.service
Requires=docker.postgres.service
After=docker.solr.service
Requires=docker.solr.service
After=docker.synapse.service
Requires=docker.synapse.service
After=docker.rabbitmq.service
Requires=docker.rabbitmq.service
 
[Service]
EnvironmentFile=/config/docintel.env
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull docintelapp/webapp
ExecStart=/usr/bin/docker run --rm --name %n \
  --network $DOCINTEL_NETWORK \
  -p 5005:80 \
  -v $DOCINTEL_CONFIG:/config
  -v $DOCINTEL_DATA/files/:/files
  -v $DOCINTEL_DATA/lock/:/lock
  -v $DOCINTEL_DATA/modules/:/modules
  docintelapp/webapp
 
[Install]
WantedBy=multi-user.target

Once you have modified the service files, you can start the DocIntel components by running systemctl start.

systemctl start docker.docintel.document-analyzer
systemctl start docker.docintel.document-indexer
systemctl start docker.docintel.importer
systemctl start docker.docintel.newsletter
systemctl start docker.docintel.source-indexer
systemctl start docker.docintel.tag-indexer
systemctl start docker.docintel.thumbnailer
systemctl start docker.docintel.webapp

If you want the services to start automatically during system boot, you need to enable it by running systemctl enable.

systemctl enable docker.docintel.document-analyzer
systemctl enable docker.docintel.document-indexer
systemctl enable docker.docintel.importer
systemctl enable docker.docintel.newsletter
systemctl enable docker.docintel.source-indexer
systemctl enable docker.docintel.tag-indexer
systemctl enable docker.docintel.thumbnailer
systemctl enable docker.docintel.webapp