VerityLayer Quick Reference Guide
Common Commands
Organization Management
Create Organization:
``bash
php admin/create_organization.php \
--name="Acme Corp" \
--email="admin@acme.com" \
--plan="professional" \
--max-users=50
`
List Organizations:
`bash
php admin/list_organizations.php
`
Update Subscription:
`bash
php admin/update_subscription.php \
--org-id=1 \
--plan="enterprise" \
--status="active" \
--max-users=100
`
---
Tenant Database Management
Provision Tenant DB (Managed):
`bash
php tenant-db-setup/setup_wizard.php --scenario=managed --org-id=1
`
Provision Tenant DB (Customer Cloud):
`bash
php tenant-db-setup/setup_wizard.php --scenario=customer_cloud --org-id=1
`
Test Connection:
`bash
Single org
php tenant-db-setup/test_connection.php --org-id=1 --verbose
All orgs
php tenant-db-setup/test_connection.php --all-orgs
`
Batch Provision:
`bash
All orgs without tenant DBs
php admin/batch_provision.php --all
Specific orgs
php admin/batch_provision.php --org-ids=1,2,3
`
---
Data Migration
Dry Run:
`bash
php admin/migrate_org_data.php --org-id=1 --dry-run
`
Migrate All Data:
`bash
php admin/migrate_org_data.php --org-id=1
`
Migrate Specific Tables:
`bash
php admin/migrate_org_data.php --org-id=1 --tables=risk_register,vulnerabilities
`
Verify Migration:
`bash
php admin/verify_migration.php --org-id=1 --detailed
`
Delete After Migration:
`bash
php admin/migrate_org_data.php --org-id=1 --delete-after
`
---
User Management
Add User:
`bash
php admin/add_user.php \
--org-id=1 \
--name="John Doe" \
--email="john@acme.com" \
--type="org_admin" \
--password="TempPass123!"
`
Reset Password:
`bash
php admin/reset_password.php --email="user@example.com"
`
List Users:
`bash
php admin/list_users.php --org-id=1
`
---
Backup & Restore
Backup Central DB:
`bash
mysqldump -u veritylayer -p veritylayer_saas > backup_central_$(date +%Y%m%d).sql
`
Backup Tenant DB:
`bash
mysqldump -u org_1_user -p org_1_db > backup_org_1_$(date +%Y%m%d).sql
`
Backup All Tenants:
`bash
php admin/backup_all_tenants.php --output-dir=/backups/
`
Restore Central DB:
`bash
mysql -u veritylayer -p veritylayer_saas < backup_central_20260104.sql
`
Restore Tenant DB:
`bash
mysql -u org_1_user -p org_1_db < backup_org_1_20260104.sql
`
---
Health & Monitoring
System Health Check:
`bash
php admin/health_check.php
`
Check All Connections:
`bash
php tenant-db-setup/test_connection.php --all-orgs
`
View Logs:
`bash
Application logs
tail -f logs/application.log
Error logs
tail -f logs/error.log
Tenant setup logs
tail -f logs/tenant-db-setup.log
`
---
Configuration
Enable Multi-Tenant Mode:
`php
// In includes/config.php
define('TENANT_DB_MIGRATION', true);
`
Disable Multi-Tenant Mode:
`php
// In includes/config.php
define('TENANT_DB_MIGRATION', false);
`
Generate Encryption Key:
`bash
php -r "echo bin2hex(random_bytes(32));"
`
---
Database Queries
Check Tenant Connections:
`sql
SELECT org_id, db_host, db_name, health_status, is_active
FROM org_db_connections;
`
Check Connection Health:
`sql
SELECT org_id, health_status, last_health_check
FROM org_db_connections
WHERE health_status != 'healthy';
`
View Audit Trail:
`sql
SELECT * FROM org_db_connections_audit
WHERE created_at > DATE_SUB(NOW(), INTERVAL 24 HOUR)
ORDER BY created_at DESC;
`
Check Organization Status:
`sql
SELECT org_id, org_name, subscription_status, subscription_plan
FROM organizations
WHERE is_active = 1;
`
---
Troubleshooting
Connection Test Failed:
`bash
Detailed test
php tenant-db-setup/test_connection.php --org-id=1 --verbose
Re-provision if needed
php tenant-db-setup/setup_wizard.php --org-id=1
`
Login Issues:
`bash
Reset password
php admin/reset_password.php --email="user@example.com"
Check user status
mysql -u veritylayer -p veritylayer_saas
SELECT * FROM users WHERE email = 'user@example.com';
`
Performance Issues:
`sql
-- Check slow queries
SHOW STATUS LIKE 'Slow_queries';
-- Check processlist
SHOW PROCESSLIST;
-- Increase connection pool
UPDATE org_db_connections
SET connection_pool_size = 20
WHERE org_id = 1;
`
Clear Cache:
`bash
php admin/clear_cache.php
`
---
Maintenance
Update Application:
`bash
1. Backup
php admin/backup_all.php
2. Download update
wget https://updates.veritylayer.com/v1.1.0.zip
3. Extract
unzip -o v1.1.0.zip
4. Run migrations
php database/migrate.php
5. Clear cache
php admin/clear_cache.php
`
Optimize Database:
`bash
mysqlcheck -u veritylayer -p --optimize --all-databases
`
Rotate Logs:
`bash
php admin/rotate_logs.php
`
---
File Locations
Configuration:
includes/config.php - Main configuration
db_connect.php - Database connection
.htaccess - Apache configuration
Tools:
admin/ - Admin tools
tenant-db-setup/ - Tenant provisioning tools
database/ - Database schemas
Logs:
logs/application.log - Application logs
logs/error.log - PHP errors
logs/tenant-db-setup.log - Tenant setup logs
Documentation:
docs/PARTNER_ONBOARDING.md - Partner guide
docs/TECHNICAL_ARCHITECTURE.md - Technical docs
admin/MIGRATION_GUIDE.md - Migration guide
---
Important SQL Queries
List All Organizations:
`sql
SELECT org_id, org_name, subscription_status, created_at
FROM organizations
ORDER BY created_at DESC;
`
Check User Count Per Org:
`sql
SELECT o.org_name, COUNT(u.user_id) as user_count, o.max_users
FROM organizations o
LEFT JOIN users u ON o.org_id = u.org_id
GROUP BY o.org_id;
`
Find Inactive Organizations:
`sql
SELECT org_id, org_name, subscription_status, subscription_ends_at
FROM organizations
WHERE subscription_status != 'active'
OR subscription_ends_at < NOW();
`
Connection Statistics:
`sql
SELECT
hosting_type,
COUNT(*) as count,
SUM(CASE WHEN health_status = 'healthy' THEN 1 ELSE 0 END) as healthy,
SUM(CASE WHEN is_active = 1 THEN 1 ELSE 0 END) as active
FROM org_db_connections
GROUP BY hosting_type;
``
---
Support
Email : partners@veritylayer.com
Portal : https://support.veritylayer.com
Docs : https://docs.veritylayer.com
Phone : +1-XXX-XXX-XXXX (24/7)