First and foremost nobody likes to work on production applications. Therefore it is advised and good practice for someone to set-up separate stores, my structure is as follows:
- dev.magento.local -> Development store;
- stage.magento.local -> UAT/QA store;
- magento.local -> Production store;
Meanwhile the store is tracked in source control, including the
app/etc/local.xml, which is the first conflict of this structure. Nevertheless once the Magento installation process has complete and we have the local.xml, the idea was to:
1) Export the recently installed however fresh Magento store.
icanhas$ mysqldump --single-transaction magestore_dev > magestore_dev.dmp.sql
2) Then import the structure for the remaining environments.
icanhas$ mysql -u'magestage_user' -p'magestage_pwd' < magestore_dev.dmp.sql icanhas$ mysql -u'mageprod_user' -p'mageprod_pwd' < magestore_dev.dmp.sql
3) The new environments need their urls corrected, although that's beyond this question let's assume they've been done.
4) As previously mentioned, we need to solve the conflict with
app/etc/local.xml so I created the following directories:
- /app/etc/development/local.xml -> Moved local.xml here;
- /app/etc/staging/local.xml -> Copied development/local.xml here;
- /app/etc/production/local.xml -> Copied development/local.xml here;
5) I corrected the database credentials for each environment, this was committed to the repository.
6) Finally I had so create the following symbolic links:
- On dev.magento.local;
app/etc/local.xml -> app/etc/development/local.xml;
- On stage.magento.local;
app/etc/local.xml -> app/etc/staging/local.xml;
- On magento.local;
app/etc/local.xml -> app/etc/production/local.xml;
- Could there be anything bad about using this method?
- After installation does Magento write to this file at any point?
Any advice would be greatly appreciated.