Updating TRON.ASOC
We recommend updating TRON.ASOC after a new version is released.
Before updating, be sure to back up the components so you can roll back without data loss if the update fails.
Updating TRON.ASOC consists of 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 discrepancy is allowed. PostgreSQL is the primary data source, so you must keep it as up to date as possible. ClickHouse, in turn, is backed up approximately every 20 minutes, and a minor delay compared to PostgreSQL doesn't affect system operation.
Backing 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. To do this, the system includes a separate Service that creates a backup of the PostgreSQL database and uploads the archive to S3 Storage. This Service connects as a separate component in Docker Compose with a profile and isn't activated by default.
Backing up
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, make them match the values for the other services.
-
Create the
postgres-backupsbucket in S3. To do this:- Go to the MinIO web interface:
http://$ASOC_DOMAIN:9001. - Select Create Bucket.
- Go to the MinIO web interface:
-
Start the backup with the following command:
sudo docker compose --profile backup up --no-deps postgres-backup
Restoring
To restore the PostgreSQL database, follow these steps:
- Stop the
core,reporter, andfrontcontainers with the following command:sudo docker compose stop core reporter front. - Move the archive to the database Container:
sudo docker cp dbasoc-20260403-194144.archive [PostgreSQL_container_ID]:/tmp/restore.archive.
To find the PostgreSQL Container ID, run the following command: sudo docker ps -qf "name=psql".
- Start the database restoration in the Container. To do this:
- Connect to the Container with the following command:
sudo docker exec -ti 15cd460e9c6c /bin/bash; - Make sure 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 the following command:
- Start 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.
Backing up the ClickHouse database (S3 Storage)
Before you begin, 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 consist of the following steps:
- Connect to the Container terminal and start the ClickHouse client
- Create a backup in S3
- Connect to the Container terminal for restoration
- Start database restoration
Connecting to the Container terminal and starting 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 the following command:
kubectl exec -it asoc-clickhouse-<pod_number> -n namespace -- /bin/bash; - If the database is deployed in Docker Compose, run the following command:
docker exec -it tron-clickhouse-<container_number> /bin/bash.
- If the database is deployed in Kubernetes, run the following command:
- Start the ClickHouse client with the following command:
clickhouse-client --database=asoc_db --user=<user> --port=9000 --host=localhost
Creating a backup in S3
These instructions are intended for the built-in S3 Storage that's deployed in your infrastructure when you install TRON.ASOC. If you use external S3 Storage instead, replace the login and token in the command from step 2 with the appropriate credentials from your external S3 Storage.
To create a backup in S3, follow these steps:
- Start the ClickHouse client with the following command:
clickhouse-client --database=asoc_db --user=<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 state of the database is stored in the /var/lib/clickhouse directory.
Connecting to the Container terminal for database restoration
To reconnect to the Container terminal, follow step 1 in the instructions above.
Starting database restoration
To start ClickHouse restoration, follow these steps:
- Start the ClickHouse client with the following command:
clickhouse-client --database=asoc_db --user=<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'
Installing a new version of TRON.ASOC
To install a new version, follow the instructions in Installing with Docker Compose or Installing with a Helm chart.