-
-
Notifications
You must be signed in to change notification settings - Fork 7
Configuring settings and databases
Jelle Siderius edited this page Aug 8, 2024
·
20 revisions
in the file config/settings.json
you can find the settings that will be used for the tool.This file must contain the following placeholders:
-
localDomainExtension
is the extension used on your local development environment. (Required for import) -
elasticsearchPort
is the port that ElasticSearch is using on your development environment (Required for import) -
databaseLocation
is full path to a folder where the database will be downloaded, if import functionality is not used. (Required) -
keyLocation
the full path to your SSH private key. If empty, mage-db-sync tries to find the SSH key on your machine by a default path. (Optional) -
passphrase
is needed if your SSH key has a passphrase (Optional) -
adminUsername
is used when configuring a default admin user & dummy customer (Required for import) -
adminPassword
is used when configuring a default admin user & dummy customer (Required for import) -
adminEmailAddress
is used when configuring a default admin user & dummy customer (Required for import)
{
"general": {
"localDomainExtension": ".development",
"elasticsearchPort": "9200",
"databaseLocation": "/Users/{username}/Databases"
},
"ssh": {
"keyLocation": "{full path to SSH key folder}",
"passphrase": "{optional passphrase for SSH}"
},
"magentoBackend": {
"adminUsername": "admin",
"adminPassword": "Password1!",
"adminEmailAddress": "[email protected]"
}
}
in the files config/databases/production.json
and config/databases/staging.json
all the databases are configured. These files must contain the following placeholders:
-
username-1-placeholder
can be replaced with a name by choice, this is used as a key for the tool (Required) -
username
is the ssh username to log in to the server (Required) -
password
is the ssh password that goes with the ssh username. (Optional if there is no password required for the SSH user) -
server
is the server(host) to log in to (Required) -
domainFolder
is domain folder on the server. This can be overwritten by usingexternalProjectFolder
and specifying it's full path to the root of Magento. (Required) -
port
the server port (Required) -
localProjectFolder
is the local Magento root folder (Optional) -
externalProjectFolder
is the external Magento root folder (Optional) -
externalPhpPath
is the PHP path on the server, use this if the logged in user has a different PHP version than the server's PHP version (Optional) -
localProjectUrl
can be used to define the local development URL which will be used when configuring the database. By default the URL will beprojct folder name + localDomainExtension(from settings.json)
' (Optional) - [EXPERIMENTAL]:
wordpress
can be set totrue/false
to synchronize wordpress database (Optional) -
commandsFolder
is used to run custom commands while configuring the project. If used, it will look for magerun2.txt or database.txt within the given folder (Optional) - [EXPERIMENTAL]:
stagingUsername
can be used inconfig/databases/production.json
to point to the placeholder key of a staging database inconfig/databases/staging.json
. It when then give you the option to synchronise a production database to staging -
sshKeyName
can be used to set a different key than the default configured in config/settings.json. It will search for the key in ~/.ssh
The config/databases/staging.json
or config/databases/production.json
file has to look like this:
{
"databases": {
"production-username-1-placeholder": {
"username": "example1",
"password": "",
"server": "example1.io",
"domainFolder": "example1.io",
"port": "2222",
"localProjectFolder": "",
"externalProjectFolder": "",
"externalPhpPath": "",
"localProjectUrl": "example1.development",
"wordpress": false,
"commandsFolder": "commands/example-project",
"stagingUsername": "staging-username-1-placeholder",
"sshKeyName": "id_ed25519, will search in ~/ssh/"
},
"production-username-2-placeholder": {
"username": "example2",
"password": "",
"server": "example2.io",
"domainFolder": "example2.io",
"port": "2222",
"localProjectFolder": "",
"externalProjectFolder": "",
"externalPhpPath": "",
"localProjectUrl": "example2.development",
"wordpress": false,
"commandsFolder": "commands/example-project",
"stagingUsername": "staging-username-2-placeholder",
"sshKeyName": "id_ed25519, will search in ~/ssh/"
}
}
}
If your project is configured with a "commandsFolder", mage-db-sync will look for database.txt
or magerun2.txt
relative to the config/databases folder. Make sure to use the quotes given in example:
UPDATE core_config_data SET `value` = "http://github.com/jellesiderius/mage-db-sync" WHERE `path` = "web/unsecure/base_url";
UPDATE core_config_data SET `value` = "https://github.com/jellesiderius/mage-db-sync" WHERE `path` = "web/secure/base_url";
magerun2 sys:cron:run sitemap_generate;
magerun2 sys:cron:run consumers_runner;