Idea summary

What is the problem to solve?

(Missing functionality X, prevent Y from happening, make Z easier to do)

Who is this for?

(Evaluators, site visitors, content authors, site managers, (advanced) site builders, frontend developers, backend developers, core developers, site owners, other?)

Result: what will be the outcome?

(Describe the result: how will this improve things for the stated audience(s)?)

How can we know the desired result is achieved?

(Usability test, a metric to track, feedback)

--- Original report ---

Follow-up to #2683085: Improve the message details in Broken Class in Block Module

Problem/Motivation

I feel like we need a better solution than just wording updates. Is there any way to force the creation of a stub block if the related UUID block_content doesn't exist? If we did that creation, that would make the problem solved by pane go away.

The above problem, combined with things like a read only filesystem for your live site makes the Site Building Experience (SBX) very bad of managing configuration surrounding blocks. Considering the bad SBX, marking as major.

Steps to reproduce:

  1. Install site on a read-only filesystem (platform.sh is read-only)
  2. Enable config_readonly in environment.
  3. Attempt to place a block in that environment. Failure. (Read-only disables the creation of a block, see #2728679: Remove 'Place block' from the block layout page when config is set to read only)
  4. Build the block on local.
  5. Export to config.
  6. Deploy to read-only environment. Failure. (This block is broken or missing. You may be missing content or you might need to enable the original module.)
  7. Disable config_readonly on read-only environment.
  8. Build the block that environment.
  9. Next, dump the entire environment's db (This is a huge DX failure)
  10. Import db into local. Add configuration to VCS.
  11. Push to read-only environment
  12. Re-enable config_readonly.

Proposed resolution

Something, anything.

Remaining tasks

TBD

User interface changes

API changes

Comments

heddn created an issue. See original summary.

heddn’s picture

Title: Improve the DX of Configuration in Block Module » Improve the SBX of Configuration in Block Module
Issue summary: View changes
Issue tags:
jonathanshaw’s picture

Wow, that is just awful.

However, I'm not finding it that easy to grasp the problem from the IS.

If I'm understanding it right, the core problem is that the block's config and content need to be created on the same environment, and this clashes with a typical good practice of developing config on local and pushing it to production through VCS, while content is created on master.

At the moment this central issues seems a bit buried in the middle of a sequence of things you might mistakenly try.

I suggest
1) clarifying what the basic problem is, assuming you know already that 1-3 will fail, and that you are intent on committing config to a VCS;
and then
2) describing separately the currently necessary workaround.
3) Things you might mistakenly try could be separate, if they're worth mentioning.

As a platform.sh customer it's a hot issue for me :)

heddn’s picture

re #3: the crux is 8-10. One possible work-around (which I haven't tested yet) is to build a custom block type that allows a reference to a block_content item.

swentel’s picture

heddn’s picture

re #5: that assumes I want to store the content in configuration. Which I don't, I just want to store the fact that a block exists on the homepage, push that to dev/stage/live and manage the block content as I would a node content item.

Thanks for a link to #2248369: [meta] Deploying configuration that depends on content. This is definitely either a duplicate or child of it.

jonathanshaw’s picture

Some thoughts then:

1) Are there any contrib modules implementing #2361423: Add a step to config import to allow contrib to create content based on config dependencies to solve this?

2) #2248369: [meta] Deploying configuration that depends on content#13 suggests the default_content module might be able to help. I'm not sure what that workflow would be.

3) I wonder if Features has anything that offers a way forward.

jonathanshaw’s picture

It seem like #2249303: Implement fallback plugin for Block plugins is the key issue for this in practice.
According to #7 of that, it is possible to create a block on production, NOT PLACE IT, sync db to dev, place the block, export the config from dev back to production, and everything works fine.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tim.plunkett’s picture

Priority: Major » Normal

#8 is correct

heddn’s picture

#8, I decidedly do not like having to sync the database to extract config. But I'm starting to use a more paragraph's driven workflow where I build a paragraph on a landing page content type and place the block via a block content reference in the paragraph. This avoids the problem entirely.

However, my work around doesn't fix the problem. It would be nice to create the container (from block module) in my local environment and place it. Then later create the related content. Or even better automatically create the related content item when first deployed to a environment. We already have all the config items for the related block, we are just missing the bock content itself (if it is a basic block). If it is a custom block backed by code, then the content is primarily driven by that code and "It Just Works" (tm) should be possible.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

james.williams’s picture

@heddn you can write update hooks to script the content creation. We've always used these in custom modules/profiles on deployments anyway, and ensure to run them before any config imports. For example, create a block with \Drupal\block\Entity\Block::create($values) - and you can just hardcode a UUID inside the values there, to match the value in the config that you want to deploy. I recognise hardcoding a UUID feels nasty, so it's not ideal, but I hope you agree this is a much nicer solution that having to sync databases around!

hoporr’s picture

geerlingguy’s picture

yoroy’s picture

Issue summary: View changes
Status: Active » Needs work

I agree with #3 that the problem is not yet that well described in the issue summary. Adding the "idea template" to the issue summary. Short answers to the 4 questions will help us compare and weigh ideas for their relative impact. Thank you!

yoroy’s picture

Hmmm, I somehow thought this was in the ideas queue, sorry!
Might still be useful to clarify the actual problem a bit :)

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.