niico
niico

Reputation: 12739

Composite C1 - develop locally, sync to live site

I have a couple of Composite C1 CMS websites.

To edit them currently I use the web based CMS on the live site.

However - I would like to update the (code & content) in Visual Studio locally - then sync to the web. However, if my local copy is older than that online (e.g. a non techy client has edited something on the live site) and I Web Deploy - it will go over the top of the new file on the server.

I need a solution that works out the newest change? I can't find anything in Google or the C1 docs.

How can I sync - preferably using Web Deploy. Do I need some kind of version control?

Is there a best practice for this - editing the live site through the web interface seems a bit dicey & is slow.

Upvotes: 4

Views: 541

Answers (2)

Magnus Kragelund
Magnus Kragelund

Reputation: 370

The general answer to this type of scenario seems to be to use the Package Creator. With that you can develop locally, add the files you've changed to a package, and install that package on a live site. This solution does not at all cover all the parts of you question though, and has certain limitations:

  • You cannot selectively add content to a package. It's all pages or no pages.
  • Adding datatypes is easy, but updating them later requires you to delete the datatype (and data), and recreate the datatype.

In my experience packages works well for incremental site updates, if you limit the packages content to be front end stuff, like css, images and such.

You say you need a solution that works out the newest changes - I believe the only solution to this is yourself, with the aid of some tooling. I don't think there's a silver bullet solution here.

Should you use a version control system? Yes! By all means. Even if you are not sharing your code with anyone, a VCS is a great way to get to know Composite C1 from a file system perspective, as you can carefully track what files are changed on disk, as you develop. This knowledge is crucial when you want to continuously add features the a website that is already alive and kicking - you need to know what to deploy, and what not to touch.

Make sure you read the docs on how Composite fits in VCS: http://docs.composite.net/Configuration/C1-and-Version-Control

I assume that your sites are using the XML data storage (if you where using SQL Data Store, your content would not be overridden upon sync).

This means that your entire web application lives in one folder on disk on the web server, which can be an advantage here. I'll try to outline a solution that could work for you, although I must stress that I've never tried this - I'm making it up as I type.

Let's say you're using git, download the site in it's entirety from the production web server, and commit the whole damned thing* to your master branch.

Then you create a new feature branch from that commit, and start making the changes you want to deploy later, and carefully commit your work as you go along, making sure you only commit the changes that are needed for your feature to work, to the feature branch.

Now, you are ready to deploy, and you switch back the master branch, and again download the entire site and commit it to master.

You then merge your feature branch into the master branch, and have git do all the hard work of stitching you changes in with the changes from the live site. There are bound to be merge conflicts, and that is where you will have to jump in, and decide for yourself what content needs to go live.

After this is done and tested, you can web deploy the site up to the production environment. Changes to the live site might have occurred while you where merging, so consider closing the site, or parts of it, during this process.

If you are using SQL Data Store i suggest paying for a tool like Red Gate's SQL Compare and SQL Data Compare or SQL Delta, to compare your dev database to the production database, and hand pick SQL scripts that can be applied to the production database along with your feature deployment.

'* Do consider using a .gitignore file to avoid committing certain files - refer to the docs for mere info.

Upvotes: 3

xumix
xumix

Reputation: 643

I suppose you should use the Package Creator Also have a look here: http://docs.composite.net/Configuration/C1-and-Version-Control

Upvotes: 1

Related Questions