Restore Procedure
Minimize downtime and recover from data loss or system failure by mastering the ServiceOps application and database restoration procedures.
The ServiceOps Application and Database Restore Procedure is a critical process for ensuring business continuity in case of data loss, system failure, or migration scenarios. This guide provides comprehensive procedures for restoring both the ServiceOps application components and the PostgreSQL database from previously created backups.
The restoration process involves recovering application files, configurations, and database records from the most recent backup to minimize downtime and maintain operational efficiency. Proper restoration procedures ensure that all ServiceOps functionality is restored to its previous state.
Prerequisites
Before performing restore procedures, ensure you have:
- Administrative access to the ServiceOps server
- Valid backup files from a previous backup procedure
- Sufficient disk space for restoration (typically equal to or greater than backup size)
- Service status knowledge - understand which services need to be stopped
- Database credentials for PostgreSQL access
- Backup verification - confirm backup integrity before restoration
Pre-Restore Preparation
View Pre-Restore Preparation Steps
Step 1: Verify Backup Availability
Check backup files exist:
ls -la /home/motadata/backupApp_DD-MM-YYYY/
ls -la /home/motadata/backupDB_DD-MM-YYYY/Verify backup integrity:
# Check application backup structure
find /home/motadata/backupApp_DD-MM-YYYY/ -type f | wc -l
# Check database backup file
ls -la /home/motadata/backupDB_DD-MM-YYYY/flotoitsmdb_dump
Step 2: Document Current State
Record current service status:
systemctl status ft-main-server.service
systemctl status ft-analytics-server.service
systemctl status ft-file-server.service
systemctl status postgresql.serviceDocument current configuration:
# Backup current configuration before restore
cp -r /opt/flotomate/main-server/config /tmp/current_config_backup
Application Restore
View Application Restore Steps
The application restore process involves stopping services and restoring all ServiceOps components from backup files.
Step 1: Stop All Services
Stop all running ServiceOps services to prevent conflicts during restoration:
# Check service status first
systemctl status ft-main-server.service
systemctl status ft-plugin-server.service
systemctl status ft-discovery-service.service
systemctl status ft-discovery-go.service
systemctl status ft-file-server.service
systemctl status elasticsearch.service
systemctl status nginx.service
systemctl status postgresql.service
systemctl status file-sync.service
Stop all services:
systemctl stop ft-main-server.service
systemctl stop ft-plugin-server.service
systemctl stop ft-discovery-service.service
systemctl stop ft-discovery-go.service
systemctl stop ft-file-server.service
systemctl stop elasticsearch.service
systemctl stop nginx.service
systemctl stop postgresql.service
systemctl stop file-sync.service
Step 2: Prepare Restore Environment
Navigate to home directory:
cd /home/motadataAccess backup directory:
Syntax:
cd backupApp_DD-MM-YYYY/Example:
cd backupApp_12-03-2025
Step 3: Restore Main Server
The main server contains core application logic and configurations:
Navigate to main server backup directory:
cd main-serverRestore main server components:
cp -pr lib /opt/flotomate/main-server/
cp -pr dbs /opt/flotomate/main-server/
cp -pr config /opt/flotomate/main-server/
cp -pr filedb /opt/flotomate/main-server/
Step 4: Restore Analytics Server
Navigate to analytics server backup directory:
cd ../analytics-serverRestore analytics components:
cp -pr lib /opt/flotomate/cm-analytics/
cp -pr config /opt/flotomate/cm-analytics/
cp -pr filedb /opt/flotomate/cm-analytics/
Step 5: Restore File Server
Navigate to file server backup directory:
cd ../fileserverRestore file server components:
cp -pr lib /opt/flotomate/fileserver/
cp -pr config /opt/flotomate/fileserver/
Step 6: Restore Chat Server
Navigate to chat server backup directory:
cd ../chat_serverRestore chat server files:
cp -pr *.* /opt/flotomate/chat_server/
Step 7: Restore Plugin Server
Navigate to plugin server backup directory:
cd ../plugin-serverRestore plugin server:
cp -pr plugin-server /opt/flotomate/
Step 8: Restore Discovery Service
Navigate to discovery service backup directory:
cd ../discovery-serviceRestore discovery service components:
cp -pr discovery /opt/flotomate/discovery/
cp -pr pattern-executor /opt/flotomate/discovery/
cp -pr app.config /opt/flotomate/discovery
Step 9: Restore System Files
Navigate to other files backup directory:
cd ../otherfilesRestore frontend application:
cp -pr frontend /opt/flotomate/
chown -R fmtuser:fmtusergroup /opt/flotomate/Restore Nginx configuration:
cp -pr nginx /etc/Restore SSL certificates and keys:
# Copy only certificate and key files
cp -pr www.example.cert /etc/ssl/
cp -pr www.example.key /etc/ssl/noteSSL Configuration: After copying SSL files, verify the SSL certificate configuration in the fmt_nginx.conf file located in /etc/nginx/conf.d/ folder.
Restore PostgreSQL configuration:
cp -pr postgresql /etc/
chown -R postgres:postgres /etc/postgresql/Restore PostgreSQL data files (Optional):
# Rename existing main folder (optional)
mv /var/lib/postgresql/16/main /var/lib/postgresql/16/main_DD-MM-YYYY
# Restore data files
cp -pr main /var/lib/postgresql/16/
chown -R postgres:postgres /var/lib/postgresql/16/
Database Restore
View Database Restore Steps
The database restore process involves recreating the PostgreSQL database and restoring data from backup dumps.
Step 1: Prepare Database Backup
Download and move the latest database backup file to the /tmp folder using the below command::
Syntax:
mv DB_DATE_BACKUP.zip /tmp/
cd /tmp
unzip DB_DATE_BACKUP.zip
Example:
mv DB_22-03-2024_11-00-00_pm.zip /tmp
cd /tmp
unzip DB_22-03-2024_11-00-00_pm.zip
Step 2: Stop Application Services
Stop the main server and analytics server to prevent database conflicts:
systemctl stop ft-main-server
systemctl stop ft-analytics-server
Step 3: Recreate Database
Access PostgreSQL console:
su postgres
psqlDrop existing database:
drop database flotoitsmdb;Create new database:
create database flotoitsmdb;Verify database creation:
\lExit PostgreSQL console:
\q
Step 4: Restore Database Data
Restore database from dump file:
Syntax:
pg_restore -U postgres -d flotoitsmdb {DB_DATE_BACKUP}
Example:
pg_restore -U postgres -d flotoitsmdb DB_10-6-2021_11-00-00_pm
Post-Restore Procedures
View Post-Restore Procedures
Step 1: Restart Application Services
Start all ServiceOps services in the correct order:
# Start database first
systemctl start postgresql
# Start core services
systemctl start elasticsearch
systemctl start ft-file-server
systemctl start ft-discovery-service
systemctl start ft-discovery-go
systemctl start ft-plugin-server
# Start main application services
systemctl start ft-main-server
systemctl start ft-analytics-server
# Start web server
systemctl start nginx
Step 2: Verify Service Status
Check that all services are running correctly:
systemctl status ft-main-server
systemctl status ft-analytics-server
systemctl status ft-file-server
systemctl status postgresql
systemctl status nginx
Step 3: Test Application Functionality
- Access the application through web browser
- Verify login functionality
- Check critical modules:
- Incident Management
- Service Request Management
- Asset Management
- Change Management
- Verify data integrity by checking recent records
- Test user permissions and role assignments
Troubleshooting
Common Restore Issues
Permission Errors:
# Fix ownership issues
chown -R fmtuser:fmtusergroup /opt/flotomate/
chown -R postgres:postgres /etc/postgresql/
chown -R postgres:postgres /var/lib/postgresql/16/
Service Start Failures:
# Check service logs
journalctl -u ft-main-server.service -f
journalctl -u postgresql.service -f
Database Connection Issues:
# Verify PostgreSQL is running
systemctl status postgresql
sudo -u postgres psql -c "\l"
Nginx Configuration Issues:
# Test nginx configuration
nginx -t
# Check nginx logs
tail -f /var/log/nginx/error.log
Recovery Verification
Check application logs for errors:
tail -f /opt/flotomate/main-server/logs/application.logVerify database connectivity:
sudo -u postgres psql -d flotoitsmdb -c "SELECT COUNT(*) FROM apolo.request;"Test file server functionality:
curl -I http://localhost:8080/fileserver/health
Best Practices
View Best Practices for Restore Procedures
Before Restore
- Verify backup integrity before starting restoration
- Document current system state for rollback purposes
- Ensure sufficient disk space for restoration
- Plan maintenance window to minimize user impact
During Restore
- Follow service stop/start order to prevent conflicts
- Monitor system resources during restoration
- Keep detailed logs of restoration process
- Test each component after restoration
After Restore
- Verify all services are running correctly
- Test application functionality thoroughly
- Check data integrity across all modules -Update documentation with restoration details
Related Topics
Next Steps
After completing the restore procedure:
- Document restoration details: Record restore date, time, and any issues encountered
- Update backup procedures: Incorporate lessons learned into backup processes
- Test backup/restore cycle: Verify the complete backup and restore workflow
- Review disaster recovery plan: Update procedures based on restoration experience
- Schedule regular testing: Implement periodic restore testing in non-production environment