Part 5 of TAK: From Two Phones to a Global Platform

Your First TAK Server, in Docker Compose

For four articles, we’ve managed without a server. Two phones found each other on Wi-Fi, a Python script put a truck on the map, and nobody installed anything heavier than an app.

That’s no accident. A lot of TAK work never needs a server, and I wanted you to know that before we add one. But the mesh has limits, and you’ve already found most of them. It stops at the edge of the local network. It forgets everything when a device goes quiet. And anyone on the network can join, listen, or put a hostile truck on your map.

A server adds persistent storage, authenticated connections and control over who receives data. We’ll configure one locally, then start it with Docker Compose.

What a server adds

Mesh, from article 2With a server
ReachOnly devices on the same local networkAnyone who can reach the server, from any network
HistoryGone when the sender goes quietStored, so late joiners can catch up
Who can joinAnyone on the networkOnly devices with a valid certificate
Who sees whatEveryone sees everythingGroups decide what each person can see
Sharing filesSmall items, device to deviceData packages, missions and data sync
Connecting to othersNot possibleFederation with other servers

Every client keeps a single connection open to the server, instead of shouting into the room. The server decides who receives what.

When you don’t need one

If your whole team works in one place, on one network you control, and you don’t need history or access control, the mesh is simpler and has fewer moving parts. Don’t add a server just because you can.

What’s inside TAK Server

TAK Server isn’t a single program. It’s several Java services sharing one database:

PartWhat it does
MessagingHolds the connections from clients and routes their messages
APIServes the web admin page, and the interface other programs use to talk to the server
ConfigHolds the server’s configuration and shares it with the other services
Plugin managerRuns server plugins
RetentionCleans up old data on a schedule
PostgreSQL with PostGISThe database. It stores messages, missions and files. PostGIS adds map-aware searches, like “everything within 5 km”

Clients reach the server through network ports. These are the three we’ll open. TLS means the connection is encrypted:

PortUsed for
8089Clients streaming CoT, over TLS
8443The web admin interface and API, over TLS with a client certificate
8446Certificate enrollment, so devices can request their own certificates

All of that is configured in one file, CoreConfig.xml. We’ll have a look at it once the server is running.

A quick Docker primer

We’ll run TAK Server with Docker, which packages software so that it runs the same way on any machine. If you haven’t used it before, you only need four ideas:

TermWhat it means
ImageA packaged copy of a program and everything it needs, ready to run
ContainerA running copy of an image. You can start, stop and delete it without touching the rest of your computer
VolumeStorage that survives when a container is deleted. Our certificates and database live in volumes
ComposeA tool that starts several containers together, in the right order, from one file called compose.yaml

TAK Server needs three containers: the server, its database, and a short-lived one that creates certificates. Compose starts all three for us.

Three ways to get TAK Server

OptionYou needRuns onBest for
1. Build from the tak.gov releaseA tak.gov accountIntel and ARMMost people, and the rest of this series
2. Pull from Docker HubNothing extraIntel onlyThe fastest start on an Intel machine
3. Build from sourceAn Iron Bank account, or your own base imagesIntel, as shippedDevelopers who want to change the code

This series uses option 1 from here on. It runs natively on both Intel and ARM machines, including Apple Silicon Macs, and everything in later articles builds on it.

The TAK Product Center publishes ready-made images on Docker Hub, Docker’s public image library, under takproductcenter. They’re built for Intel processors only. On an ARM machine, such as an Apple Silicon Mac, Docker can still run them by translating them as they go, but they run noticeably slower. If you’re on Intel and want to skip the build, they’re a fine shortcut, and our setup supports them with one extra flag.

What about building from source?

TAK Server’s source code is on GitHub under the GPL-3.0 license, and you can build it yourself without a tak.gov account. There are two catches.

First, the public repository trails the official releases. At the time of writing, GitHub’s latest version is 5.7, while tak.gov and Docker Hub have 5.8.

Second, the source version’s image recipes pull their base images from Iron Bank, the US Department of Defense’s container registry, which needs its own account. You can edit the recipes to use public equivalents instead, but those modified images fall outside the setup covered here.

So building from source is a great way to explore and change the code, but it isn’t the quickest way to a running server. We’ll stick with the release.

What you’ll need

  • Docker with Compose, with at least 8 GB of memory available to it (how to install)
  • The TAK Server release: takserver-docker-hardened-<version>.zip from tak.gov (how to download), unless you’re using option 2
  • One or two devices with ATAK-CIV, from the second article, on the same Wi-Fi as your computer
  • Git, to download our repo, tak-stack. macOS and most Linux systems already have it
  • A terminal: Terminal on macOS, or your usual shell on Linux. Every command in this article runs there
  • About 15 minutes

Driven by configuration

Before TAK Server will talk to anyone, it needs certificates: digital ID cards for the server and for each user. They’re issued by a certificate authority, or CA, which is simply the thing that vouches for them. The next article explains how this works. For now, all you need to know is that we need a CA and a handful of certificates.

This setup automates certificate creation, configuration and admin registration from two configuration files:

FileWhat it holdsCommit it?
config/takserver.envYour certificate authority’s details, your server’s addresses and your usersYes
config/secrets.envPasswords, generated for youNever

Each time you start TAK Server with Compose, the three containers run in order:

  1. tak-certs creates any certificates that don’t exist yet, then exits.
  2. tak-database creates its database if needed, then starts.
  3. takserver builds its configuration from your settings, starts, and registers the admin certificate.

Existing certificates are reused; missing ones are created. The server configuration is generated on each start. To add an enrolling user, add their name to USERS, run ./setup.sh to generate their password, then run docker compose up -d. Their device requests its certificate when they enroll.

Step 1: Get the code

Open a terminal. Download our repo, then move into the folder for this article:

git clone https://github.com/NorthXLabs/tak-stack.git
cd tak-stack/compose/takserver

git clone copies the repo to your computer, and cd moves you into the folder. Run the rest of the commands in this article from here.

This folder holds everything except TAK Server itself: the Compose file, the configuration and the start-up scripts.

Step 2: Add the TAK Server release

The release zip you downloaded from tak.gov is the other half. Inside it are two folders:

  • docker holds the recipes for building the three images: the server, its database and the certificate tool.
  • tak is TAK Server itself: the server, its tools and its default configuration.

Our Compose file builds its images from these, so it expects to find them in a folder called release. Unzip the release somewhere temporary, then copy its contents across. Adjust the first path to wherever you saved the zip:

unzip ~/Downloads/takserver-docker-hardened-5.8-RELEASE-92.zip -d /tmp/tak-release
cp -R /tmp/tak-release/takserver-docker-hardened-5.8-RELEASE-92/. release/
ls release
README.md  docker  tak

The release stays on your machine. It isn’t part of the tak-stack repo, and git ignores everything in release/ except that README, so you won’t commit it by accident. Everyone downloads their own copy from tak.gov.

You don’t need to tell anything which version you have. The setup reads it from the release in the next step.

If you’re using the Docker Hub images instead, skip this step entirely.

Step 3: Make it yours

Next, set the details your certificates will carry. They’re in config/takserver.env, a plain text file you can find in your file browser, inside the config folder. Open it in any text editor:

Developers have argued about the best text editor for decades. You don’t need to pick a side. Anything that saves plain text is fine.

# Certificate authority: who issues your certificates
CA_NAME=TAK-STACK-CA
COUNTRY=CA
STATE=AB
CITY=Calgary
ORGANIZATION=TAKStack
ORGANIZATIONAL_UNIT=Lab

# Every address that devices use to reach this server: IP addresses and
# hostnames, separated by spaces.
SERVER_ADDRESSES=localhost

# The admin certificate, used to manage the server from a browser.
ADMIN_CERT_NAME=admin

# Users who connect by enrolling: they sign in with a username and password,
# and the server issues their certificate. setup.sh creates their passwords.
USERS=alpha-1 bravo-1

# Optional: certificates to create in advance, for devices that can't enroll.
CLIENT_CERTS=

Change the certificate authority details to your own. They end up inside every certificate you issue, so pick a name you’ll recognise:

  • CA_NAME: a name for your CA, with no spaces
  • COUNTRY: a two-letter country code, such as CA or US
  • STATE and CITY: your province or state, and your city
  • ORGANIZATION and ORGANIZATIONAL_UNIT: your organisation, and a team or department within it

Next, add your computer’s address to SERVER_ADDRESSES, so that it reads something like SERVER_ADDRESSES=localhost 192.168.1.50. (How to find it.) Your devices will connect to that address, and the server’s certificate has to name it, or ATAK refuses to connect. We’ll come back to why.

Leave the rest as it is. admin is the certificate you’ll use to manage the server, and alpha-1 and bravo-1 are the two users your devices will sign in as. CLIENT_CERTS stays empty for now, and we’ll come back to it at the end of the article.

You can leave the CA’s location and organisation details at their defaults; your certificates will just say Calgary. You still need to add the address your devices will use to SERVER_ADDRESSES.

Then run the setup script:

./setup.sh
Passwords:   created config/secrets.env
Passwords:   created a password for alpha-1
Passwords:   created a password for bravo-1
Release:     found TAK Server 5.8-RELEASE-92 in release/
Version:     TAK_VERSION=5.8-RELEASE-92

Ready. Start TAK Server with:
  docker compose up -d --build

The ./ tells your terminal to run the script in the current folder. If you get Permission denied, run bash setup.sh instead.

It does two jobs. It creates config/secrets.env with a random password for the database, the certificate authority, each certificate and each user. And it reads your TAK Server version from the release, then writes it to a small file called .env, which Compose uses to name the images.

You can run it as often as you like. It never changes your passwords once they exist, so it can’t break certificates that already use them. If you skip it, Compose stops straight away and tells you to run it.

secrets.env never ends up in git. The folder’s .gitignore file tells git to leave it out, so it won’t appear in git status and can’t be committed by accident.

New to git? .gitignore lists files that git should pretend don’t exist. You can check that a file is ignored with git check-ignore -v config/secrets.env. If it prints the matching .gitignore rule, you’re covered. If it prints nothing, git can see the file, so don’t commit until you’ve fixed that.

Step 4: Start it

Now start everything:

docker compose up -d --build

Here’s what that does:

  • up creates and starts the containers described in compose.yaml.
  • -d runs them in the background, so you get your terminal back.
  • --build builds the images from the release first.

The first run builds three images. Build and start-up times depend on your machine and download speeds. On later starts, you can leave out --build unless you’ve changed the image recipes or release files.

If you’re using option 2, run this instead:

docker compose -f compose.yaml -f compose.dockerhub.yaml up -d

Give it a minute, then check on it:

docker compose ps
SERVICE        IMAGE                                   STATUS
tak-certs      tak-stack/takserver-ca:5.8-RELEASE-92   Exited (0) 26 seconds ago
tak-database   tak-stack/takserver-db:5.8-RELEASE-92   Up 29 seconds (healthy)
takserver      tak-stack/takserver:5.8-RELEASE-92      Up 24 seconds (healthy)

tak-certs has done its job and exited. Exited (0) means it finished successfully, which is exactly what it should do. The other two say healthy, which means the database accepts connections and the server is answering requests.

If takserver says health: starting, it’s still starting up. Wait a minute and run docker compose ps again.

Step 5: Look around

Let’s see what was created. These commands look inside the running containers.

Your certificates

docker compose logs shows what a container printed while it ran:

docker compose logs tak-certs
Creating root CA: TAK-STACK-CA
Creating intermediate signing CA
Creating server certificate for: takserver localhost 192.168.1.50
Creating client certificate: admin
Revocation lists updated: 0 revoked
Trusted CAs: TAK-STACK-CA intermediate
Certificates ready

You now have your own certificate authority, a certificate for the server, and one for you as the admin. There’s nothing for alpha-1 and bravo-1 yet, and that’s deliberate: their devices will request their own certificates later in this article. Stop and start everything again with docker compose down and then docker compose up -d, and the same log says Root CA exists, Certificate exists: takserver and so on, because nothing needed doing.

The certificates live in a Docker volume, so you won’t find them in your folder. docker compose exec runs a command inside a container, so we can list them from there:

docker compose exec takserver ls /opt/tak/certs/files

There are a lot of files, in several formats. We’ll sort out which ones matter shortly.

The configuration

docker compose exec takserver cat /opt/tak/CoreConfig.xml

This is CoreConfig.xml, and you’ll get to know it well over this series. Near the top, you’ll find the inputs and ports from the table earlier:

<input _name="stdssl" protocol="tls" port="8089" coreVersion="2"/>
<connector port="8443" _name="https"/>
<connector port="8446" clientAuth="false" _name="cert_https"/>

Further down, the database connection and the certificate passwords hold the values from your secrets.env. The setup writes this file on every start, so make changes in your configuration rather than here.

The logs

To watch the server’s log as it happens, add -f, for follow:

docker compose logs -f takserver

Press Ctrl+C to stop watching. That only stops the log display, and the server keeps running.

Each part of TAK Server also writes its own log file:

docker compose exec takserver ls /opt/tak/logs

takserver-messaging.log is the one to watch when clients connect, and takserver-api.log covers the web interface.

You’ll also find a line in the database log that looks alarming on a restart: Database 'cot' already exists followed by Aborting. That’s a setup step noticing the database is already there, and skipping itself. It’s harmless.

Step 6: Try to connect

Open a browser and go to https://localhost:8443. You’ll get an error page instead of the admin interface.

A terminal is more honest about why. openssl s_client opens an encrypted connection and reports what happens. Here it is against port 8089, the one your phone would use:

openssl s_client -connect localhost:8089
depth=2 C=CA, ST=AB, L=Calgary, O=TAKStack, OU=Lab, CN=TAK-STACK-CA
verify error:num=19:self-signed certificate in certificate chain
error:0A00045C:SSL routines:ssl3_read_bytes:tlsv13 alert certificate required

Look for certificate required near the end. On a Mac, the built-in openssl reports the same refusal as a code instead: reason(1116).

Two things happened there. The server showed us its certificate, issued by the CA we just created, which our computer has never heard of. Then it hung up, with a message that says it all: certificate required.

The server is fine. It’s doing exactly what it should. Every one of those connections was refused because the client couldn’t prove who it was. On the mesh, anyone could join. Here, nobody gets in, not even to the admin page, until they hold a certificate the server trusts.

So let’s hand some out.

How TAK decides who to trust

TAK Server runs on mutual TLS. Your bank’s website proves its identity to your browser, but you never prove yours with a certificate. Here, both sides do. The server shows its certificate, the client shows its own, and each checks the other against a certificate authority it already trusts. Port 8446 is the one exception, because it’s where a device goes to get a certificate in the first place.

The chain we built

CertificateSigned byLastsJob
Root CA (TAK-STACK-CA)Itself10 yearsThe anchor everything else traces back to
Intermediate CAThe root2 yearsSigns every other certificate, day to day
Server certificateThe intermediate2 yearsProves the server is who it says it is
Admin certificateThe intermediate2 yearsYour key to the admin console
Device certificatesThe intermediate1 yearOne per enrolled device

Why bother with an intermediate? It means the root’s private key barely needs to be touched. In a real deployment, you’d take it offline altogether. If the intermediate is ever compromised, you replace it with a new one signed by the same root, instead of starting the whole chain again.

Which file does what

Most of the files in certs/files are the same certificates in different packaging:

FormatWhat’s insideWho uses it
.pemOne or more certificates as textPeople, and tools like openssl
.keyA private keyThe thing it identifies, and nobody else
.p12A certificate and its private key, behind a passwordDevices and browsers
.jksThe same thing, in Java’s keystore formatTAK Server
truststore-*CA certificates only, with no private keysAnything deciding whom to trust
.crlA list of revoked certificatesThe server, when deciding whom to refuse

Two pairs matter most. The server holds takserver.jks, its identity, and truststore-active.jks, the CAs whose certificates it accepts. A device holds its own .p12 and a truststore containing the same CAs. Everything else supports those four.

Three certificate settings to check

The server certificate must name every address clients use. ATAK checks that the certificate matches the address it dialled. Out of the box, TAK Server’s certificate names only takserver, so a device connecting by IP address fails before it even asks. That’s what SERVER_ADDRESSES fixes. If your computer’s address changes, update it and run docker compose up -d, and the setup reissues just the server certificate.

Both sides must trust the intermediate, not just the root. Devices don’t always send the intermediate along with their own certificate, so a server that trusts only the root rejects them with peer not verified. Our setup gives the server and the devices truststore-active, which holds both CAs.

ATAK keeps trust per connection. A truststore applied to the whole app isn’t the one ATAK uses when it enrolls with a particular server. Our data packages attach it to the connection itself.

Get any of these wrong, and you’ll see vague errors like Registration failed or a connection that drops as soon as it opens. The setup handles all three, so you shouldn’t hit them.

Step 7: Open the admin console

Your admin certificate is your way into the web interface. Copy it out of the container:

docker compose cp takserver:/opt/tak/certs/files/admin.p12 .

Then add it to your browser. Its password is ADMIN_CERT_PASS in config/secrets.env.

Now go to https://localhost:8443. Your browser asks which certificate to use, so pick the admin one. You’ll also see a warning about the server’s certificate, because your browser doesn’t know our CA. That’s expected here, and you can continue past it.

Next comes a notice that the software is approved for public release. Click OK, and you land on the Metrics Dashboard:

TAK Server's Metrics Dashboard, showing the server version, uptime, connected clients, disk usage and CPU usage.

It’s a quick health check: the version you’re running, how long it’s been up, how many devices are connected, and how hard it’s working. Yours shows 0 clients for now. This screenshot was taken once both devices had joined, later in the article.

Everything else is in the menu, behind the ☰ at the top right:

The admin console menu, with Monitoring expanded to show Alarms, Metrics Dashboard and Client Dashboard.

Three pages are worth knowing from day one:

PageWhereWhat it’s for
Client DashboardMonitoringWho’s connected right now, and from where
Manage UsersAdministrativeThe users the server knows about, and their groups
Client CertificatesAdministrativeEvery certificate the server has issued, with buttons to revoke them

Open Manage Users, and you’ll find the users from your configuration already there:

The Manage Users page, listing admin, alpha-1 and bravo-1, with a single group called ANON.

The setup created admin, alpha-1 and bravo-1 for you. Each one is in __ANON__, the default group, so they can all see each other. You could add users here by hand, but anything you add this way isn’t in your configuration, so a clean start would lose it. Keep USERS as the source of truth.

admin.p12 is a key to your server, so delete the copy from your folder once it’s in your browser.

Step 8: Connect your devices

This is where alpha-1 and bravo-1 come in. You could make each user a certificate and hand it over, but that means sending a private key and its password around for every person. TAK has a better way: certificate enrollment.

The device signs in to port 8446 with a username and password. It generates its own private key, which never leaves the device, and asks the server to sign a certificate for it. The server checks the password, signs the certificate with the intermediate CA, and hands it back. From then on, the device connects with its certificate, like everything else.

There’s one catch. Before a device will send its password, it needs to trust the server, and phones don’t know our CA. So we give them a small data package: a zip that ATAK imports, containing the server’s address and our CA certificates. It holds no passwords and no private keys, so you can share the same one with your whole team.

Make one, using the address you added to SERVER_ADDRESSES:

./make-datapackage.sh 192.168.1.50
Created datapackages/enroll-192.168.1.50.zip
Share it with your team. Each person signs in with their own username and password.

Copy the zip to your device, for example by emailing it to yourself or using a USB cable. Then, in ATAK, import it:

ATAK's import screen, showing the enrollment package in the Download folder.

ATAK reads the package, sets up the server connection, and asks for credentials:

ATAK asking for a username and password for the TAK Server connection.

Sign in as alpha-1, using USER_PASS_ALPHA_1 from config/secrets.env. After a few seconds, the server icon at the bottom right of the map turns green. You can check the connection under TAK Servers:

ATAK's TAK Servers list, showing a connected server with a green status and version 5.8.

Do the same on your second device as bravo-1. Now look at the map:

BRAVO-1's map showing ALPHA-1 through the server, with a green server status and ALPHA-1 in the contacts list.

That’s ALPHA-1 on the map. Both devices are still on the same Wi-Fi, so multicast may also be carrying their positions. The map alone doesn’t establish which path delivered an update. Back in the admin console, the Client Dashboard confirms that both devices have server connections:

The Client Dashboard listing ALPHA-1 and BRAVO-1 with green health, their usernames, certificate names, team colours and ATAK version.

Both devices are there. The health light shows how recently each one reported: green within the last 10 seconds, yellow within 3 minutes, and red after that. A phone sitting still reports less often, so yellow is normal for a device on your desk. Look at the DN column: CN=alpha-1 and CN=bravo-1 are the names inside the certificates the devices just enrolled for. The server knows who each device is from its certificate, not from what it calls itself.

Under Client Certificates, you’ll find those two certificates, issued a minute ago and valid for a year:

The Client Certificates page, listing one certificate each for alpha-1 and bravo-1, with issue and expiry dates and Revoke links.

Notice the Revoke link at the end of each row. That’s what you’ll reach for when a phone goes missing.

To test the server path separately, put the devices on separate local networks that both have a route to the server, without multicast forwarding between them. Confirm that both server connections are active, then move one device and check for fresh position updates on the other. That test requires network routing beyond the single-Wi-Fi setup used here.

Server connections don’t require multicast. Devices on other networks can connect if they can reach the server’s address and authenticate. In this walkthrough, we’ve only arranged access from your local network.

Certificates made in advance

Enrollment covers people with a device and a password. CLIENT_CERTS covers everything else. Each name in it gets a certificate made on the server, which you hand over in a .p12 file. Use it for:

  • Devices that can’t reach port 8446, or that need setting up before they leave for somewhere with no connection
  • Things that aren’t people: a data feed, a sensor gateway, or a script like the truck from the third article, sending over TLS instead of multicast

The names don’t need to be in USERS, because there’s no password to sign in with. The certificate is the identity.

To create one, add the name and restart:

CLIENT_CERTS=sensor-1 field-laptop-3
docker compose up -d

For an ATAK device, package the certificate with the server’s address:

./make-datapackage.sh --with-cert field-laptop-3 192.168.1.50

For anything else, copy the .p12 file out, in the same way as the admin certificate.

How it differs from enrollment:

EnrollmentMade in advance
Where the private key is generatedOn the device, and it never leavesOn the server, then copied to the device
PasswordEach user has their ownAll share CLIENT_CERT_PASS
Lasts1 year2 years
Best forPeopleDevices that can’t enroll, and services

Treat these files with care. Each one holds a private key and the password to open it, so send it only to where it’s needed, and delete your copy afterwards.

Taking a name out of CLIENT_CERTS doesn’t take the certificate away. It stops the setup from making a new one, but the existing certificate stays valid until you revoke it.

What you’ve built

You’re running TAK Server with its own certificate authority, an admin console, and two enrolled devices connected to it. With the release and configuration files in place, Compose can recreate the containers. Keep the volumes to preserve your database and certificate authority.

Adding a user takes three steps: add a name to USERS, run ./setup.sh, then docker compose up -d. They import the same data package and sign in with their own password.

When you’re done for now, docker compose down stops everything and keeps your data. docker compose down -v deletes everything, including your certificate authority, so only use it when you want a clean start.

Next up: a phone goes missing. What does it take to lock it out?