3

I'm currently developing a blueprint for all my Craft websites. It contains a set of sections, fields, plugins etc. All configured the way I need for my websites. The websites itself are basically a fork of this blueprint and only has to have a custom template and content and we're good to go.

The number of features in my blueprint will be growing as time passes along. What would be the best approach of updating all Craft installs so that each website (build upon previous blueprint versions) can benefit from the newly developed features.

I could just backup the DB and code from the blueprint and import them into the website, but then I will be losing all content.

Any idea? Thanks in advance!

5

This approach assumes that the individual websites won't diverge from the original blueprint by, for example, modifying sections and fields to suit their specific requirements.

That seems pretty unlikely.

I'd be inclined to stick with the idea of creating a "blueprint" site, to get new websites up-and-running quickly, but ditch the idea of updating previously-created sites whenever the blueprint is updated.

| improve this answer | |
  • Individual websites shouldn't diverge from the blueprint. The 'standard functionality' should be very flexible. – Wieger Jelsma Mar 20 '17 at 12:05
  • 1
    If you stick to the principle of "open for extension, closed for modification" (i.e. You can add new fields and sections, but you can't modify existing fields and sections), then you could—in theory—write scripted migrations to create the new elements. I still suspect it's way more trouble than it's worth, though. – Stephen Lewis Mar 20 '17 at 12:11
  • It's challenging, I know. But talking about 100+ sites it's a lot of work to manually update them on a regular basis. Even for 25 it's very time consuming. Would you manage those scripted migrations inside a plugin or external through API (which Craft doesn't have yet btw). – Wieger Jelsma Mar 20 '17 at 16:14
  • 1
    A plugin can define its own routes, meaning you can implement your own API. It depends how hands-off you want this to be. If you're going to be logging-in to each site, then you're essentially talking about building something very similar to Craft's auto-update feature. If you want to trigger the updates remotely, then you'll also need to consider endpoints and authentication. – Stephen Lewis Mar 20 '17 at 16:40
  • I think log in manually is the best option. In that case you watch the process and catch some errors if their are any. Yes, something similar to Craft auto-update feature I guess. Thanks! – Wieger Jelsma Mar 21 '17 at 8:51
0

Patches

Create a patch and distribute it among your customers. It can be as simple as a diff. If a core file is overwritten for some reason, the patch might fail.

| improve this answer | |
  • How would you create that patch? Inside a plugin? Lets say 'AMP' for example. I would like to update all my websites and insert that functionality (some routes, templates and maybe a tab in the edit section in CP). I was thinking of a list of tasks which should run for each website. Is that doable inside a plugin? Or more like an external script which calls the API? – Wieger Jelsma Mar 20 '17 at 12:12
  • 1
    I'd create a .sh file with a diff inside to patch the files you need and ask the site owner to apply it. Once the new code is In place you are all set. – mbalparda Mar 20 '17 at 12:13
  • But it's not only concerning files. Also some DB changes should be made. Craft doesn't have an API (yet). – Wieger Jelsma Mar 20 '17 at 16:11
  • 1
    You can modify the DB from the PHP code, I think I'm missing something obvious. – mbalparda Mar 20 '17 at 17:41
  • This could work. You're talking about an external script which transfers new files to the system. And the newly added files take care of handling the DB. I guess a plugin should handle those DB changes. Let me think about that! Thanks. – Wieger Jelsma Mar 21 '17 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.