Updating TRON.ASOC
We recommend updating TRON.ASOC after a new version is released.
Before you update, make backup copies of the components so you can roll back without losing data if the update fails.
The TRON.ASOC update includes the following steps:
- Back up the PostgreSQL database using Docker and MinIO
- Back up the ClickHouse database (S3 Storage)
- Install a new version of TRON.ASOC
The PostgreSQL and ClickHouse databases don't need to be synchronized to the exact second, and some difference is acceptable. PostgreSQL is the primary data source, so you should keep it as up to date as possible. ClickHouse is backed up approximately every 20 minutes, and a slight delay compared to PostgreSQL doesn't affect system operation.
Back up the PostgreSQL database using Docker and MinIO
We recommend using the standard PostgreSQL database backup procedures if your infrastructure provides them. Otherwise, use standard backup Tools adapted for the TRON.ASOC system. TRON.ASOC includes a separate Service that creates a PostgreSQL database backup and uploads the archive to S3 Storage. The Service connects as a separate component in Docker Compose by using a profile and isn't enabled by default.
Back up the database
To back up the PostgreSQL database, follow these steps:
- Add the
postgres-backupService to thedocker-compose.ymlfile:
postgres-backup:
profiles:
- backup
image: harbor.tronsec.ru/asoc/external/minback:v1.4
environment:
- PGHOST=psql
- PGPORT=${ASOC_PG_PORT:-5432}
- PGUSER=${ASOC_PG_USER:-asocusr}
- PGPASSWORD=${ASOC_PG_PASSWORD:-asocpwd}
- PGDATABASE=${ASOC_PG_DBNAME:-dbasoc}
- MINIO_SERVER=http://minio:9000
- MINIO_ACCESS_KEY=${ASOC_MINIO_ROOT_USER:-minioroot}
- MINIO_SECRET_KEY=${ASOC_MINIO_ROOT_PASSWORD:-miniorootpassword}
- MINIO_BUCKET=postgres-backups
- DATE_FORMAT=+%Y%m%d-%H%M%S
command: ${ASOC_PG_DBNAME:-dbasoc} -h psql -p ${ASOC_PG_PORT:-5432} -U ${ASOC_PG_USER:-asocusr}
depends_on:
psql:
condition: service_healthy
minio:
condition: service_started
restart: "no"
The variable values come from docker-compose.yml for TRON.ASOC version 1.4.2. If you use different values, update them to match the values for the other services.
-
Create the
postgres-backupsbucket in S3. To do this:- Open the MinIO web interface:
http://$ASOC_DOMAIN:9001. - Select Create Bucket.
- Open the MinIO web interface:
-
Run the Service backup with this command:
sudo docker compose --profile backup up --no-deps postgres-backup
Restore the database
To restore the PostgreSQL database, follow these steps:
- Stop the
core,reporter, andfrontcontainers with this command:sudo docker compose stop core reporter front. - Move the archive to the database container:
sudo docker cp dbasoc-20260403-194144.archive [ID_контейнера_PostgreSQL]:/tmp/restore.archive.
To find the PostgreSQL container ID, run this command: sudo docker ps -qf "name=psql".
- Restore the database in the container. To do this:
- Connect to the container with this command:
sudo docker exec -ti 15cd460e9c6c /bin/bash. - Verify that the backup archive is in the
/tmpdirectory:ls -lh /tmp. - Delete the old database:
psql -U postgres -c "DROP DATABASE IF EXISTS dbasoc;". - Create a new database owned by
asocusr:psql -U postgres -c "CREATE DATABASE dbasoc OWNER asocusr;". - Restore the archive as the
asocusruser:pg_restore -U asocusr -d dbasoc -v /tmp/restore.archive. - Connect to the database and verify that it contains data:
psql -U asocusr -d dbasoc -> select * from users;.
- Connect to the container with this command:
- Restart the
coreandreporterservices:sudo docker compose restart core reporter front. - View the Service logs:
sudo docker ps -qf "name=core"
sudo docker logs <id контейнера core>
Example of a successful log:
2026-04-03T20:12:28.982+0000 [INFO][core][http][server][listen][url::8080] start listening
- Sign in to the web interface and verify that the data is available.
Back up the ClickHouse database (S3 Storage)
Before you start, stop the core, reporter, and front containers that interact with the ClickHouse container.
You don't need to stop the ClickHouse container. If you stop it, the backup might fail.
ClickHouse database migration and backup include the following steps:
- Connect to the container terminal and start the ClickHouse client
- Create a backup in S3
- Connect to the container terminal to restore the database
- Start the database restoration
Connect to the container terminal and start the ClickHouse client
To connect to the container terminal and start the ClickHouse client, follow these steps:
- Run the command for connecting to the terminal based on where ClickHouse is deployed:
- If the database is deployed in Kubernetes, run this command:
kubectl exec -it asoc-clickhouse-<номер_пода> -n namespace -- /bin/bash. - If the database is deployed in Docker Compose, run this command:
docker exec -it tron-clickhouse-<номер_контейнера> /bin/bash.
- If the database is deployed in Kubernetes, run this command:
- Start the ClickHouse client with this command:
clickhouse-client --database=asoc_db --user=<пользователь> --port=9000 --host=localhost
Create a backup in S3
These instructions assume that you use the built-in S3 Storage deployed in your infrastructure when you install TRON.ASOC. If you use external S3 Storage instead, replace the login and token in the command in step 2 with the corresponding credentials from your external S3 Storage.
To create a backup in S3, follow these steps:
- Start the ClickHouse client with this command:
clickhouse-client --database=asoc_db --user=<пользователь> --port=9000 --host=localhost - Enter the following SQL query:
BACKUP DATABASE asoc_db TO S3(
'https://URL_Вашего_S3/clickhouse-asoc/asoc_db_test_1.zip',
'ПОЛЬЗОВАТЕЛЬ_S3',
'ТОКЕН_S3'
)
SETTINGS compression_method='zstd', compression_level=3;
The current database state is stored in the /var/lib/clickhouse directory.
Connect to the container terminal to restore the database
To reconnect to the container terminal, follow step 1 in the instructions above.
Start the database restoration
To restore ClickHouse, follow these steps:
- Start the ClickHouse client with this command:
clickhouse-client --database=asoc_db --user=<пользователь> --port=9000 --host=localhost - Delete the old database:
DROP DATABASE - Restore the database:
RESTORE DATABASE asoc_db FROM S3(
'https://URL_Вашего_S3/clickhouse-asoc/asoc_db_test_1.zip',
'ПОЛЬЗОВАТЕЛЬ_S3',
'ТОКЕН_S3'
Install a new version of TRON.ASOC
To install a new version, follow the instructions in Install with Docker Compose or Install with Helm Chart.