π 7Ges ERP Installation
Complete guide to install 7Ges ERP Client/Server, Dolibarr's evolution towards a revolutionary architectural model with exclusive PostgreSQL and centralized logic.
System Requirements
PostgreSQL 12+, PHP 7.4+, optimized configuration
Guided Process
Step-by-step installation with automatic verification
Complete Support
Testing, troubleshooting and advanced administration
π Welcome to 7Ges ERP Client/Server
7Ges ERP is Dolibarr's evolution towards a pure client/server model where all business logic resides in PostgreSQL. This revolutionary architecture guarantees exceptional consistency, performance and reliability.
β¨ Key Benefits
- π Guaranteed Consistency: Business rules always execute, without exceptions
- β‘ Superior Performance: Optimized calculations and validations in the database
- π‘οΈ Reinforced Security: Validations impossible to bypass
- π§ Simplified Maintenance: Centralized and documented logic
- π Complete Audit: Automatic tracking of all changes
π Version Information
π System Requirements
π₯οΈ Web Server
- Apache: 2.4+ with mod_rewrite
- Nginx: 1.18+ (alternative)
- PHP: 7.4+ to 8.2
- Memory: 512MB minimum, 2GB recommended
- Space: 1GB for application + data
π PostgreSQL (CRITICAL)
- Version: PostgreSQL 12+ (recommended 14+)
- Extensions: pgTAP for testing (optional)
- Configuration: UTF-8, timezone configured
- Permissions: CREATE, DROP, ALTER on DB
- β οΈ IMPORTANT: MySQL/MariaDB NOT supported
π§ PHP Extensions
- pgsql: PostgreSQL connection (mandatory)
- pdo_pgsql: PDO PostgreSQL (mandatory)
- gd: Image manipulation
- curl: HTTP communications
- xml: XML processing
- zip: File compression
β οΈ Important Compatibility
7Ges ERP is EXCLUSIVE to PostgreSQL. It does not maintain compatibility with MySQL/MariaDB by design. This decision allows maximizing PostgreSQL's advanced capabilities and ensuring client/server model consistency.
π New Installation
Complete process to install 7Ges ERP from scratch with client/server model.
Prepare PostgreSQL Database
Create database and user for 7Ges ERP.
PostgreSQL Commands:
-- Connect as postgres user
sudo -u postgres psql
-- Create user for 7Ges ERP
CREATE USER erp7ges WITH PASSWORD 'secure_password';
-- Create database
CREATE DATABASE erp7ges
OWNER erp7ges
ENCODING 'UTF8'
LC_COLLATE = 'es_ES.UTF-8'
LC_CTYPE = 'es_ES.UTF-8'
TEMPLATE template0;
-- Grant permissions
GRANT ALL PRIVILEGES ON DATABASE erp7ges TO erp7ges;
-- Verify connection
\c erp7ges erp7ges
Download and Configure 7Ges ERP
Get 7Ges ERP files and configure permissions.
System Commands:
# Download 7Ges ERP
cd /var/www/html
git clone https://github.com/7ges/7ges-erp.git
cd 7ges-erp
# Configure permissions
sudo chown -R www-data:www-data .
sudo chmod -R 755 .
sudo chmod -R 777 documents/
sudo chmod -R 777 htdocs/conf/
# Verify PHP extensions
php -m | grep -E '(pgsql|pdo_pgsql|gd|curl)'
Run Web Installer
Access the web installer and configure the PostgreSQL connection.
π Installer Steps:
- Navigate to:
http://your-server/7ges-erp/htdocs/install/
- Select language: English
- Verify prerequisites: Confirm PostgreSQL
- Configure database:
- Type: PostgreSQL (pgsql)
- Server: localhost (or server IP)
- Port: 5432
- Database: erp7ges
- User: erp7ges
- Password: [configured password]
- Create administrator: Initial system user
- Finish: The installer will automatically load PostgreSQL functions
β¨ Automatic Functions
The 7Ges ERP installer automatically loads all PostgreSQL functions and triggers from migrated modules. No additional manual configuration required.
Verify Installation
Check that all PostgreSQL functions are loaded correctly.
Verification Script:
-- Connect to the database
\c erp7ges
-- Verify main functions loaded
SELECT
routine_name,
routine_type
FROM information_schema.routines
WHERE routine_schema = 'public'
AND routine_name LIKE 'llx_%'
ORDER BY routine_name;
-- Verify main triggers
SELECT
schemaname,
tablename,
triggername
FROM pg_triggers
WHERE schemaname = 'public'
AND triggername LIKE 'trg_%'
ORDER BY tablename, triggername;
-- Verify modules with loaded functions
SELECT DISTINCT
substring(routine_name from 'llx_([^_]+)_.*') as modulo,
COUNT(*) as functions
FROM information_schema.routines
WHERE routine_schema = 'public'
AND routine_name LIKE 'llx_%'
GROUP BY modulo
ORDER BY modulo;
β Verification Checklist
- 59+ PostgreSQL functions loaded
- 51+ active triggers
- Modules with functions: societe, product, user, banque, tax, propale, categories, don, contact, commande
- Successful access to admin panel
- Test third party creation works
π Migration from Existing Dolibarr
Process to migrate an existing Dolibarr installation to 7Ges ERP.
β οΈ Important Warning
Migration is IRREVERSIBLE. 7Ges ERP completely removes MySQL compatibility and substantially modifies system behavior. Perform complete backup before proceeding.
1. π Preparation and Backup
# Complete MySQL backup (if coming from MySQL)
mysqldump -u root -p dolibarr_db > backup_dolibarr_$(date +%Y%m%d).sql
# Complete PostgreSQL backup (if already on PostgreSQL)
pg_dump -U user -d dolibarr_db > backup_dolibarr_$(date +%Y%m%d).sql
# Backup files
tar -czf backup_files_$(date +%Y%m%d).tar.gz /ruta/dolibarr/
2. π Data Migration
If coming from MySQL, migrate data to PostgreSQL using specialized tools:
# Option A: Use pgloader (recommended)
sudo apt-get install pgloader
pgloader mysql://user:pass@localhost/dolibarr_db \
postgresql://user:pass@localhost/erp7ges
# Option B: Manual migration with conversion
# (Requires custom script according to structure)
3. βοΈ Load 7Ges Functions
# Load all functions from migrated modules
cd /var/www/html/7ges-erp
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-societe.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-product.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-user.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-banque.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-tax.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-propale.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-categories.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-don.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-contact.sql
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-commande.sql
4. π§ͺ Post-Migration Validation
Run tests to verify successful migration:
# Run structure tests (optional, requires pgTAP)
cd /var/www/html/7ges-erp
./run_pgtap_tests.sh estructura
# Verify functions manually
psql -U erp7ges -d erp7ges -c "
SELECT COUNT(*) as loaded_functions
FROM information_schema.routines
WHERE routine_name LIKE 'llx_%';"
# Test basic functionality
# - Create third party
# - Create product
# - Generate quotation
# - Verify automatic calculations
π§ͺ Testing and Validation
Complete testing system to validate 7Ges ERP integrity.
ποΈ Testing Architecture
Structure Tests
Verify that all tables, fields and constraints exist
Unit Tests pgTAP
Validate individual functions and triggers
Comparative Tests
Ensure parity with original PHP behavior
π§ pgTAP Configuration (Optional)
pgTAP allows running advanced unit tests.
pgTAP Installation:
# Ubuntu/Debian
sudo apt-get install postgresql-contrib-XX # XX = PostgreSQL version
# Or compile from source
git clone https://github.com/theory/pgtap.git
cd pgtap
make
sudo make install
# Install in the database
psql -U erp7ges -d erp7ges -c "CREATE EXTENSION pgtap;"
βΆοΈ Run Tests
Available Testing Scripts:
ποΈ Structure Tests
# Run structure tests for all modules
cd /var/www/html/7ges-erp
./run_pgtap_tests.sh structure
# Specific module test
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/tests/test-societe-estructura.sql
π§ͺ Complete Unit Tests
# Run ALL tests (1,477 tests)
./run_pgtap_tests.sh all
# Specific module test
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/tests/test-societe.sql
# View detailed results
./run_pgtap_tests.sh societe | grep -E "(not ok|#)"
βοΈ Comparative Tests
# Synchronize test databases
./sync-test-databases-final.sh
# Run specific comparative test
php htdocs/societe/test-comparativo-societe.php
# Validate results in PostgreSQL
psql -U erp7ges -d dolibarr_test_postgresql -f htdocs/societe/test-comparativo-societe-sql.sql
π Results Interpretation
β Successful Tests
ok 1 - Function llx_societe_before_insert must exist
ok 2 - Email must validate correctly
...
1..49
# Tests passed: 49/49
Status: Everything working correctly
β οΈ Tests with Warnings
ok 1 - Function exists
not ok 2 - Invalid email must fail
# Expected exception but none thrown
...
# Tests passed: 48/49
Action: Review the specific failing function
β Failed Tests
not ok 1 - Function llx_societe_before_insert must exist
# Function does not exist
...
# Tests passed: 0/49
Action: Verify that PostgreSQL functions are loaded
π§ Administration Commands
πΎ Backup and Restore
Complete Backup
# Complete backup with functions
pg_dump -U erp7kas -d erp7kas \
--verbose --clean --create \
> backup_7ges_$(date +%Y%m%d_%H%M%S).sql
# Backup data only (without functions)
pg_dump -U erp7kas -d erp7kas \
--data-only --verbose \
> backup_data_$(date +%Y%m%d).sql
Restore
# Restore complete backup
psql -U erp7ges -d erp7ges_new < backup_7ges_20250106_143022.sql
# Restore data only
psql -U erp7ges -d erp7ges < backup_data_20250106.sql
π§Ή Maintenance
Database Optimization
# Statistics analysis
psql -U erp7ges -d erp7ges -c "ANALYZE;"
# Complete vacuum
psql -U erp7ges -d erp7ges -c "VACUUM VERBOSE;"
# Reindex (if necessary)
psql -U erp7ges -d erp7ges -c "REINDEX DATABASE erp7ges;"
Log Cleanup
# Clean old log files
find /var/log/apache2/ -name "*.log.*" -mtime +30 -delete
# Clean PHP cache if exists
rm -rf /tmp/php_cache/*
# Clean Dolibarr temporary files
rm -rf documents/admin/temp/*
π Monitoring
System Status
# Active PostgreSQL connections
psql -U erp7ges -d erp7ges -c "
SELECT count(*) as active_connections,
state
FROM pg_stat_activity
WHERE datname = 'erp7ges'
GROUP BY state;"
# Database size
psql -U erp7ges -d erp7ges -c "
SELECT pg_size_pretty(pg_database_size('erp7ges')) as database_size;"
Error Logs
# Latest PostgreSQL errors
sudo tail -f /var/log/postgresql/postgresql-*.log
# Apache PHP errors
sudo tail -f /var/log/apache2/error.log | grep -i "7ges\|dolibarr"
# Application logs (if configured)
tail -f documents/dolibarr.log
π Function Updates
Reload Specific Functions
# Reload functions for a specific module
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-societe.sql
# Verify they loaded correctly
psql -U erp7ges -d erp7ges -c "
SELECT routine_name
FROM information_schema.routines
WHERE routine_name LIKE 'llx_societe_%';"
Complete Update
# Script to reload all functions
#!/bin/bash
cd /var/www/html/7ges-erp
for func_file in htdocs/install/pgsql/functions/functions-*.sql; do
echo "Loading $func_file..."
psql -U erp7ges -d erp7ges -f "$func_file"
done
echo "All functions updated."
π οΈ Common Problem Solutions
β Error: "relation llx_tabla does not exist"
Cause:
Missing specific relationship table not created in all installations.
Solution:
-- Check which tables are missing
SELECT tablename
FROM pg_tables
WHERE schemaname = 'public'
AND tablename LIKE 'llx_%'
ORDER BY tablename;
-- Create missing table (example)
CREATE TABLE IF NOT EXISTS llx_categorie_fichinter (
fk_categorie integer NOT NULL,
fk_fichinter integer NOT NULL,
import_key varchar(14),
PRIMARY KEY (fk_categorie, fk_fichinter)
);
β οΈ Error: "function llx_modulo_function does not exist"
Cause:
PostgreSQL Functions not loaded or loaded incorrectly.
Solution:
# Check loaded functions
psql -U erp7ges -d erp7ges -c "
SELECT routine_name
FROM information_schema.routines
WHERE routine_name LIKE 'llx_%'
ORDER BY routine_name;"
# Reload functions for the specific module
psql -U erp7ges -d erp7ges -f htdocs/install/pgsql/functions/functions-modulo.sql
π Error: pgTAP Tests Failing
Cause:
Inconsistent test data or modified by previous tests.
Solution:
# Synchronize test databases
./sync-test-databases-final.sh
# Run specific test in verbose mode
psql -U erp7ges -d dolibarr_test_postgresql -f htdocs/install/pgsql/tests/test-modulo.sql
# View error details
psql -U erp7ges -d dolibarr_test_postgresql -c "
SELECT * FROM pg_stat_activity WHERE state = 'active';"
πΎ Error: "out of memory" en PostgreSQL
Cause:
Insufficient PostgreSQL memory configuration.
Solution:
# Edit PostgreSQL configuration
sudo nano /etc/postgresql/XX/main/postgresql.conf
# Adjust parameters (example for server with 4GB RAM)
shared_buffers = 1GB
effective_cache_size = 3GB
maintenance_work_mem = 256MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
# Restart PostgreSQL
sudo systemctl restart postgresql
π Additional Resources
π Documentation
π§ Configuration Files
htdocs/conf/conf.php
- Main configurationhtdocs/install/pgsql/functions/
- PostgreSQL Functionshtdocs/install/pgsql/tests/
- Tests pgTAPdocs/migracion/
- Technical documentation
π Useful Links
π Support
- System Logs:
/var/log/postgresql/
- Apache Logs:
/var/log/apache2/
- Validation Tests:
./run_pgtap_tests.sh
- Project Documentation:
*.md
in root directory