Skip to content

Deployment and Maintenance / Admin Tool

This article mainly describes how to use the Admin Tool to maintain DataFlux Func.

1. Admin Tool admin-tool.py

DataFlux Func provides an Admin Tool to make it easier to perform emergency maintenance work.

The Admin Tool is bundled in the container and must be run using Docker exec. You can use --help to view the specific usage:

Bash
1
docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py --help'
Text Only
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
usage: admin-tool.py [-h] [-f] [--admin-username ADMIN_USERNAME] [--admin-password ADMIN_PASSWORD] <Command>

+--------------------------+
| DataFlux Func Admin Tool |
+--------------------------+
This tool should run in the Docker container:
    $ docker exec {DataFlux Func Container ID} sh -c 'exec python admin-tool.py --help'
    $ docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py reset_admin [-f] [--admin-username=<Admin Username>] [--admin-password=<Password>]'
    $ docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py reset_upgrade_db_seq [-f]'
    $ docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py disable_ip_address_filter [-f]'
    $ docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py clear_redis [-f]'

positional arguments:
  <Command>             reset_admin, reset_upgrade_db_seq, disable_ip_address_filter, clear_redis, run_sql, call_api

options:
  -h, --help            show this help message and exit
  -f, --force           Force run, no confirm
  --admin-username ADMIN_USERNAME
                        Admin Username
  --admin-password ADMIN_PASSWORD
                        Admin Password

1.1 Reset Admin Password

Passwords of regular users can be reset directly by the system administrator. However, if the system administrator's own password is forgotten, it needs to be reset using the Admin Tool bundled with DataFlux Func.

For details, please refer to Deployment and Maintenance / Admin Tool

1.2 Reset Database Upgrade Sequence Number

During installation/upgrade, DataFlux Func automatically updates the database structure and records the current database structure version sequence number.

Under certain circumstances, if this sequence number is incorrect, the system cannot start normally. In this case, use the Admin Tool to correct it.

If you do not know what this is, please consult the official team before performing the operation

The specific commands are as follows:

  • Outside the container
Bash
1
docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py reset_upgrade_db_seq'
  • Inside the container
Bash
1
cd /usr/src/app; python admin-tool.py reset_upgrade_db_seq

1.3 Disable IP Address Filtering

If you have configured System Settings / IP Address Filtering incorrectly, you will be unable to access DataFlux Func.

You can use the following command to directly disable the IP address filtering function.

The specific commands are as follows:

  • Outside the container
Bash
1
docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py disable_ip_address_filter'
  • Or inside the container
Bash
1
cd /usr/src/app; python admin-tool.py disable_ip_address_filter

1.4 Clear Redis

If the queue is blocked and needs immediate recovery, or if unreasonable Script logic causes the cache to become too large, DataFlux Func may become inoperable.

You can use the following command to clear the Redis database.

Clearing Redis will not cause problems for DataFlux Func itself. However, running business code may depend on data in Redis. Please be sure to confirm before proceeding

The specific commands are as follows:

  • Outside the container
Bash
1
docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tool.py clear_redis'
  • Or inside the container
Bash
1
cd /usr/src/app; python admin-tool.py clear_redis

2. Interactive Admin Tool admin-tui.py

Run the interactive tool in the container to view business resources and use the database management entry point:

Bash
1
docker exec -it {DataFlux Func Container ID} sh -c 'exec python admin-tui.py'
Entry Function
DB Tables View MySQL or PostgreSQL table data and structure
DB Upgrades View upgrade items in descending order by sequence, preview SQL for the corresponding database engine

Use arrow keys and Enter to select items, PgUp and PgDn to flip pages, and numbers 1 to 9 and 0 to select rows 1 to 10 on the current page. The database tools use the local database configuration and are not affected by --base-url.

In DB Upgrades, press S to directly modify the database upgrade sequence number; after previewing the SQL, press X and confirm to manually execute the selected upgrade item. After successful execution, you can fill in a new upgrade sequence number; leave it blank to keep the original value.

Confirm the database status and back it up before manual upgrades

Manual execution does not acquire the automatic upgrade lock and should not be performed concurrently with automatic upgrades. MySQL DDL may commit immediately, and on failure, previously executed parts may remain; modifying the upgrade sequence number itself does not execute SQL, so ensure the sequence number matches the actual structure.

3. Operating Redis Directly

If you need to operate Redis directly, you can directly enter the Redis terminal to perform operations.

The specific commands are as follows:

Bash
1
docker exec -it {Redis Container ID} sh -c 'exec redis-cli -n 5'

DataFlux Func uses Redis database 5 by default