Install with Docker Compose
Install the XTM stack for production on one host with the official Docker Compose deployment, with secrets, public URLs, persistent data and pinned versions.
This page installs the XTM stack for production on one host with the official Docker deployment, FiligranHQ/xtm-docker. At the end, the whole stack, XTM One, OpenCTI, OpenAEV, OpenCRQ, XTM Composer and their default integrations, runs with strong secrets, the public addresses of your users, data kept in Docker volumes and versions that change only when you decide. Every install of the XTM platform runs all its modules together: there is no install of one module on its own. To try the platform first, follow Run the XTM platform locally: it uses the same files with fewer steps.
- The host → .env: secrets script
- .env → The whole XTM platform: settings and secrets
- docker-compose.override.yml → The whole XTM platform: merged at each command
- The whole XTM platform → Docker volumes: keeps its data
- Reverse proxy → The whole XTM platform: 127.0.0.1:8080 to 8090
OpenCTI-Platform/docker is a second Compose deployment, for OpenCTI with XTM One and XTM Composer, without OpenAEV. It has an OpenSearch variant, docker-compose.opensearch.yml. Its .env.sample names the OpenCTI and XTM One settings as xtm-docker does, but its services differ (XTM One has its own PostgreSQL, pgsql-xtm-one) and so does its mail setting (SMTP_HOSTNAME): the commands of this page do not apply to it as they are. This page follows xtm-docker.
Before you start
- A Linux host with Docker Engine 20.10 or later and Docker Compose 2.24.4 or later:
docker compose versionprints it. An earlier v2 stops on theincludelist ofdocker-compose.yml(2.20) or on the!overridetags of this page (2.24.4). To install them, follow the Docker Engine installation guide. - 16 GB of RAM at least, 32 GB recommended for production, and 50 GB of free disk. Sizing says how much each module needs.
- An Intel or AMD (amd64) processor: XTM One is published for amd64 only.
- Python 3, to pin the image versions.
- For each platform users reach, the host name they will type, such as
opencti.example.com, and a reverse proxy that serves it over HTTPS: see Publish the platforms over HTTPS.
Prepare the host
-
Raise the memory map limit that Elasticsearch needs, now and after every restart.
echo 'vm.max_map_count=262144' | sudo tee /etc/sysctl.d/99-xtm-elasticsearch.conf sudo sysctl --systemCheck that it workedsysctl vm.max_map_countIt prints
vm.max_map_count = 262144. -
Make Docker start with the host. Every service of the stack has
restart: always, exceptxtm-one-db-init, which runs once at each start, so the stack comes back when Docker does.sudo systemctl enable --now docker -
Get the deployment.
git clone https://github.com/FiligranHQ/xtm-docker.git cd xtm-docker
Configure the stack
docker-compose.yml includes one file per shared service, under infra/, and one file per module, under modules/: xtm-one.yml, opencti.yml, openaev.yml, opencrq.yml and xtm-composer.yml. Every service they list starts, and XTM Composer manages both OpenCTI and OpenAEV.
All the configuration is in .env, except the ports, the image versions and the number of workers, which these Compose files set. Change those in docker-compose.override.yml, never in the files of xtm-docker: see Change the stack without editing docker-compose.yml.
-
Create
.envwith fresh secrets.docker compose -f init.yml run --rm initA temporary container copies
.env.sampleand gives every password, key and token a random value: a UUID for the admin tokens and health check keys, a 32-byte base64 key forOPENCTI_ENCRYPTION_KEY, and a random string for the others. It names the users of PostgreSQL and RabbitMQ, sends mail tolocalhostuntil step 3, makes.envreadable by its owner alone, and never overwrites an existing.env. It prints the admin password of each platform..envnow holds every secret of the stack, including the encryption keys of OpenCTI and OpenAEV. Keep a copy in your secret store: you need the same values to restore the stack. -
Set the admin accounts. Give
OPENCTI_ADMIN_EMAIL,OPENAEV_ADMIN_EMAILandXTM_ONE_ADMIN_EMAILthe address of your administrator.XTM_ONE_ADMIN_EMAILmust be the admin email of the platforms XTM One connects to: XTM One finds the user by this address.ADMIN=admin@example.com sed -i.bak -E "s/^(OPENCTI|OPENAEV|XTM_ONE)_ADMIN_EMAIL=.*/\1_ADMIN_EMAIL=${ADMIN}/" .env -
Set the mail server. Replace the
SMTP_*values of.envwith those of your relay:SMTP_HOST,SMTP_PORT,SMTP_USERNAME,SMTP_PASSWORD, andSMTP_AUTH,SMTP_SSL_ENABLE,SMTP_STARTTLS_ENABLEset totrueorfalse. If OpenAEV does not read a mailbox, setOPENAEV_MAIL_IMAP_ENABLED=falseand leave theIMAP_*values.NoteOpenAEV uses every
SMTP_*value. OpenCTI uses onlySMTP_HOST, on port 25 without authentication, asdocker-compose.ymlsets it. To send OpenCTI mail through an authenticated relay, see Configure the shared services. -
Fit Elasticsearch to the host.
ELASTIC_MEMORY_SIZEis the Java heap of Elasticsearch,4Gin.env.sample.RAM of the host ELASTIC_MEMORY_SIZE16 GB 2G32 GB 4G64 GB or more 8Gsed -i.bak 's/^ELASTIC_MEMORY_SIZE=.*/ELASTIC_MEMORY_SIZE=8G/' .env -
Set the public URLs. Each platform builds its URL from three variables of
.env: the scheme, the host and the port that users type. For platforms served over HTTPS by a reverse proxy on port 443, set:OPENCTI_EXTERNAL_SCHEME=https OPENCTI_HOST=opencti.example.com OPENCTI_PORT=443 OPENAEV_EXTERNAL_SCHEME=https OPENAEV_HOST=openaev.example.com OPENAEV_PORT=443 XTM_ONE_EXTERNAL_SCHEME=https XTM_ONE_HOST=xtm-one.example.com XTM_ONE_PORT=443 OPENCRQ_EXTERNAL_SCHEME=https OPENCRQ_HOST=opencrq.example.com OPENCRQ_PORT=443These URLs are also the identity each module signs its requests to the others with. Inside the stack, the containers reach each other on their service names (
http://opencti:8080,http://openaev:8080,http://xtm-one:4000,http://opencrq:3002), so the public host names do not need to resolve inside Docker. -
Publish the platforms on local ports for the reverse proxy.
docker-compose.ymlpublishes OpenCTI onOPENCTI_PORTand XTM One onXTM_ONE_PORT, so with the values above Docker would take port 443 that the proxy needs. It also publishes Elasticsearch and Redis, which run without authentication, on every interface. This command createsdocker-compose.override.yml, which binds every published port to the host itself, with OpenCTI on 8080, OpenAEV on 8081 and XTM One on 8090.ports: !overridereplaces the ports ofdocker-compose.ymlinstead of adding to them:cat > docker-compose.override.yml <<'EOF' services: opencti: ports: !override - "127.0.0.1:8080:8080" openaev: ports: !override - "127.0.0.1:8081:8080" xtm-one: ports: !override - "127.0.0.1:8090:4000" opencrq: ports: !override - "127.0.0.1:8082:3002" elasticsearch: ports: !override - "127.0.0.1:9200:9200" redis: ports: !override - "127.0.0.1:6379:6379" minio: ports: !override - "127.0.0.1:9000:9000" rabbitmq: ports: !override - "127.0.0.1:5672:5672" - "127.0.0.1:15672:15672" EOFNoteAn integration that runs on another host, outside XTM Composer, needs to reach some of these services. See Run an integration without XTM Composer before you close them.
-
Pin the versions.
docker-compose.ymluses thelatesttag, so everydocker compose pullcould upgrade a platform. Write the releases you install indocker-compose.override.ymlwith the commands of Pin the image versions, here the current ones:OPENCTI_VERSION=7.261119.0,OPENAEV_VERSION=3.261118.0,XTM_ONE_VERSION=1.261119.1andOPENCRQ_VERSION=0.261123.0.The OpenCTI connectors and the OpenAEV collectors and injectors follow the version of their platform. xtm-docker pins RustFS, the S3 storage, to
1.0.4. XTM Composer, thealpine/opensslkey generator and the AWS command line interface ofopencrq-bucket-initkeeplatest. Check which versions work together in Compatibility between modules. -
Size the OpenCTI workers. The worker writes the data that connectors send to OpenCTI;
modules/opencti.ymlstarts 3 of them. For more throughput, setreplicasof theworkerservice indocker-compose.override.yml: add theworkerlines below under theservices:key of the file, above the# Pinned versionsline.services: worker: deploy: replicas: 4Scale: workers, platforms and clusters explains when to add workers.
Check that it workeddocker compose config --quiet && echo "configuration OK" docker compose config --servicesIt prints
configuration OK, then the 32 services of the stack: XTM One with its worker andxtm-one-db-init, OpenCTI with its worker and ten connectors, OpenAEV with four collectors and two injectors, OpenCRQ withopencrq-db-initandopencrq-bucket-init, XTM Composer withrsa-key-generator, and the five shared services.opensandbox, which runs the code of XTM One's agents, starts only with its profile: see Run code in OpenSandbox.
Start the stack
-
Download the images, then start the stack.
docker compose pull docker compose up -dThe first start creates the databases and the indices: allow a few minutes.
-
Wait until the platforms are healthy.
docker compose ps --format '{{.Service}} {{.Health}}' | grep -E '^(opencti|openaev|xtm-one|opencrq) 'Check that it workedopencti,openaev,xtm-oneandopencrqsayhealthy. On the host, OpenCTI, OpenAEV and XTM One answer their health check on their local port:set -a; . ./.env; set +a curl -fsS "http://127.0.0.1:8080/health?health_access_key=$OPENCTI_HEALTHCHECK_ACCESS_KEY" >/dev/null && echo "OpenCTI OK" curl -fsS "http://127.0.0.1:8081/api/health?health_access_key=$OPENAEV_HEALTHCHECK_KEY" >/dev/null && echo "OpenAEV OK" curl -fsS "http://127.0.0.1:8090/api/health" >/dev/null && echo "XTM One OK" -
Put the reverse proxy in front of the platforms, as Publish the platforms over HTTPS describes, then sign in at each public URL with the admin email and password of
.env. OpenCRQ has no password of its own: XTM One's administrator signs in to it through XTM One and lands in its first tenant,Default, which OpenCRQ creates at its first start. Then finish the setup of each module.
Finish the setup of each module
The stack runs every module from its first start. Each one has a few steps left before people use it:
| Module | What is left | Where |
|---|---|---|
| OpenCTI and OpenAEV | Sign in with the admin email and password of .env, and keep a break-glass account before you turn on single sign-on | Sign in the first time and keep an emergency account |
| XTM One | Trust the reverse proxy, let it stream the chat, connect a language model and give it its edition | Finish the setup of XTM One |
| OpenCRQ | Check its public URL and its registration with XTM One, then sign in to its first tenant through XTM One | Finish the setup of OpenCRQ |
| Every module | Check that the modules registered with XTM One and reach each other | Connect the modules to each other |
Change the stack without editing docker-compose.yml
docker-compose.yml belongs to the xtm-docker repository: change it, and every git pull conflicts with your change. Put every local change in docker-compose.override.yml, next to it, instead. Docker Compose reads that file after docker-compose.yml on every command and merges the two. .env keeps the values xtm-docker reads from it; the override file holds the rest: environment variables, mounts, ports, image versions and the number of workers.
This example raises the log level of OpenCTI, mounts a folder of certificates in it, publishes it on the host only, and starts four workers:
services:
opencti:
environment:
- APP__APP_LOGS__LOGS_LEVEL=info
volumes:
- ./certs:/opt/opencti/certs:ro
ports: !override
- "127.0.0.1:8080:8080"
worker:
deploy:
replicas: 4
Docker Compose merges each key in its own way:
| Key | What the override file does |
|---|---|
environment | Adds the variable, or replaces the value of the variable of the same name |
volumes | Adds the mount, or replaces the mount on the same path in the container |
ports | Adds to the ports of docker-compose.yml. ports: !override followed by a list replaces them, ports: !reset [] removes them |
depends_on | Adds the dependency. <service>: !reset null under it removes one |
profiles | Adds to the profiles. profiles: !override ["disabled"] keeps the service from starting |
image, deploy.replicas and the other single values | Replaces the value |
A service that docker-compose.yml does not have | Adds it |
!reset needs Docker Compose 2.24 or later, and !override 2.24.4 or later. Above the pinned versions, write one services: key, and each service once under it: when a page gives lines for a service your file already has, add them under that service. Docker Compose refuses a file that repeats a key, with mapping key "opencti" already defined.
docker compose config --quiet && echo "configuration OK"
docker compose config | grep -E 'LOGS_LEVEL|host_ip|replicas'
With the example as docker-compose.override.yml, it prints configuration OK, then APP__APP_LOGS__LOGS_LEVEL: info, host_ip: 127.0.0.1 and replicas: 4: the merged configuration has the values of the override file.
Apply the change with docker compose up -d: Docker Compose recreates the containers whose configuration changed. After a git pull, run docker compose config --quiet again, and compare what you replaced with !override to the new docker-compose.yml.
Pin the image versions
These commands pin the OpenCTI, OpenAEV, XTM One and OpenCRQ images of the stack. They write the image of each service, with the versions you set, at the end of docker-compose.override.yml. Run them again to change the versions: they replace that part of the file.
OPENCTI_VERSION=7.261119.0
OPENAEV_VERSION=3.261118.0
XTM_ONE_VERSION=1.261119.1
OPENCRQ_VERSION=0.261123.0
touch docker-compose.override.yml
sed -i.bak '/^# Pinned versions/,$d' docker-compose.override.yml
PINNED=$(docker compose config --format json | python3 -c '
import json, sys
tags = dict(zip(["opencti", "openaev", "xtmone", "filigran/opencrq"], sys.argv[1:]))
for name, service in sorted(json.load(sys.stdin)["services"].items()):
repo = service["image"].rsplit(":", 1)[0]
key = repo if repo in tags else repo.split("/")[0]
if key in tags:
print(f" {name}:\n image: {repo}:{tags[key]}")
' "$OPENCTI_VERSION" "$OPENAEV_VERSION" "$XTM_ONE_VERSION" "$OPENCRQ_VERSION")
printf '%s\n' '# Pinned versions: keep this part last, the pinning commands rewrite it' '---' 'services:' "$PINNED" >> docker-compose.override.yml
The --- line starts a second part of the file, which Docker Compose merges like the first. Keep your other changes above the # Pinned versions line: the commands delete everything from that line to the end of the file.
docker compose config --images | grep -E '^(opencti|openaev|xtmone|filigran/opencrq)'
Every image ends with the version you set.
Where the data is
The data of the stack lives in Docker volumes, named after COMPOSE_PROJECT_NAME (xtm in .env.sample). They survive docker compose down and a restart of the host, and only docker compose down -v deletes them.
| Volume | Holds |
|---|---|
xtm_esdata | Elasticsearch: the knowledge of OpenCTI and the indices of OpenAEV |
xtm_pgsqlshareddata | PostgreSQL: the openaev, opencrq and xtm_one databases |
xtm_s3data | RustFS, the S3 object storage: files of OpenCTI, OpenAEV, OpenCRQ and XTM One |
xtm_redisdata | Redis, used by OpenCTI for its event stream and by XTM One |
xtm_amqpdata | RabbitMQ: the messages waiting for the workers and integrations |
xtm_rsakeys | The private key of XTM Composer |
docker volume ls --filter label=com.docker.compose.project=xtm
Back them up together with .env: see Back up and restore.
What's next
- Publish the platforms over HTTPS, to publish the platforms over HTTPS.
- Configure XTM One and Configure OpenCRQ, to finish their setup.
- Connect the modules to each other, to check the links between XTM One, OpenCTI, OpenAEV, OpenCRQ and XTM Composer.
- Sign in the first time and keep an emergency account, before you turn on single sign-on.
- Start the whole stack on an existing deployment, for a deployment that ran only some modules.
- Install offline or with FIPS 140-3, for a host without internet access.