We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 436 ☆ A M B ☆
    • 265 Posts
    We have a project where the client updates a live server with various pieces of content, such as press releases, calendars, events, etc which need to be published immediately on the live site. Then we also have a duplicate of this as a dev server where we develop the next set of features for the site.

    Our vision was when we want to go live with the new features on the dev site all of its content would be up-to-date, so we simply switch the servers, so so dev becomes production and production becomes the next dev server and everything is up to date.

    We would ideally like to keep the resource content synched between the two, as this is the area where the client is updating. Then when everything on the dev site is ready we switch them over. But its not a simple case of synching the modx_site_content database table because the dev version has new resources too.

    We use Github to version control our plugin code, and then install the plugins and configure them. But maybe there's a way to actually version control more of MODX? But it seems like the database and the snippets, content, etc stored in the DB get in the way of this.

    If Github could be used more then nice apps like Deploy HQ could be used to push new changes to the production site.

    Maybe I am looking at this from the wrong angle, and the dev site doesn't need any of the content - but I can't see a way around this at the moment.

    Has anybody got any tips for deploying a dev site into production with MODX?
      MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use static elements and resources?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 436 ☆ A M B ☆
        • 265 Posts
        Can you have a resource as a static file? What about the TVs for that resource?
          MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
          • 3749
          • 24,544 Posts
          From my book: "Static resources are resources that contain a file path in their content field."

          I think tags in the file will be processed when the page is rendered and I assume that would include TV tags, but TBH, I've never tried it.

          That isn't going to solve your problem with new resources on the dev. server, though, or handle TV values.

          It's not an ideal solution, but using StageCoach on the production site would let you work on new versions of a page without them being published and of course new pages could be created without being published. Of course that would take Git out of the equation.

          Another way to go would be to create a utility snippet to export and import the site_content table and transfer the SQL file between sites. The SQL file is plain text, so you could put it under version control and even do a diff on it. Unfortunately, the TV values are not going to come along for the ride unless you also import and export the modx_site_tmplvar_contentvalues table, and that would require that all resources have the same IDs in both sites (though I think they would automatically if you use DROP TABLE), not to mention the site breaking when you create a new TV on the dev. site and forget to do so on the production site.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 22303 MODX Staff
            • 10,725 Posts
            The only way to do this without conflicts is to have a staging server that is master at all times. Then you can just push to production from staging at any time. This means no one can work directly on production (other than to implement quick fixes that are applied to staging as well) and all development must be pushed into staging. Otherwise, you would have to manually resolve conflicts between Resource id's created in the different environments.
              • 4385
              • 372 Posts
              But you can't just upload or switch out the whole database can you? Site settings and user accounts, sessions and other tables would be different. Does anyone have a list of what core tables should be synced? Is it better to keep the whole site in the database? We are using static pages for chunks and templates.
                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 23496
                • 20 Posts
                This is an intresting topic.
                I have a similar situation and agree with opengeek. Two-way-sync needs a powerfull component to handle the conflicts.

                Maybe my experiences can help to find your solution. No project is like an other. But some experiences are often the same.
                Currenlty I am working in a very large project (around 70 developers, PMs, BAs) where the e-commerce-platform hybris (java-based) is used. The shop sells smartphone, accessoires for mobiles and belongs to one of the three largest communination-companies in europe. We only working from dev to stage and from stage to live. Never backwards. On the dev enviroment doesn't have all current products, that are available online. Only when it is necessary for development, a backward sync of the content-catalogs will be done. Also access-rights are extensive than in the dev-enviroment. This works.

                In the past I did often make minor changes directly on a live-system in my modx projects. But I say, it is hard to handle a two-way-sync. Especially when the project gets larger and larger...
                So I do it only one-way. But not with the modx_site_content table and the depend modx_tv tables, because I would destroy resources that are generated from users on my platform.

                With this situation I startet to find a solution. So I found provisioner. It not the best solution for my issue, but temporary it's ok. Till I have developed my own solution.


                @bwente: you can take the modx_site_* tables, also modx_user_* tables, also the acl tables and drop them into a similar installation. I do it sometimes to update a website after a major developing-sprint.