This article explains how to upgrade a Docker Compose installation of Countly Server from 26.01 to 27.0.0. You upgrade directly, with no intermediate version. Version 27 uses a new deployment layout, so this first upgrade includes a one-time step that moves your existing configuration into the new layout. Countly stays in /opt/countly, and later upgrades are simpler.
You need the 27.0.0 release package and access to the Countly image registry. Countly gives you both.
Raise a ticket with our support team here to get the release package and access to the image registry if you don't already have it.
The package also contains the full upgrade guide, docs/compose/upgrade.md, section "First time, from dockerized_deploy". Use it as background, but follow the steps in this article. The guide keeps your settings in /etc/countly. This article keeps them in /opt/countly/customer, so the commands differ.
This upgrade cannot be undone
The upgrade moves ClickHouse to version 26.8. After the new version starts, the only way back is your backup or a disk snapshot.
Before You Start
- Take a backup of MongoDB, ClickHouse, and Kafka. See Backing Up and Restoring Countly on Docker Compose. If your server runs on a virtual machine, a disk snapshot taken just before the switch-over is the quickest way back.
-
Check the server:
- Docker Engine 24 or newer, and Docker Compose v2.24 or newer.
- At least 16 GB of RAM.
-
Enough free disk space: twice the size of the new images on
/, plus twice the size of your largest ClickHouse partition. -
AVX2 support on x86 servers. The command below must print
avx2:grep -o avx2 /proc/cpuinfo | head -1
-
Check registry access. The server downloads the Countly images from
gcr.ioduring the upgrade, so it needs internet access and the registry credentials from Countly. -
Make a list of your own changes to the current installation. The migration
copies your settings file (
.env), certificates, nginx files, and ClickHouse settings. It does not copy:-
Changes made directly in
docker-compose.yml, for example extra ports, extra Kafka listeners, or mail settings. -
Files you added to the
configs/folder.
You re-apply these after the migration.
-
Changes made directly in
-
Check what connects to Countly from outside:
- Tools or scripts that connect directly to ClickHouse need the ClickHouse password from the new settings file.
-
Monitoring or scripts that use container names need an update.
Some names change, for example
countly-apibecomescountly-countly-api-1. -
If you use SSO login, the callback address changes to
/v2/<provider>/callback. Update it in your identity provider.
- Plan a maintenance window. Expect about 15 minutes during which Countly collects no new data.
Preparing the New Version (No Downtime)
-
Unpack the package under
/opt, next to your current installation. Never unpack it inside or over/opt/countly:sudo tar -xzf countly-compose-27.0.0.tar.gz -C /opt
-
Log in to the image registry once:
docker login gcr.io
-
Run the migration script while your current Countly is still running:
cd /opt/countly-compose-27.0.0 sudo COUNTLY_CUSTOMER_DIR=/opt/countly-compose-27.0.0/customer bash scripts/migrate-legacy.sh /opt/countly
The script does not stop anything. It copies your settings, certificates, nginx files, and custom ClickHouse settings into the
customerfolder of the new version. It also downloads the new images and checks the server. It must finish without anyFAILline. - Review the script's report:
- Check any settings that the report lists as needing your decision.
- Re-apply your own nginx edits from
/opt/countly-compose-27.0.0/customer/vhosts.legacy/. - Re-apply the changes from your list (Before You Start, step 4), and copy the files you added to
configs/by hand. - If the report shows
LIVE DATA INSIDE THE LEGACY TREE, note the folders it lists. You need them in step 7.
Switching Over (Downtime Starts Here)
-
Pause the ClickHouse sink, then stop the old installation. If you do not pause the sink, events that wait in Kafka during the switch get the wrong date (
9999-12-31). Never use-v, because it deletes the data volumes:curl -fsS -X PUT localhost:8083/connectors/clickhouse-sink/pause cd /opt/countly sudo make down
You do not need to resume the sink after the upgrade. The new version resumes it when it starts.
-
Rename the old installation and put the new version in its place:
cd /opt sudo mv /opt/countly /opt/countly-legacy sudo mv /opt/countly-compose-27.0.0 /opt/countly
-
If the report in step 4 listed live data inside the legacy tree, move each listed data folder from
/opt/countly-legacyback to the same place under/opt/countly. For example, for a folder listed as/opt/countly/data:sudo mv /opt/countly-legacy/data /opt/countly/data
-
Start the new version:
cd /opt/countly sudo COUNTLY_CUSTOMER_DIR=/opt/countly/customer bash scripts/pre-install.sh sudo make up sudo make verify
The pre-install check must end with
READY. If any step takes much longer than expected, roll back (see the next section) instead of continuing. -
Run the post-install check. It must end with
ALL CHECKS PASSED:sudo COUNTLY_CUSTOMER_DIR=/opt/countly/customer bash scripts/post-install.sh
Then run two more checks. The first checks that no event landed on the date
9999-12-31. Every count must be0:CLICKHOUSE_PASSWORD=$(grep '^CLICKHOUSE_PASSWORD=' /opt/countly/customer/.env | cut -d= -f2-) docker exec countly-clickhouse clickhouse-client --user countly --password "$CLICKHOUSE_PASSWORD" -q " SELECT 'drill_events', count() FROM countly_drill.drill_events WHERE toYear(ts) >= 9999 UNION ALL SELECT 'app_users', count() FROM countly_drill.app_users WHERE toYear(lu) >= 9999 UNION ALL SELECT 'uid_map', count() FROM identity.uid_map WHERE toYear(change_ts) >= 9999"
The second checks that MongoDB, ClickHouse, and Kafka still use your existing data folders:
docker inspect -f '{{.Name}}{{range .Mounts}} {{.Source}}->{{.Destination}}{{end}}' countly-mongodb countly-clickhouse countly-kafkaIf a count is not
0, or a mount source is not your old data folder, stop and contact Countly support. A mount source that changed means that store started empty. - Open the dashboard and check that:
- Your existing data is there.
- New data is arriving.
- Emails, for example email reports, are still sent.
If Something Goes Wrong
-
Before
make uphas run: move any data folders from step 7 back to/opt/countly-legacy. Then swap the folders back and start the old installation:sudo mv /opt/countly /opt/countly-compose-27.0.0 sudo mv /opt/countly-legacy /opt/countly cd /opt/countly && sudo make up curl -fsS -X PUT localhost:8083/connectors/clickhouse-sink/resume
The last command resumes the sink that you paused in step 5. The pause stays after a restart, so you must resume it by hand.
-
After
make uphas run: ClickHouse has already moved to 26.8. The only way back is your backup or disk snapshot.
What to Expect After the Upgrade
- The first start runs all database updates once, so it can take a little longer than usual. This is expected.
- Both the classic and the new dashboard are available on your domain, and each user can switch between them. To keep only the classic dashboard, set
COUNTLY_UI_MODE=disabledin/opt/countly/customer/.env. - Countly runs from
/opt/countly, with your settings in/opt/countly/customer. The old installation is in/opt/countly-legacy. Keep it until you confirm that everything works. - For every later upgrade, run the scripts with
COUNTLY_CUSTOMER_DIR=/opt/countly/customer, as in the steps above. - MongoDB and Kafka stay on their current versions. We recommend that you upgrade them later, one at a time.