-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Using Frappe with Amazon RDS (or any other DBaaS)
Raffael Meyer edited this page Dec 10, 2019
·
7 revisions
Your bench instance allows you to connect to an external database by setting a configuration in your common_site_config.json
in your sites
folder.
We're in the AWS Console, on the RDS page.
- Click the "Create database" button.
- Choose "Standard Create" and select "MariaDB" as the database engine.
- Choose a supported MariaDB Version (currently, 10.3)
- Set the "Master username" to "root" and choose a password. This is the password that bench wants to know when it asks for the "Root password".
- Choose the size of the DB instance (at least "t2.small").
- Optional: Enable Multi-AZ deployment for redundancy.
- Choose the same VPC that contains your frappe server EC2 instance.
- Select or create a parameter group that matches the below settings (for MariaDB 10.3).
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
default-character-set = utf8mb4
- Create the database and wait until it's ready
- Note down the "Endpoint" for that instance (for example,
instance.rds.amazonaws.com
)
If you want to use MariaDB 10.2, use these parameters instead:
innodb-file-format = barracuda
innodb-file-per-table = 1
innodb-large-prefix = 1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
default-character-set = utf8mb4
We're on the frappe server. This should be an EC2 instance in the same VPC as the database.
- Test if you can connect to the database
mysql -h instance.rds.amazonaws.com -u root -p
-
Open
frappe-bench/sites/common_site_config.json
with an editor- Add a key
db_host
and set it to the endpoint you just noted down. Add a keyrds_db
and set it to 1. The two lines should look like this:
- Add a key
{
"db_host": "instance.rds.amazonaws.com",
"rds_db": 1,
}
- Now you should be able to create a new site by running
bench new-site
- Take a database backup of your site with
bench backup
. - Change the configuration as described in "Setup Frappe".
- Create a new site and restore the backup into it.