What is the best implementation practice when using MODX?

This is convenient when you have a version of the DEVELOPMENT application on your local computer, and you can deploy it to the STAGE server for testing (optional), and then deploy it to the PRODUCTION server. You can do this relatively easily when there is excellent discretion of the code and data in the project (for example, if we save all the code and settings in the project and data files in the database).

MODX stores templates, fragments, etc. in the database. Yes, we can move this code to static files, and then we can use a version control system to track changes to these elements. But they also have presentation lines. This means that we must continue to update the database by adding or removing some items.

It seems that we can also get some problems if we just copied the extension files instead of having to install the package manager (because extensions often have their own tables in the database).

Another problem is that DEV and PROD applications have different settings stored in files (configs) and the database (user accounts, for example).

I still do not see a clear way to organize the iterative development cycle of DEV-STAGE-PROD. So my questions are:

  • What database files and tables should (or should) be copied during deployment?
  • What is the mode (replace, ignore) I have to do this in?
  • What is the easiest and fastest way to do this?

My biggest problem here is to deal with the database.

PS I'm talking about the MODX Revolution version, if that matters.

+7
source share
2 answers

No path information should be stored in the database at all, previous versions were made in the modx_workspaces table, but it has disappeared since then [as of 2.2.4, I think].

If you are concerned about changes to the url [dev.mysite.com/stage.mysite.com/production ...], you don’t need to - this is all in the .htaccess file [there used to be a site_url system but it also seems to have disappeared.]

The only file you need to worry about is core / config / config.inc.php ~ create 3 different files with different paths or just replace them when transferring.

My process of moving / updating / migrating modx sites:

clear cache! tar cvfz httpdocs.tar.gz httpdocs / mysqldump -u -p the_database> export.sql

move files, tar xvfz and import the database. It is recommended that you check the modx_workspaves table, and if you used an older version of the gallery, check this as well, but most plugins and developers seem to be used to NOT store path information in code tables and databases.

Of course, if you have strengthened your installation, there are a few more steps, but nothing serious. [cm. Reinforcing Modx article on rtfm.modx.com]

+3
source

I think you are looking for this plugin (depending on your modx version):

https://github.com/digitalbutter/MODX-Mirror

https://github.com/digitalbutter/FEM

All fragments, fragments, etc. located on disk. Any changes made to the files initiate the corresponding database changes without the need to complete a full SQL / Reimport import. This will allow you to use any version control system / distributed development environment / automatic deployment.

+1
source

All Articles