Using External Database - rtCamp/Frappe-Manager GitHub Wiki
By default, FM uses its global-db
service as the central database for all benches. However, you can configure FM to use an external database.
- Create a user with access from any host (
%
) since requests will come from Docker containers with dynamic IPs - For Frappe v15 and lower: database username must match database name
- For Frappe v16+: you can specify custom username using
db_user
parameter insite_config.json
Example SQL commands for your external database:
CREATE DATABASE your_database_name;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'username'@'%';
FLUSH PRIVILEGES;
First backup your site while it's still using the internal database:
fm shell <sitename>
bench backup
The backup will be stored in ~/frappe/sites/<sitename>/workspace/frappe-bench/sites/<sitename>/private/backups
fm shell <sitename>
bench stop
Edit your site's configuration in ~/frappe/sites/<sitename>/workspace/frappe-bench/sites/<sitename>/site_config.json
:
{
"db_host": "your-external-db-host",
"db_port": 3306,
"db_type": "mariadb",
"db_name": "your_database_name",
"db_password": "your_password"
}
fm shell <sitename>
bench restart
fm shell <sitename>
bench --site <sitename> restore <backup-file>
fm shell <sitename>
bench --site <sitename> reset
- Ensure your external database server is configured to accept connections from your FM container network
- Test the database connection before proceeding with migration
- Keep a backup of your data until you've verified the migration was successful