Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best deployment practice when using MODX?

It is convenient when you have DEVELOPMENT version of application on your local machine and you may deploy it on STAGE server for testing (it's optional) and then deploy it on PRODUCTION server. You can do this relatively easily when there is a fine discretion of code and data in the project (for example, if we store all the code and settings in project files and data in database).

MODX stores templates, snippets, etc. in database. Yes, we can move this code to static files and then we can use version control system for tracking changes of these items. But these ones have representation rows in database too. It means we must update database as before if we added or removed some items.

Looks like we can also get some troubles if we just copied files of extensions instead of making installation by package manager (because extensions often have its own tables in DB).

Another problem is that applications on DEV and PROD have different settings stored in files (configs) and database (user accounts, e.g.).

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

  • Which files and database tables should (or must) I copy when deploying?
  • What is the mode (replace, ignore) I should do that in?
  • What is the easiest and fastest way to do that?

My biggest concern here is having to deal with database.

P.S. I'm talking about "Revolution" version of MODX if it matters.

like image 594
Alexander Surin Avatar asked Apr 10 '13 20:04

Alexander Surin


1 Answers

The database should not store any path information at all, previous versions did in the modx_workspaces table, but that has since disappeared [as of 2.2.4 I believe].

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

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

my process for moving/updating/migrating modx sites is:

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

move the files, tar xvfz & import the database. It's a good idea to check the modx_workspaves table and if you have used an older version of gallery, check that as well, but most plugins & developers seem to be used to NOT storing path information in code & DB tables.

Of course if you have hardened your installation there are a few more steps, but nothing major. [see the "hardening Modx article on rtfm.modx.com]

like image 186
Sean Kimball Avatar answered Sep 30 '22 05:09

Sean Kimball