How to migrate Tenantos to a new server / How to restore a backup
If you encounter issues, please activate the support access on the new server and our support will assist. The backup must be located on the new server.
To migrate Tenantos to a new server (or to restore a backup), please create a backup in Tenantos and follow these steps in order:
-
License:
- First, reissue the license through your client area
- Install a fresh Tenantos instance on the new server
- Important: Use exactly the same main domain and agent domain as your previous installation
-
Database Migration:
- Locate your MySQL credentials in these files:
/var/www/html/.env
and/var/www/agent/.env
- Restore the database from the backup archive (main installation + local agent)
- Locate your MySQL credentials in these files:
-
Restore the application key:
- Find the previous APP_KEY values in the .env files inside of the backup
- Replace the new APP_KEY with these exact values (
/var/www/html/.env
and/var/www/agent/.env
) - This must be done for both the main installation and the local agent
-
System Configuration:
- Run these commands on the new Tenantos server:
app optimize:clear app config:cache systemctl restart supervisor
- Run these commands on the new Tenantos server:
-
SSH Configuration:
- From your backup archive, copy the entire
.ssh
directory content to/var/www/.ssh/
on the new server - Add the new public SSH key to your server by copying
/var/www/.ssh/id_rsa.pub
into/root/.ssh/authorized_keys
- From your backup archive, copy the entire
-
Agent Configuration:
- If your new server has a different IP address:
- Go to the Remote Agents page in your Tenantos dashboard
- Update the server IP for your local agent
- If your new server has a different IP address:
-
Traffic Statistics (InfluxDB):
- If you did backup the traffic statistics, please follow the official InfluxDB restore documentation: InfluxDB Restore Documentation
Common issues
Error: DecryptException","message":"The MAC is invalid.
This usually indicates that the application key (APP_KEY
) has not been restored correctly, or that the necessary commands listed under "System Configuration" have not been executed.
Error (Remote Agents): Invalid API Key
This error means the agent's database has not been restored. To resolve it, either restore the database or manually reconfigure the API key:
- Open Tenantos and navigate to the remote agent management page and note the agent ID. The agent ID is visible in the address bar.
- Connect to the main Tenantos server via SSH and run the following commands:
app tinker use App\Models\agents; agents::find(<INSER THE AGENT ID>)->apiKey;
- Copy the displayed API key, then connect via SSH to the remote agent server and run:
agent tinker use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Crypt; DB::table('settings')->where('name', 'apiKey')->update(['value' => Crypt::encrypt('THE_COPIED_KEY')]);
The steps are the same for the local agent. You simply need to execute the commands on the same server as the main server.