A lightweight command-line interface for Flamingock audit operations in community edition environments.
# Build CLI with distribution
./gradlew :cli:flamingock-cli:build
# Build only (without distribution)
./gradlew :cli:flamingock-cli:classes
# Create uber JAR only
./gradlew :cli:flamingock-cli:uberJar
# Generate distribution only
./gradlew :cli:flamingock-cli:generateDistribution# List conflicted audit entries
./flamingock-cli-dist/flamingock audit list
# Mark change as applied
./flamingock-cli-dist/flamingock audit mark --change-id ch1 --state APPLIED
# Mark change as rolled back
./flamingock-cli-dist/flamingock audit mark --change-id ch2 --state ROLLED_BACK
# Use custom configuration file
./flamingock-cli-dist/flamingock -c /path/to/config.yml audit list
# Show help
./flamingock-cli-dist/flamingock --help
./flamingock-cli-dist/flamingock audit --help
./flamingock-cli-dist/flamingock audit mark --help-
Build entire project (includes CLI):
./gradlew build
-
Distribution is automatically updated in
flamingock-cli-dist/ -
Test your changes:
./flamingock-cli-dist/flamingock --version ./flamingock-cli-dist/flamingock audit list
No manual steps required - everything is automated!
# Quick CLI-only build
./gradlew :cli:flamingock-cli:build
# Clean CLI artifacts
./gradlew :cli:flamingock-cli:clean
# Run CLI directly (without distribution)
./gradlew :cli:flamingock-cli:run --args="audit list"After building, flamingock-cli-dist/ contains:
flamingock-cli.jar- Self-contained executable JAR with all dependenciesflamingock- Unix/Linux/macOS executable shell scriptflamingock.bat- Windows executable batch fileflamingock-cli.yml- Sample configuration file
flamingock:
service-identifier: "flamingock-cli"
audit:
mongodb:
connection-string: "mongodb://localhost:27017"
database: "myapp"flamingock:
service-identifier: "flamingock-cli"
audit:
mongodb:
host: "localhost"
port: 27017
database: "myapp"
username: "user"
password: "pass"flamingock:
service-identifier: "flamingock-cli"
audit:
dynamodb:
region: "us-east-1"
# endpoint: "http://localhost:8000" # Optional for local DynamoDB
# access-key: "your-key" # Optional, uses AWS credential chain
# secret-key: "your-secret" # Optional, uses AWS credential chainflamingock:
service-identifier: "flamingock-cli"
audit:
couchbase:
endpoint: "couchbase://localhost:12110"
username: "your-username"
password: "your-password"
bucket-name: "test"
table: "flamingockAuditLog" # Optional, defaults to "flamingockAuditLog"flamingock:
service-identifier: "flamingock-cli"
audit:
sql:
endpoint: "jdbc:sqlserver://localhost:1433/test-db"
username: "your-username"
password: "your-password"
sql-dialect: "SqlServer"
table: "flamingockAuditLog" # Optional, defaults to "flamingockAuditLog"- Command line argument:
--config /path/to/file.yml - Default:
flamingock-cli.ymlin bin directory
The CLI uses OpsClientBuilder from Flamingock core:
// Create context with dependencies
Context context = new SimpleContext();
context.addDependency(new CommunityConfiguration());
context.addDependency(MongoClient.class, mongoClient);
context.addDependency(MongoDatabase.class, mongoDatabase);
// Build OpsClient
AuditStore<?> auditStore = new MongoDBSyncAuditStore();
OpsClient client = new OpsClientBuilder(coreConfig, context, auditStore).build();
// Use OpsClient methods
client.getConflictedAuditEntries();
client.markAsSuccess(changeId);
client.markAsRolledBack(changeId);- MongoDB: Uses MongoDB Sync driver (not Spring Data)
- DynamoDB: Uses AWS SDK v2
- Couchbase: Uses Couchbase driver v3.7.3
- Auto-detection: Based on YAML configuration structure
- Validation: Connection testing during client creation
- CLI builds its own
Contextwith required dependencies - Database clients are created and injected via
Context.addDependency() - No Spring Boot context loading - lightweight and fast
Lists all conflicted audit entries showing:
- Change ID, execution ID, stage ID
- Author, state, type, class, method
- Execution time, hostname, timestamps
- Error traces (if any)
Marks a change with a specific state:
--state APPLIED- Marks as successfully applied--state ROLLED_BACK- Marks as rolled back--change-id <id>- Required change identifier
- Configuration errors: Missing files, invalid YAML, multiple databases
- Connection errors: Database connectivity, authentication failures
- Validation errors: Missing required fields, invalid change IDs
- Debug mode: Set
flamingock.debugsystem property for stack traces
Uses SLF4J with simple implementation for clean, professional output.
| Task | Description |
|---|---|
:cli:flamingock-cli:build |
Full build with distribution |
:cli:flamingock-cli:uberJar |
Create self-contained JAR only |
:cli:flamingock-cli:generateDistribution |
Generate executable scripts only |
:cli:flamingock-cli:clean |
Remove all CLI artifacts |
The build process automatically:
- Compiles all CLI sources
- Creates UberJar with dependencies
- Generates platform-specific executable scripts
- Sets proper Unix file permissions
- Creates sample configuration file
- Places everything in
flamingock-cli-dist/
When you modify OpsClient, AuditStore, or any core component:
- Run
./gradlew build(builds entire project) - CLI distribution automatically reflects your changes
- Test with
./flamingock-cli-dist/flamingock
This ensures CLI stays synchronized with core development.
The flamingock-cli-dist/ directory is ready for production deployment:
- Copy the entire directory to target system
- Add to PATH (optional):
export PATH=$PATH:/path/to/flamingock-cli-dist
- Use anywhere:
flamingock audit list
Or use directly without PATH modification:
/path/to/flamingock-cli-dist/flamingock audit list